예제 #1
0
파일: user.php 프로젝트: smrealms/smrv2.0
/**
 * Someone changed his nick
 */
function user_nick($fp, $rdata)
{
    if (preg_match('/^:(.*)!(.*)@(.*)\\sNICK\\s:(.*)\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $new_nick = $msg[4];
        echo_r('[NICK] ' . $nick . ' -> ' . $new_nick);
        // database object
        $db = new SmrMySqlDatabase();
        $db2 = new SmrMySqlDatabase();
        $channel_list = array();
        // 'sign off' all active old_nicks (multiple channels)
        $db->query('SELECT * FROM irc_seen WHERE nick = ' . $db->escapeString($nick) . ' AND signed_off = 0');
        while ($db->nextRecord()) {
            $seen_id = $db->getInt('seen_id');
            // remember channels where this nick was active
            array_push($channel_list, $db->getField('channel'));
            $db2->query('UPDATE irc_seen SET signed_off = ' . time() . ' WHERE seen_id = ' . $seen_id);
        }
        // now sign in the new_nick in every channel
        foreach ($channel_list as $channel) {
            // 'sign in' the new nick
            $db->query('SELECT * FROM irc_seen WHERE nick = ' . $db->escapeString($new_nick) . ' AND channel = ' . $db->escapeString($channel));
            if ($db->nextRecord()) {
                // exiting nick?
                $seen_id = $db->getField('seen_id');
                $db->query('UPDATE irc_seen SET ' . 'signed_on = ' . time() . ', ' . 'signed_off = 0, ' . 'user = '******', ' . 'host = ' . $db->escapeString($host) . ', ' . 'registered = NULL ' . 'WHERE seen_id = ' . $seen_id);
            } else {
                // new nick?
                $db->query('INSERT INTO irc_seen (nick, user, host, channel, signed_on) VALUES(' . $db->escapeString($new_nick) . ', ' . $db->escapeString($user) . ', ' . $db->escapeString($host) . ', ' . $db->escapeString($channel) . ', ' . time() . ')');
            }
        }
        unset($channel_list);
        return true;
    }
    return false;
}
예제 #2
0
<?php

// new db object
$db = new SmrMySqlDatabase();
$loginNews = array();
$db->query('SELECT * FROM game_news ORDER BY time DESC LIMIT 2');
while ($db->nextRecord()) {
    $loginNews[] = array('Message' => $db->getField('message'), 'AdminName' => $db->getField('admin_name'), 'Time' => date(DEFAULT_DATE_DATE_SHORT, $db->getField('time')), 'Recent' => TIME - $db->getField('time') < 24 * 3600);
}
if (count($loginNews) > 0) {
    $template->assign('LoginNews', $loginNews);
}
$db->query('SELECT count(*) AS active_sessions FROM active_session WHERE account_id!=0 AND last_accessed > ' . $db->escapeNumber(TIME - SmrSession::TIME_BEFORE_EXPIRY));
$db->nextRecord();
$template->assign('ActiveSessions', $db->getField('active_sessions'));
$gameNews = array();
$db->query('SELECT * FROM news ORDER BY time DESC LIMIT 4');
while ($db->nextRecord()) {
    $overrideGameID = $db->getInt('game_id');
    $gameNews[] = array('Date' => date(DEFAULT_DATE_DATE_SHORT, $db->getField('time')), 'Time' => date(DEFAULT_DATE_TIME_SHORT, $db->getField('time')), 'Message' => bbifyMessage($db->getField('news_message')));
}
unset($overrideGameID);
if (count($gameNews) > 0) {
    $template->assign('GameNews', $gameNews);
}
include_once 'story.php';
$template->display('login_new.inc');
예제 #3
0
<?php

require_once '../htdocs/config.inc';
require_once LIB . 'Default/SmrMySqlDatabase.class.inc';
require_once LIB . 'Default/Globals.class.inc';
require_once LIB . 'Default/SmrPort.class.inc';
$db = new SmrMySqlDatabase();
$db->query('SELECT account_id,sector_id,game_id FROM player_visited_port');
while ($db->nextRecord()) {
    SmrPort::getCachedPort($db->getInt('game_id'), $db->getInt('sector_id'), $db->getInt('account_id'))->addCachePort($db->getInt('account_id'));
    SmrPort::clearCache();
}
예제 #4
0
$PHP_OUTPUT .= '<p>&nbsp;</p>';
$PHP_OUTPUT .= '<p>';
while ($db->nextRecord()) {
    if ($anon_id != $db->getField('anon_id')) {
        // if this is not the first entry we have to close previous list
        if ($anon_id > 0) {
            $PHP_OUTPUT .= '</ul>';
        }
        // set current anon_id
        $anon_id = $db->getInt('anon_id');
        // start topic for it
        $PHP_OUTPUT .= 'Account #' . $anon_id;
        $PHP_OUTPUT .= '<ul>';
    }
    $curr_account =& SmrAccount::getAccount($db->getInt('account_id'));
    $transaction_id = $db->getInt('transaction_id');
    $db2->query('SELECT * FROM anon_bank_transactions
				 WHERE account_id = ' . $db2->escapeNumber($curr_account->getAccountID()) . ' AND
					   anon_id = ' . $db2->escapeNumber($anon_id) . ' AND
					   transaction_id = ' . $db2->escapeNumber($transaction_id));
    if ($db2->nextRecord()) {
        $text = strtolower($db2->getField('transaction')) . ' ' . number_format($db2->getInt('amount')) . ' credits';
    }
    $PHP_OUTPUT .= '<li>' . $curr_account->getLogin() . ' ' . $text . '</li>';
}
$PHP_OUTPUT .= '</ul>';
$PHP_OUTPUT .= '</p>';
$PHP_OUTPUT .= '<p>&nbsp;</p>';
$PHP_OUTPUT .= '<p>';
$PHP_OUTPUT .= create_link(create_container('skeleton.php', 'log_console.php'), '<b>&lt; Back</b>');
$PHP_OUTPUT .= '</p>';
예제 #5
0
    while ($db2->nextRecord()) {
        $votedFor[$db2->getField('vote_id')] = $db2->getField('option_id');
    }
    $voting = array();
    while ($db->nextRecord()) {
        $voteID = $db->getField('vote_id');
        $voting[$voteID]['ID'] = $voteID;
        $container = array();
        $container['body'] = 'game_play.php';
        $container['url'] = 'vote_processing.php';
        $container['vote_id'] = $voteID;
        $voting[$voteID]['HREF'] = SmrSession::getNewHREF($container);
        $voting[$voteID]['Question'] = $db->getField('question');
        $voting[$voteID]['TimeRemaining'] = format_time($db->getField('end') - TIME, true);
        $voting[$voteID]['Options'] = array();
        $db2->query('SELECT option_id,text,count(account_id) FROM voting_options LEFT OUTER JOIN voting_results USING(vote_id,option_id) WHERE vote_id = ' . $db->escapeNumber($db->getInt('vote_id')) . ' GROUP BY option_id');
        while ($db2->nextRecord()) {
            $voting[$voteID]['Options'][$db2->getField('option_id')]['ID'] = $db2->getField('option_id');
            $voting[$voteID]['Options'][$db2->getField('option_id')]['Text'] = $db2->getField('text');
            $voting[$voteID]['Options'][$db2->getField('option_id')]['Chosen'] = isset($votedFor[$db->getField('vote_id')]) && $votedFor[$voteID] == $db2->getField('option_id');
            $voting[$voteID]['Options'][$db2->getField('option_id')]['Votes'] = $db2->getField('count(account_id)');
        }
    }
    $template->assign('Voting', $voting);
}
// ***************************************
// ** Donation Link
// ***************************************
$template->assign('DonateLink', SmrSession::getNewHREF(create_container('skeleton.php', 'donation.php')));
// ***************************************
// ** Announcements View
예제 #6
0
    $commentsContainer['body'] = 'feature_request_comments.php';
    $db2 = new SmrMySqlDatabase();
    $featureRequests = array();
    while ($db->nextRecord()) {
        $featureRequestID = $db->getInt('feature_request_id');
        $featureRequests[$featureRequestID] = array('RequestID' => $featureRequestID, 'Message' => $db->getField('text'), 'Votes' => array('FAVOURITE' => $db->getInt('fav'), 'YES' => $db->getInt('yes'), 'NO' => $db->getInt('no')), 'VotedFor' => isset($featureVotes[$featureRequestID]) ? $featureVotes[$featureRequestID] : false);
        if ($featureModerator) {
            $featureRequests[$featureRequestID]['RequestAccount'] =& SmrAccount::getAccount($db->getInt('poster_id'));
        }
        if ($var['Status'] == 'Opened') {
            $db2->query('SELECT COUNT(*), vote_type
						FROM account_votes_for_feature
						WHERE feature_request_id=' . $db2->escapeNumber($featureRequestID) . '
						GROUP BY vote_type');
            while ($db2->nextRecord()) {
                $featureRequests[$featureRequestID]['Votes'][$db2->getField('vote_type')] = $db2->getInt('COUNT(*)');
            }
        }
        $db2->query('SELECT COUNT(*)
					FROM feature_request_comments
					WHERE feature_request_id=' . $db2->escapeNumber($featureRequestID));
        while ($db2->nextRecord()) {
            $featureRequests[$featureRequestID]['Comments'] = $db2->getInt('COUNT(*)');
        }
        $commentsContainer['RequestID'] = $featureRequestID;
        $featureRequests[$featureRequestID]['CommentsHREF'] = SmrSession::getNewHREF($commentsContainer);
    }
    $template->assignByRef('FeatureRequests', $featureRequests);
}
$template->assign('FeatureRequestFormHREF', SmrSession::getNewHREF(create_container('feature_request_processing.php', '')));
function getFeaturesCount($status, $onlyCurrent = false)
예제 #7
0
			WHERE ' . $db->escapeNumber(TIME) . ' < end_time
			AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
			AND race_id_1 = ' . $db->escapeNumber($player->getRaceID()));
if ($db->getNumRows() > 0) {
    $db2 = new SmrMySqlDatabase();
    while ($db->nextRecord()) {
        $otherRaceID = $db->getField('race_id_2');
        $container = create_container('council_vote_processing.php', '', array('race_id' => $otherRaceID));
        // get 'yes' votes
        $db2->query('SELECT count(*) FROM player_votes_pact
					WHERE game_id = ' . $db2->escapeNumber($player->getGameID()) . '
						AND race_id_1 = ' . $db2->escapeNumber($player->getRaceID()) . '
						AND race_id_2 = ' . $db2->escapeNumber($otherRaceID) . '
						AND vote = \'YES\'');
        $db2->nextRecord();
        $yesVotes = $db2->getInt('count(*)');
        // get 'no' votes
        $db2->query('SELECT count(*) FROM player_votes_pact
					WHERE game_id = ' . $db2->escapeNumber($player->getGameID()) . '
						AND race_id_1 = ' . $db2->escapeNumber($player->getRaceID()) . '
						AND race_id_2 = ' . $db2->escapeNumber($otherRaceID) . '
						AND vote = \'NO\'');
        $db2->nextRecord();
        $noVotes = $db2->getInt('count(*)');
        $db2->query('SELECT vote FROM player_votes_pact
					WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . '
						AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
						AND race_id_1 = ' . $db->escapeNumber($player->getRaceID()) . '
						AND race_id_2 = ' . $db->escapeNumber($otherRaceID));
        $votedFor = '';
        if ($db2->nextRecord()) {
예제 #8
0
function channel_msg_op_list($fp, $rdata, $account, $player)
{
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!op list\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        echo_r('[OP_LIST] by ' . $nick . ' in ' . $channel);
        // get the op info from db
        $db = new SmrMySqlDatabase();
        $db->query('SELECT 1
					FROM alliance_has_op
					WHERE alliance_id = ' . $player->getAllianceID() . '
						AND game_id = ' . $player->getGameID());
        if (!$db->nextRecord()) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', your leader has not scheduled an OP.' . EOL);
            return true;
        }
        $yes = array();
        $no = array();
        $maybe = array();
        $db->query('SELECT account_id, response
					FROM alliance_has_op_response
					WHERE alliance_id = ' . $player->getAllianceID() . '
						AND game_id = ' . $player->getGameID());
        while ($db->nextRecord()) {
            $respondingPlayer = SmrPlayer::getPlayer($db->getInt('account_id'), $player->getGameID());
            if (!$player->sameAlliance($respondingPlayer)) {
                continue;
            }
            switch ($db->getField('response')) {
                case 'YES':
                    $yes[] = $respondingPlayer;
                    break;
                case 'NO':
                    $no[] = $respondingPlayer;
                    break;
                case 'MAYBE':
                    $maybe[] = $respondingPlayer;
                    break;
            }
        }
        if (count($yes) + count($no) + count($maybe) == 0) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :Noone has signed up for the upcoming OP.' . EOL);
            return true;
        }
        if (count($yes) > 0) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :YES (' . count($yes) . '):' . EOL);
            foreach ($yes as $attendee) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :  * ' . $attendee->getPlayerName() . EOL);
            }
        }
        if (count($no) > 0) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :NO (' . count($no) . '):' . EOL);
            foreach ($no as $attendee) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :  * ' . $attendee->getPlayerName() . EOL);
            }
        }
        if (count($maybe) > 0) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :MAYBE (' . count($maybe) . '):' . EOL);
            foreach ($maybe as $attendee) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :  * ' . $attendee->getPlayerName() . EOL);
            }
        }
        return true;
    }
    return false;
}
예제 #9
0
}
if ($action == 'Yes') {
    // get game id
    $game_id = $var['game_id'];
    if ($save) {
        $db->query('SELECT * FROM alliance WHERE game_id = ' . $db->escapeNumber($game_id));
        while ($db->nextRecord()) {
            $id = $db->getInt('alliance_id');
            //we need info for forces
            //populate alliance list
            $db2->query('SELECT * FROM player
						WHERE alliance_id = ' . $db2->escapeNumber($id) . '
							AND game_id = ' . $db2->escapeNumber($game_id));
            $list = array(0);
            while ($db2->nextRecord()) {
                $list[] = $db2->getInt('account_id');
            }
            $db2->query('SELECT sum(mines) as sum_m, sum(combat_drones) as cds, sum(scout_drones) as sds
						FROM sector_has_forces
						WHERE owner_id IN (' . $db2->escapeArray($list) . ') AND game_id = ' . $db2->escapeNumber($game_id));
            if ($db2->nextRecord()) {
                $mines = $db2->getInt('sum_m');
                $cds = $db2->getInt('cds');
                $sds = $db2->getInt('sds');
            } else {
                $mines = 0;
                $cds = 0;
                $sds = 0;
            }
            // get info we want
            $name = $db->getField('alliance_name');
예제 #10
0
					AND thread_id=' . $db2->escapeNumber($threadID) . '
					AND time>' . $db2->escapeNumber($db->getInt('sendtime')) . ' LIMIT 1');
        $threads[$i]['Unread'] = $db2->getNumRows() == 0;
        if ($db->getInt('sender_id') > 0) {
            $db2->query('SELECT
						player.player_name as player_name,
						alliance_thread.sender_id as sender_id
						FROM player
						JOIN alliance_thread ON alliance_thread.game_id = player.game_id AND player.account_id=alliance_thread.sender_id
						WHERE player.game_id=' . $db2->escapeNumber($player->getGameID()) . '
						AND alliance_thread.alliance_id=' . $db2->escapeNumber($alliance->getAllianceID()) . '
						AND alliance_thread.thread_id=' . $db2->escapeNumber($threadID) . '
						AND alliance_thread.reply_id=1 LIMIT 1
						');
            if ($db2->nextRecord()) {
                $sender_id = $db2->getInt('sender_id');
                $author =& SmrPlayer::getPlayer($sender_id, $player->getGameID());
                $playerName = $author->getLinkedDisplayName(false);
            } else {
                $playerName = 'Unknown';
            }
        } else {
            $sender_id = $db->getInt('sender_id');
            if ($sender_id == 0) {
                $playerName = 'Planet Reporter';
            }
            if ($sender_id == -1) {
                $playerName = 'Bank Reporter';
            }
            if ($sender_id == -2) {
                $playerName = 'Forces Reporter';
예제 #11
0
$db->query('SELECT location_name, location_type_id
			FROM location JOIN location_type USING(location_type_id)
			WHERE location_type_id > ' . $db->escapeNumber(UNDERGROUND) . '
				AND location_type_id < ' . $db->escapeNumber(FED) . '
				AND game_id = ' . $db->escapeNumber($var['game_id']) . '
			ORDER BY location_type_id');
$races = array();
while ($db->nextRecord()) {
    // get the name for this race
    // HACK! cut ' Headquarters' from location name!
    $race_name = substr(stripslashes($db->getField('location_name')), 0, -13);
    $curr_race_id = $db->getField('location_type_id') - 101;
    if (in_array($curr_race_id, $only)) {
        continue;
    }
    $only[] = $curr_race_id;
    // get number of traders in game
    $db2->query('SELECT count(*) as number_of_race FROM player WHERE race_id = ' . $db2->escapeNumber($curr_race_id) . ' AND game_id = ' . $db2->escapeNumber($var['game_id']));
    $db2->nextRecord();
    $races[$curr_race_id]['ID'] = $curr_race_id;
    $races[$curr_race_id]['Name'] = $race_name;
    $races[$curr_race_id]['NumberOfPlayers'] = $db2->getInt('number_of_race');
    $races[$curr_race_id]['Selected'] = false;
}
if (count($races) > 1) {
    do {
        $raceKey = array_rand($races);
    } while ($races[$raceKey]['ID'] == RACE_ALSKANT);
    $races[$raceKey]['Selected'] = true;
}
$template->assign('Races', $races);
예제 #12
0
파일: vote.php 프로젝트: smrealms/smrv2.0
<?php

$template->assign('PageTopic', 'Voting');
$db->query('SELECT * FROM voting ORDER BY end DESC');
if ($db->getNumRows() > 0) {
    $db2 = new SmrMySqlDatabase();
    $votedFor = array();
    $db2->query('SELECT * FROM voting_results WHERE account_id = ' . $db2->escapeNumber($account->getAccountID()));
    while ($db2->nextRecord()) {
        $votedFor[$db2->getInt('vote_id')] = $db2->getInt('option_id');
    }
    $voting = array();
    while ($db->nextRecord()) {
        $voteID = $db->getField('vote_id');
        $voting[$voteID]['ID'] = $voteID;
        $container = create_container('vote.php', 'vote_processing.php');
        $container['vote_id'] = $voteID;
        $voting[$voteID]['HREF'] = SmrSession::getNewHREF($container);
        $voting[$voteID]['Question'] = $db->getField('question');
        if ($db->getField('end') > TIME) {
            $voting[$voteID]['TimeRemaining'] = format_time($db->getField('end') - TIME, true);
        }
        $voting[$voteID]['Options'] = array();
        $db2->query('SELECT option_id,text,count(account_id) FROM voting_options LEFT OUTER JOIN voting_results USING(vote_id,option_id) WHERE vote_id = ' . $db2->escapeNumber($db->getInt('vote_id')) . ' GROUP BY option_id');
        while ($db2->nextRecord()) {
            $voting[$voteID]['Options'][$db2->getInt('option_id')]['ID'] = $db2->getInt('option_id');
            $voting[$voteID]['Options'][$db2->getInt('option_id')]['Text'] = $db2->getField('text');
            $voting[$voteID]['Options'][$db2->getInt('option_id')]['Chosen'] = isset($votedFor[$db->getField('vote_id')]) && $votedFor[$voteID] == $db2->getInt('option_id');
            $voting[$voteID]['Options'][$db2->getInt('option_id')]['Votes'] = $db2->getInt('count(account_id)');
        }
    }
예제 #13
0
<?php

if (!isset($var['CheckType']) || $var['CheckType'] == 'Validate') {
    // is account validated?
    if (!$account->isValidated()) {
        forward(create_container('skeleton.php', 'validate.php'));
    } else {
        $var['CheckType'] = 'Announcements';
    }
}
$db = new SmrMySqlDatabase();
if ($var['CheckType'] == 'Announcements') {
    $db->query('SELECT 1 FROM account JOIN announcement ON last_login < time
				WHERE account_id = ' . $db->escapeNumber(SmrSession::$account_id) . ' LIMIT 1');
    // do we have announcements?
    if ($db->nextRecord()) {
        forward(create_container('skeleton.php', 'announcements.php'));
    } else {
        $var['CheckType'] = 'Updates';
    }
}
if ($var['CheckType'] == 'Updates') {
    $db->query('SELECT last_login FROM account JOIN version ON last_login < went_live
				WHERE account_id = ' . $db->escapeNumber(SmrSession::$account_id) . ' LIMIT 1');
    // do we have updates?
    if ($db->nextRecord()) {
        forward(create_container('skeleton.php', 'changelog_view.php', array('Since' => $db->getInt('last_login'))));
    }
}
forward(create_container('logged_in.php'));
예제 #14
0
        if (isset($_REQUEST['loginType'])) {
            require_once LIB . 'Login/SocialLogin.class.inc';
            $socialLogin = new SocialLogin($_REQUEST['loginType']);
            if (!$socialLogin->isValid()) {
                $msg = 'Error validating login.';
                header('Location: ' . URL . '/login.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES)));
                exit;
            }
            $loginType = $socialLogin->getLoginType();
            $authKey = $socialLogin->getUserID();
            $db->query('SELECT account_id,old_account_id FROM account JOIN account_auth USING(account_id)
						WHERE login_type = ' . $db->escapeString($loginType) . '
						   AND auth_key = ' . $db->escapeString($authKey) . ' LIMIT 1');
            if ($db->nextRecord()) {
                // register session
                SmrSession::$account_id = $db->getInt('account_id');
                SmrSession::$old_account_id = $db->getInt('old_account_id');
            } else {
                if ($socialLogin->getEmail() != null) {
                    $db->query('SELECT account_id,old_account_id FROM account ' . 'WHERE email = ' . $db->escapeString($socialLogin->getEmail()) . ' LIMIT 1');
                }
                if ($socialLogin->getEmail() != null && $db->nextRecord()) {
                    //Email already has an account so let's link.
                    $account =& SmrAccount::getAccount($db->getField('account_id'));
                    $account->addAuthMethod($socialLogin->getLoginType(), $socialLogin->getUserID());
                    $account->setValidated(true);
                    SmrSession::$account_id = $db->getField('account_id');
                    SmrSession::$old_account_id = $db->getField('old_account_id');
                } else {
                    session_start();
                    //Pass the data in a standard session as we don't want to initialise a normal one.
예제 #15
0
    if ($db->getNumRows()) {
        $PHP_OUTPUT .= '<br /><h2>Your accounts</h2><br />';
        $PHP_OUTPUT .= '<div align=center>';
        $PHP_OUTPUT .= '<table class="standard inset" ><tr><th>ID</th><th>Password</th><th>Last Transaction</th><th>Balance</th><th>Option</th></tr>';
        $container = create_container('skeleton.php', 'bank_anon.php');
        $db2 = new SmrMySqlDatabase();
        while ($db->nextRecord()) {
            $PHP_OUTPUT .= '<tr><td class="shrink center">';
            $PHP_OUTPUT .= $db->getInt('anon_id');
            $PHP_OUTPUT .= '</td><td>';
            $PHP_OUTPUT .= $db->getField('password');
            $PHP_OUTPUT .= '</td><td class="shrink noWrap">';
            $db2->query('SELECT MAX(time) FROM anon_bank_transactions
						WHERE game_id=' . $db2->escapeNumber($player->getGameID()) . '
						AND anon_id=' . $db2->escapeNumber($db->getInt('anon_id')) . ' LIMIT 1');
            if ($db2->nextRecord() && $db2->getInt('MAX(time)')) {
                $PHP_OUTPUT .= date(DATE_FULL_SHORT, $db2->getInt('MAX(time)'));
            } else {
                $PHP_OUTPUT .= 'No transactions';
            }
            $PHP_OUTPUT .= '</td><td class="right shrink">';
            $PHP_OUTPUT .= $db->getInt('amount');
            $PHP_OUTPUT .= '</td><td class="button">';
            $container['AccountNumber'] = $db->getInt('anon_id');
            $container['Password'] = $db->getField('password');
            $PHP_OUTPUT .= create_button($container, 'Access Account');
            $PHP_OUTPUT .= '</td></tr>';
        }
        $PHP_OUTPUT .= '</table></div><br /><br />';
    }
    $container = create_container('skeleton.php', 'bank_anon.php');
예제 #16
0
<?php

require_once '../htdocs/config.inc';
require_once LIB . 'Default/Globals.class.inc';
require_once get_file_loc('ChessGame.class.inc');
SmrSession::$game_id = 44;
$db = new SmrMySqlDatabase();
$db->query('DELETE FROM player_hof WHERE type LIKE \'Chess%\'');
$db->query('SELECT chess_game_id FROM chess_game');
while ($db->nextRecord()) {
    $chessGameID = $db->getInt('chess_game_id');
    $game =& ChessGame::getChessGame($chessGameID);
    echo 'Running game ' . $chessGameID . ' for white id "' . $game->getWhiteID() . '", black id "' . $game->getBlackID() . '", winner "' . $game->getWinner() . '"' . EOL;
    echoChessMoves($game);
    $game->rerunGame(true);
    echo 'Finished game ' . $chessGameID . ' for white id "' . $game->getWhiteID() . '", black id "' . $game->getBlackID() . '", winner "' . $game->getWinner() . '"' . EOL;
    echoChessMoves($game);
}
function echoChessMoves($game)
{
    echo 'Moves: ' . EOL;
    $moves = $game->getMoves();
    foreach ($moves as $move) {
        echo $move . EOL;
    }
    echo EOL;
}
예제 #17
0
    $PHP_OUTPUT .= create_echo_form($container);
    $PHP_OUTPUT .= '<td align="center">';
    $PHP_OUTPUT .= create_submit('Reset');
    $PHP_OUTPUT .= '</td>';
    $PHP_OUTPUT .= '</form>';
    if (empty($other)) {
        $other = 'N/A';
    }
    $PHP_OUTPUT .= '<td align="right" valign="top" width="10%" class="bold">Other&nbsp;Info :<br /><small>(AIM/ICQ)&nbsp;&nbsp;</small></td><td colspan="2">' . $other . '</td>';
    $PHP_OUTPUT .= '</tr>';
    $container['task'] = 'delete_comment';
    $PHP_OUTPUT .= create_echo_form($container);
    $PHP_OUTPUT .= '<input type="hidden" name="task" value="delete_comment">';
    $PHP_OUTPUT .= '<tr><td>&nbsp;</td><td colspan="3"><u>Comments</u></td></tr>';
    $db->query('SELECT *
				FROM album_has_comments
				WHERE album_id = ' . $db->escapeNumber($account_id));
    while ($db->nextRecord()) {
        $comment_id = $db->getInt('comment_id');
        $time = $db->getInt('time');
        $postee = get_album_nick($db->getInt('post_id'));
        $msg = stripslashes($db->getField('msg'));
        $PHP_OUTPUT .= '<tr><td align="center"><input type="checkbox" name="comment_ids[]" value="' . $comment_id . '"></td><td colspan="3"><span style="font-size:85%;">[' . date('Y/n/j g:i A', $time) . '] &lt;' . $postee . '&gt; ' . $msg . '</span></td></tr>';
    }
    $PHP_OUTPUT .= '<tr><td align="center">';
    $PHP_OUTPUT .= create_submit('Delete');
    $PHP_OUTPUT .= '</td>';
    $PHP_OUTPUT .= '<td colspan="3">&nbsp;</td></tr>';
    $PHP_OUTPUT .= '</form>';
    $PHP_OUTPUT .= '</table>';
}