本文整理汇总了PHP中SmrMySqlDatabase::f方法的典型用法代码示例。如果您正苦于以下问题:PHP SmrMySqlDatabase::f方法的具体用法?PHP SmrMySqlDatabase::f怎么用?PHP SmrMySqlDatabase::f使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmrMySqlDatabase
的用法示例。
在下文中一共展示了SmrMySqlDatabase::f方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rand
echo 'You ask the bartender for some water and you quickly down it.<br>You dont feel quite so intoxicated anymore.<br>';
$db2->query('DELETE FROM player_has_drinks WHERE game_id=' . $player->game_id . ' AND account_id=' . $player->account_id . ' LIMIT 1');
} else {
$random = mt_rand(1, 20);
//only get Azool or Spock drink if they are very lucky
if ($random != 1) {
$db->query("SELECT * FROM bar_drink WHERE drink_id != 1 && drink_id != 11 ORDER BY rand() LIMIT 1");
} else {
$db->query("SELECT * FROM bar_drink ORDER BY rand() LIMIT 1");
}
if ($db->next_record()) {
$drink_name = $db->f("drink_name");
$drink_id = $db->f("drink_id");
$db2->query("SELECT * FROM player_has_drinks WHERE game_id = " . SmrSession::$game_id . " ORDER by drink_id DESC LIMIT 1");
if ($db2->next_record()) {
$curr_drink_id = $db2->f("drink_id") + 1;
} else {
$curr_drink_id = 1;
}
if ($drink_id != 11 && $drink_id != 1) {
print "You have bought a {$drink_name} for \$10";
$db2->query("INSERT INTO player_has_drinks (account_id, game_id, drink_id, time) VALUES ({$player->account_id}, " . SmrSession::$game_id . ", {$curr_drink_id}, {$time})");
} else {
print "The bartender says, Ive got something special for ya.<br>";
print "The bartender turns around for a minute and whips up a {$drink_name}.<br>";
if ($drink_id == 1) {
print "The bartender says that Spock himself gave him the directions to make this drink.<br>";
}
print "You drink the {$drink_name} and feel like like you have been drinking for hours.<br>";
if ($drink_id == 11) {
print "After drinking the {$drink_name} you feel like nothing can bring you down and like you are the best trader in the universe.<br>";
示例2: array
echo '<div align=center>';
echo '<table cellspacing="0" cellpadding="0" class="standard inset" ><tr><th>ID</th><th>Password</th><th>Last Transaction</th><th>Balance</th><th>Option</th></tr>';
$container = array();
$container["url"] = "skeleton.php";
$container["body"] = "bank_anon.php";
$db2 = new SmrMySqlDatabase();
while ($db->next_record()) {
$db2->query('SELECT MAX(time) FROM anon_bank_transactions
WHERE game_id=' . $player->game_id . '
AND anon_id=' . $db->f('anon_id') . ' LIMIT 1');
echo '<tr><td class="shrink center">';
echo $db->f("anon_id");
echo '</td><td>';
echo $db->f("password");
echo '</td><td class="shrink nowrap">';
if ($db2->next_record() && $db2->f('MAX(time)')) {
echo date('n/j/Y g:i:s A', $db2->f('MAX(time)'));
} else {
echo 'No transactions';
}
echo '</td><td class="right shrink">';
echo $db->f("amount");
echo '</td><td class="button">';
$container["account_num"] = $db->f("anon_id");
$container["password"] = $db->f("password");
print_button($container, 'Access Account');
echo '</td></tr>';
}
echo '</table></div><br>';
}
$container = array();
示例3: addslashes
$port_info[$good_id] = $transaction;
}
//insert the last port
$db2->query("REPLACE INTO player_visited_port (account_id, game_id, sector_id, visited, port_info) " . "VALUES({$account_id}, {$game_id}, {$current_sector_id}, {$current_time}, '" . addslashes(serialize($port_info)) . "')");
//offer another drink and such
print "<div align=center>Galaxy Info has been added. Enjoy!</div><br>";
include get_file_loc("bar_opening.php");
} else {
//find what gal they want
$container = array();
$container["url"] = "skeleton.php";
$container["body"] = "bar_main.php";
$container["script"] = "bar_galmap_buy.php";
$container["process"] = "yes";
print "<div align=center>What galaxy do you want info on?<br>";
print_form($container);
print "<select type=select name=gal_id>";
print "<option value=0>[Select a galaxy]</option>";
$db->query("SELECT galaxy_id FROM sector WHERE game_id = {$player->game_id} GROUP BY galaxy_id ORDER BY galaxy_id ASC");
$db2 = new SmrMySqlDatabase();
while ($db->next_record()) {
$gal_id = $db->f("galaxy_id");
$db2->query("SELECT * FROM galaxy WHERE galaxy_id = {$gal_id}");
if ($db2->next_record()) {
print "<option value={$gal_id}>" . $db2->f("galaxy_name") . "</option>";
}
}
print "</select><br>";
print_submit("Buy the map");
print "</form></div>";
}
示例4: while
return;
}
print_topic("Confirmation");
print "Are you sure you want to transfer {$amount} credits to<br>";
$db->query("SELECT * FROM account WHERE account_id = {$account_id}");
if ($db->next_record()) {
$login = $db->f("login");
}
$db->query("SELECT * FROM player WHERE account_id = {$account_id}");
if ($db->nf()) {
while ($db->next_record()) {
$player_name = stripslashes($db->f("player_name"));
$game_id = $db->f("game_id");
$db2->query("SELECT * FROM game WHERE game_id = {$game_id}");
if ($db2->next_record()) {
$game_name = $db2->f("game_name");
}
print "{$player_name} in game {$game_name}({$game_id})<br>";
}
} else {
print "Player with login name {$login}?<br>";
}
print "<p> </p>";
$container = array();
$container["url"] = "preferences_processing.php";
$container["account_id"] = $account_id;
$container["amount"] = $amount;
print_form($container);
print_submit("Yes");
print " ";
print_submit("No");
示例5: array
$curr_attacker->relations[$port->race_id] = -500;
}
// save what we got so far
$curr_attacker->update();
// disable cloak
$curr_attacker_ship->disable_cloak();
// the damage this attacker is going to do
$attacker_damage = 0;
// and his message array
$damage_msg = array();
$weapon = new SmrMySqlDatabase();
$weapon->query("SELECT * FROM ship_has_weapon NATURAL JOIN weapon_type " . "WHERE account_id = {$curr_attacker->account_id} AND " . "game_id = {$curr_attacker->game_id} " . "ORDER BY order_id");
// iterate over all existing weapons
while ($weapon->next_record()) {
//vars
$weapon_name = $weapon->f("weapon_name");
$shield_damage = $weapon->f("shield_damage");
$armor_damage = $weapon->f("armor_damage");
$accuracy = $weapon->f("accuracy");
// calc accuracy for this weapon
$hit = round($accuracy + $curr_attacker->level_id - $port->level / 2);
// did we hit with this weapon?
if (mt_rand(0, 100) < $hit) {
// does the port has shields?
if ($port->shields > 0) {
if ($shield_damage > 0) {
// do we do more damage than shields left?
if ($shield_damage > $port->shields) {
$shield_damage = $port->shields;
}
// accumulate the attacker_damage
示例6: get_file_loc
print_topic("FEDERAL HQ");
}
// header menue
include get_file_loc('menue.inc');
print_hq_menue();
// secondary db object
$db2 = new SmrMySqlDatabase();
if (isset($location_type_id)) {
print "<div align=\"center\">We are at WAR with<br><br>";
$db->query("SELECT * FROM race_has_relation WHERE game_id = {$player->game_id} AND race_id_1 = {$race_id}");
while ($db->next_record()) {
$relation = $db->f("relation");
$race_2 = $db->f("race_id_2");
$db2->query("SELECT * FROM race WHERE race_id = {$race_2}");
$db2->next_record();
$race_name = $db2->f("race_name");
if ($relation <= -300) {
print "<span style=\"color:red;\">The {$race_name}<br></span>";
}
}
print "<br>The government will PAY for the destruction of their ships!";
}
$db->query("SELECT * FROM bounty WHERE game_id = {$player->game_id} AND type = 'HQ' AND claimer_id = 0 ORDER BY amount DESC");
print "<p> </p>";
if ($db->nf()) {
print "<div align=\"center\">Most Wanted by Federal Government</div><br>";
print_table();
print "<tr>";
print "<th>Player Name</th>";
print "<th>Bounty Amount</th>";
print "</tr>";
示例7: while
print "<tr>";
print "<th align=\"center\">Rank</th>";
print "<th align=\"center\">Player</th>";
print "<th align=\"center\">{$second_display}</th>";
print "</tr>";
$count = 1;
while ($db->next_record()) {
//get the account
$curr_account = new SMR_ACCOUNT();
$curr_account->get_by_id($db->f("account_id"));
$name = stripslashes($curr_account->HoF_name);
$db2 = new SmrMySqlDatabase();
if ($id == 'donation') {
$db2->query("SELECT sum(amount) FROM account_donated WHERE account_id = {$curr_account->account_id}");
$db2->next_record();
$stat = $db2->f("sum(amount)");
} else {
$stat = $db->f("{$id}");
}
print "<tr>";
print "<td align=\"center\">{$count}</td>";
print "<td align=center>{$name}</td>";
if ($action != "Experience Gained") {
print "<td align=center> " . number_format($stat) . " </td>";
} else {
print "<td align=center> " . number_format($stat / 4, 2) . " </td>";
}
$count++;
print "</tr>";
}
print "</table>";
示例8: foreach
if ($planet->build()) {
print "{$planet->current_building_name}<br>";
print print_time($planet->time_left);
} else {
print "Nothing";
}
print "</td>";
print "<td align=\"center\">{$planet->shields}</td>";
print "<td align=\"center\">{$planet->drones}</td>";
print "<td align=\"left\">";
$supply = false;
foreach ($planet->stockpile as $id => $amount) {
if ($amount > 0) {
$db2->query("SELECT * FROM good WHERE good_id = {$id}");
if ($db2->next_record()) {
print $db2->f("good_name") . ": {$amount}<br>";
}
$supply = true;
}
}
if (!$supply) {
print "none";
}
print "</td>";
}
print "</table>";
print "</div>";
} elseif ($planet_sec == 0) {
print "Your alliance has no claimed planets!";
} else {
print "Your planet is the only planet in the alliance!";
示例9: while
$db2->query("SELECT * FROM message WHERE account_id = {$player->account_id} AND message_type_id = " . MSG_POLITICAL . " AND game_id = {$player->game_id}");
if (onCouncil($player->race_id) || $db2->nf()) {
$db->query("SELECT * FROM message_type " . "WHERE message_type_id < 8 " . "ORDER BY message_type_id");
} else {
$db->query("SELECT * FROM message_type " . "WHERE message_type_id != 5 " . "ORDER BY message_type_id");
}
while ($db->next_record()) {
$message_type_id = $db->f("message_type_id");
$message_type_name = $db->f("message_type_name");
// do we have unread msges in that folder?
$db2->query("SELECT * FROM message " . "WHERE account_id = " . SmrSession::$old_account_id . " AND " . "game_id = " . SmrSession::$game_id . " AND " . "message_type_id = {$message_type_id} AND " . "msg_read = 'FALSE'");
$msg_read = $db2->nf();
// get number of msges
$db2->query("SELECT count(message_id) as message_count FROM message " . "WHERE account_id = " . SmrSession::$old_account_id . " AND " . "game_id = " . SmrSession::$game_id . " AND " . "message_type_id = {$message_type_id}");
if ($db2->next_record()) {
$message_count = $db2->f("message_count");
}
print "<tr>";
print "<td";
if ($msg_read) {
print " style=\"font-weight:bold;\"";
}
print ">";
$container = array();
$container["url"] = "skeleton.php";
$container["body"] = "message_view.php";
$container["folder_id"] = $message_type_id;
print_link($container, $message_type_name);
print "</td>";
print "<td align=\"center\" style=\"color:yellow;";
if ($msg_read) {
示例10: get_file_loc
<?php
require_once get_file_loc('smr_sector.inc');
$sector = new SMR_SECTOR($player->sector_id, SmrSession::$game_id, SmrSession::$old_account_id);
print_topic("READING THE WALL");
include get_file_loc('menue.inc');
print_bar_menue();
$db = new SmrMySqlDatabase();
$db->query("SELECT message_id FROM bar_wall WHERE sector_id = {$sector->sector_id} AND game_id = " . SmrSession::$game_id . " ORDER BY message_id DESC");
if ($db->next_record()) {
$amount = $db->f("message_id") + 1;
} else {
$amount = 1;
}
$time_now = time();
$db2 = new SmrMySqlDatabase();
$wall = $_REQUEST['wall'];
if (isset($wall)) {
$db2->query("INSERT INTO bar_wall (sector_id, game_id, message_id, message, time) VALUES ({$sector->sector_id}, " . SmrSession::$game_id . ", {$amount}, " . format_string($wall, true) . " , {$time_now})");
}
$db->query("SELECT * FROM bar_wall WHERE game_id = {$player->game_id} AND sector_id = {$player->sector_id} ORDER BY time DESC");
if ($db->nf()) {
print "<table cellspacing=\"0\" cellpadding=\"3\" border=\"0\" class=\"standard\">";
print "<tr>";
print "<th align=\"center\">Time written</th>";
print "<th align=\"center\">Message</th>";
print "</tr>";
while ($db->next_record()) {
$time = $db->f("time");
$message_on_wall = stripslashes($db->f("message"));
print "<tr>";
示例11: do_voodoo
function do_voodoo()
{
ob_clean();
global $lock, $var;
foreach ($GLOBALS as $key => $value) {
${$key} =& $GLOBALS[$key];
}
// initialize objects we usually need, like player, ship
if (SmrSession::$game_id > 0) {
$db = new SmrMySqlDatabase();
// We need to acquire locks BEFORE getting the player information
// Otherwise we could be working on stale information
$db->query('SELECT sector_id FROM player WHERE account_id=' . SmrSession::$old_account_id . ' AND game_id=' . SmrSession::$game_id . ' LIMIT 1');
$db->next_record();
$sector_id = $db->f('sector_id');
if (!$lock && $var['body'] != 'error.php' && !isset($var['ForwardError'])) {
if (!acquire_lock($sector_id)) {
create_error("Failed to acquire sector lock");
}
}
// Now that they've acquire a lock we can move on
$player = new SMR_PLAYER(SmrSession::$old_account_id, SmrSession::$game_id);
if ($player->dead == 'TRUE' && $var['body'] != 'death.php' && !isset($var['override_death'])) {
$container = array();
$container["url"] = "skeleton.php";
$container["body"] = "death.php";
forward($container);
}
$ship = new SMR_SHIP(SmrSession::$old_account_id, SmrSession::$game_id);
// update turns on that player
$player->update_turns($ship->speed);
if ($player->newbie_turns <= 20 && $player->newbie_warning == "TRUE" && $var["body"] != "newbie_warning.php") {
forward(create_container("skeleton.php", "newbie_warning.php"));
}
}
require get_file_loc($var["url"]);
SmrSession::update();
if ($lock) {
release_lock($lock);
}
exit;
}
示例12: SmrMySqlDatabase
print "<a href=\"http://www.mpogd.com/gotm/vote.asp\" target=\"_game_site\"><img border=\"0\" src=\"images/game_sites/mpogd.png\" width=\"98\" height=\"41\"></a> ";
}
$db->query("SELECT timeout FROM vote_links WHERE account_id=" . SmrSession::$old_account_id . " AND link_id=2 LIMIT 1");
if (isset(SmrSession::$game_id) && SmrSession::$game_id > 0 && (!$db->next_record() || $db->f("timeout") < time() - 86400) && rand(0, 100) < 80) {
$container["link_id"] = 2;
print "<a href='javascript:window.open(\"http://www.topwebgames.com/in.asp?id=136\");document.location=\"" . URL . "/loader2.php?sn=" . SmrSession::get_new_sn($container) . "\"'><img border=\"0\" src=\"images/game_sites/twg_vote.png\" width=\"98\" height=\"41\"></a>";
} else {
$container["link_id"] = 0;
print "<a href=\"http://www.topwebgames.com/in.asp?id=136\" target=\"_game_site\"><img border=\"0\" src=\"images/game_sites/twg.png\" width=\"98\" height=\"41\"></a> ";
}
$db->query("SELECT timeout FROM vote_links WHERE account_id=" . SmrSession::$old_account_id . " AND link_id=3 LIMIT 1");
if (isset(SmrSession::$game_id) && SmrSession::$game_id > 0 && (!$db->next_record() || $db->f("timeout") < time() - 86400) && rand(0, 100) < 80) {
$container["link_id"] = 3;
print "<a href='javascript:window.open(\"http://www.omgn.com/topgames/vote.php?Game_ID=30\");document.location=\"" . URL . "/loader2.php?sn=" . SmrSession::get_new_sn($container) . "\"'><img border=\"0\" src=\"images/game_sites/omgn_vote.jpg\" width=\"98\" height=\"41\"></a>";
} else {
$container["link_id"] = 0;
print "<a href=\"http://www.omgn.com/topgames/vote.php?Game_ID=30\" target=\"_game_site\"><img border=\"0\" src=\"images/game_sites/omgn.jpg\" width=\"98\" height=\"41\"></a> ";
}
print "</td>";
$db = new SmrMySqlDatabase();
$db->query("SELECT *\n\t\t\tFROM version\n\t\t\tORDER BY went_live DESC\n\t\t\tLIMIT 1\n\t\t ");
if ($db->next_record()) {
$version_id = $db->f("version_id");
$container = array('url' => 'skeleton.php', 'body' => 'changelog_view.php', 'version_id' => $version_id);
$version = create_link($container, 'v' . $db->f('major_version') . '.' . $db->f('minor_version') . '.' . $db->f('patch_level'));
}
$this_year = date("Y");
$time_elapsed = getmicrotime() - $time_start;
print "<td align=\"right\" width=\"100%\" style=\"vertical-align:bottom\"><span style=\"font-size:75%;\">Space Merchant Realms<br>{$version} © 2001-{$this_year}<br>hosted by <a href=\"http://www.fem.tu-ilmenau.de/fem_neu/scripts/index.php?fuseaction=page.content&id=1&menue_name=englisch\" target=\"fem\">FeM</a><br />Script runtime: " . number_format($time_elapsed, 3) . " sec</span></td>";
print "</tr>";
print "</table>";
示例13: elseif
} elseif ($player->controlled != $player->sector_id) {
$db->query("SELECT * FROM port_has_goods " . "WHERE game_id = {$player->game_id} AND " . "sector_id = {$player->sector_id} AND " . "(good_id = 5 OR good_id = 9 OR good_id = 12)");
$base_chance = 15 - $db->nf() * 4;
if ($ship->ship_type_id == 23 || $ship->ship_type_id == 24 || $ship->ship_type_id == 25) {
$base_chance -= 4;
}
$rand = mt_rand(1, 100);
if ($rand <= $base_chance) {
if (!empty($ship->cargo[5]) || !empty($ship->cargo[9]) || !empty($ship->cargo[12])) {
//find the fine
//get base for ports that dont happen to trade that good
$query = new SmrMySqlDatabase();
$query->query("SELECT * FROM good WHERE good_id = 5 OR good_id = 9 OR good_id = 12");
$base = array();
while ($query->next_record()) {
$base[$query->f("good_id")] = $query->f("base_price");
}
$fine = $port->level * ($ship->cargo[5] * $base[5] + $ship->cargo[9] * $base[9] + $ship->cargo[12] * $base[12]);
$player->credits -= $fine;
if ($player->credits < 0) {
// because credits is 0 it will take money from bank
$player->bank += $player->credits;
// set credits to zero
$player->credits = 0;
// leave insurance
if ($player->bank < 5000) {
$player->bank = 5000;
}
}
print "<span style=\"color:red;\">The Federation searched your ship and illegal goods were found!</span><br>";
print "<span style=\"color:red;\">All illegal goods have been removed from your ship and you have been fined " . number_format($fine) . " credits</span>";
示例14: stripslashes
}
if ($sender_id == -1) {
$playerName = 'Bank Reporter';
}
if ($sender_id == -2) {
$playerName = 'Forces Reporter';
}
if ($sender_id == -3) {
$playerName = 'Game Admins';
}
}
$threads[$i]['tail'] .= '</td><td class="shrink nowrap">';
$threads[$i]['tail'] .= stripslashes($playerName);
$db3->query("SELECT * FROM player_has_alliance_role WHERE account_id = {$player->account_id} AND game_id = {$player->game_id} AND alliance_id={$player->alliance_id}");
if ($db3->next_record()) {
$role_id = $db3->f("role_id");
} else {
$role_id = 0;
}
$db3->query("SELECT * FROM alliance_has_roles WHERE alliance_id = {$alliance_id} AND game_id = {$player->game_id} AND role_id = {$role_id}");
$db3->next_record();
if ($player->account_id == $sender_id || $db3->f("mb_messages")) {
$container['thread_id'] = $db->f('thread');
$threads[$i]['tail'] .= '<br><small>';
$threads[$i]['tail'] .= create_link($container, 'Delete Thread!');
$threads[$i]['tail'] .= '</small>';
}
$threads[$i]['tail'] .= '</td><td class="shrink center">';
$threads[$i]['tail'] .= $db->f('num_replies');
$thread_replies[$i] = $db->f('num_replies');
$threads[$i]['tail'] .= '</td><td class="shrink nowrap">';
示例15: SmrMySqlDatabase
<?php
print_topic("Change Log");
$db2 = new SmrMySqlDatabase();
$db->query("SELECT *\n\t\t\tFROM version\n\t\t\tWHERE version_id <= " . $var['version_id'] . "\n\t\t\tORDER BY version_id DESC");
while ($db->next_record()) {
$version_id = $db->f("version_id");
$version = $db->f("major_version") . "." . $db->f("minor_version") . "." . $db->f("patch_level");
$went_live = $db->f("went_live");
// get human readable format for date
if ($went_live > 0) {
$went_live = date("m/d/Y - h:i A", $went_live);
} else {
$went_live = "never";
}
print "<b><small>{$version} ({$went_live}):</small></b>";
print '<ul>';
$db2->query("SELECT *\n\t\t\t\tFROM changelog\n\t\t\t\tWHERE version_id = {$version_id}\n\t\t\t\tORDER BY changelog_id");
while ($db2->next_record()) {
print '<li>' . stripslashes($db2->f('change_title')) . '<br /><small>' . stripslashes($db2->f('change_message')) . '</small></li>';
}
print '</ul>';
}