本文整理汇总了PHP中dbn函数的典型用法代码示例。如果您正苦于以下问题:PHP dbn函数的具体用法?PHP dbn怎么用?PHP dbn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addLocation
function addLocation()
{
global $strVenueName, $strVenueAddress, $strAPIId, $strLocationId, $strLatitude, $strLongitude;
//some data is missing;
if ($strVenueName == "" || $strVenueAddress == "" || $strAPIId == "" || $strLatitude == "" || $strLongitude == "") {
return 0;
}
$strLocationId = "";
//Check to see if the actual location exists
db("SELECT LocationId FROM locations WHERE LocationName = '" . $strVenueName . "' AND LocationAddress = '" . $strVenueAddress . "' AND API_ID = '" . $strAPIId . "'");
$location_exists = dbr();
if (empty($location_exists) == true) {
//Check to see if the locationname is in use
db("SELECT LocationId FROM locations WHERE API_ID = '" . $strAPIId . "'");
$apiID_exists = dbr();
if (empty($apiID_exists) == true) {
//Insert our new location
dbn("INSERT INTO locations (LocationName, LocationAddress, API_ID, LocationLat, LocationLong) VALUES ('" . $strVenueName . "', '" . $strVenueAddress . "', '" . $strAPIId . "', '" . $strLatitude . "', '" . $strLongitude . "')");
db("SELECT LocationId FROM locations WHERE LocationName = '" . $strVenueName . "' AND LocationAddress = '" . $strVenueAddress . "' AND API_ID = '" . $strAPIId . "'");
$location_created = dbr();
//location has successfully registered
if (empty($location_created) == false) {
$strLocationId = $location_created['LocationId'];
return $location_created['LocationId'];
} else {
return -1;
}
} else {
return -2;
}
} else {
$strLocationId = $location_exists['LocationId'];
return $location_exists['LocationId'];
}
}
示例2: updateReview
function updateReview()
{
global $intReviewId, $strWhichRating;
if ($intReviewId == "" || $strWhichRating == "") {
return 0;
}
dbn("UPDATE locationreview SET " . $strWhichRating . " = " . $strWhichRating . " + 1 WHERE ReviewId = '" . $intReviewId . "'");
return 1;
}
示例3: addReview
function addReview()
{
global $intLocationId, $intUserId, $strReview, $fltRating;
if ($intLocationId == "" || $intUserId == "") {
return 0;
}
if ($strReview == "" && $fltRating == "") {
return -1;
}
dbn("INSERT INTO locationreview (LocationId, UserId, DateTime, ReviewText, ReviewRating) VALUES ('" . $intLocationId . "', '" . $intUserId . "', '" . Time() . "', '" . $strReview . "', '" . $fltRating . "')");
if ($fltRating > 0.0) {
db("SELECT AVG(ReviewRating) as Average FROM locationreview WHERE LocationId = '" . $intLocationId . "' AND ReviewRating > 0.0");
$avg = dbr();
if ($avg['Average'] != null) {
dbn("UPDATE locations SET LocationRatings = '" . $avg['Average'] . "', LocationUseRatings = '1' WHERE LocationId = '" . $intLocationId . "'");
}
}
return 1;
}
示例4: charge_turns
$elect_sold = $elect_sold + $user_ship['elect'];
$fuel_sold = $fuel_sold + $user_ship['fuel'];
$metal_sold = $metal_sold + $user_ship['metal'];
# if ($user_ship[metal] > 0) { $error_str .= "You sold $user_ship[metal] units of metal.<p />"; }
# if ($user_ship[fuel] > 0) { $error_str .= "You sold $user_ship[fuel] units of fuel.<p />";
# if ($user_ship[elect] > 0) { $error_str .= "You sold $user_ship[elect] units of electronics.<p />";
charge_turns(1);
$error_str .= $st[785] . "<p />";
$error_str .= "<p />{$st['774']}: <b>{$metal_sold}</b><br />{$st['775']}: <b>{$fuel_sold}</b><br />{$st['776']}: <b>{$elect_sold}</b>";
$error_str .= "<p />{$st['777']}: <b>";
$total_goods = $metal_sold + $fuel_sold + $elect_sold;
$error_str .= "{$total_goods}</b>";
$error_str .= "<br />{$st['778']}: <b>{$sold_worth}</b>.<p />";
}
}
dbn("update {$db_name}_users set cash = cash + {$sold_worth} where login_id = {$user['login_id']}");
$user['cash'] += $sold_worth;
$user_ship['metal'] = 0;
$user_ship['fuel'] = 0;
$user_ship['elect'] = 0;
# $user_ship[colon] = 0;
}
empty_bays($user_ship);
$sold_worth = 0;
$ship_count = 0;
db("select elect,fuel,metal,ship_id from {$db_name}_ships where location = {$user['location']} and login_id = {$user['login_id']}");
while ($current_ship = dbr()) {
$sold_worth += $current_ship['elect'] * $elect_sell + $current_ship['fuel'] * $fuel_sell + $current_ship['metal'] * $metal_sell;
$elect_sold = $elect_sold + $current_ship['elect'];
$fuel_sold = $fuel_sold + $current_ship['fuel'];
$metal_sold = $metal_sold + $current_ship['metal'];
示例5: dbn
dbn("update se_games set description = '{$new_descr}' where db_name = '{$db_name}'");
$out .= "The description of the game has been changed.";
}
print_page("Change Description", $out);
insert_history($user['login_id'], "Game description changed.");
//change ships available to players.
} elseif (isset($_REQUEST['admin_choose'])) {
if (isset($_POST['add_ship'])) {
db("select type_id from se_ship_types where type_id > 2 && auction = 0");
while ($list_ships = dbr(1)) {
if (!isset($add_ship[$list_ships['type_id']])) {
//admin has turned ship off.
dbn("update se_admin_ships set {$db_name}_ship_status = 0 where ship_type_id = '{$list_ships['type_id']}'");
} else {
//ship is turned on.
dbn("update se_admin_ships set {$db_name}_ship_status = 1 where ship_type_id = '{$list_ships['type_id']}'");
}
}
$out .= "Selected ships have now been made available to the players. The rest of the ships are un-available.";
} else {
$out .= "Select the ships that you would like users to be able to use within the game:";
$out .= "\n<form name='select_ships' action='{$_SERVER['PHP_SELF']}' method='POST'>";
$out .= "\n<input type='hidden' name='admin_choose' value='1' />";
$out .= make_table(array("<b class='b1'>Ship Name</b>", "Available"));
db("select s.type_id,s.name,a.{$db_name}_ship_status as status from se_ship_types s, se_admin_ships a where s.type_id > 2 && a.ship_type_id = s.type_id && s.auction = 0");
while ($list_ships = dbr(1)) {
if ($list_ships['status'] == 1) {
$out .= "\n" . quick_row("{$list_ships['name']}", "<input type='checkbox' name='add_ship[{$list_ships['type_id']}]' value='{$list_ships['type_id']}' checked='checked' />");
} else {
$out .= "\n" . quick_row("{$list_ships['name']}", "<input type='checkbox' name='add_ship[{$list_ships['type_id']}]' value='{$list_ships['type_id']}' />");
}
示例6: elseif
continue;
} elseif (config_check("oo", $this_ship)) {
//trying to transfer a flagship
$loop_txt .= $st[742] . "<br />";
continue;
} elseif ($target_ship_count['warships'] >= $GAME_VARS['max_warships'] && $this_ship['is_warship'] == 1) {
$loop_txt .= "{$target['login_name']} {$st['743']}<br />";
continue;
} elseif ($target_ship_count['other_ships'] >= $GAME_VARS['max_other_ships'] && $this_ship['is_warship'] == 0) {
$loop_txt .= "{$target['login_name']} {$st['744']}<br />";
continue;
} elseif ($ship_id == $user_ship['ship_id']) {
$loop_txt .= $st[745];
} else {
$loop_txt .= "<b class='b1'>{$this_ship['ship_name']}</b> {$st['746']}<br />";
dbn("update {$db_name}_ships set login_id = '{$target['login_id']}', fleet_id = '1', clan_id = {$target['clan_id']}, metal=0, fuel=0, elect=0, colon=0 where ship_id = '{$ship_id}'");
//ensure don't go over the limit
if ($this_ship['is_warship'] == 1) {
$target_ship_count['warships']++;
} else {
$target_ship_count['other_ships']++;
}
$transfer_counter++;
}
}
$text .= sprintf($st[747], $transfer_counter, $num_ships) . "<p />" . $loop_txt;
if ($transfer_counter > 0) {
$total_cost = $cost_per_transfer * $transfer_counter;
$text .= "<p />{$st['7480']} {$total_cost} " . $cw['credits'];
take_cash($total_cost);
post_news("<b class='b1'>" . sprintf($st[748], $user[login_name], $transfer_counter, $target[login_name]), "ship");
示例7: elseif
if (!avail_check(4001)) {
$out .= $st[432];
} elseif ($user['turns'] < 1) {
$out .= $st[433];
} elseif ($amount <= 0) {
get_var('Take Colonists', $_SERVER['PHP_SELF'], "<a href='{$_SERVER['PHP_SELF']}?all_colon=1'>Fill Ship</a><p />Combien de colons voulez-vous acheter ?<br />Chaque colon coûte <b>{$GAME_VARS['cost_colonist']}</b> crédits.<p />", 'amount', $fill);
} elseif ($fill < 1) {
$out .= $st[1892] . "<p />";
} elseif ($amount > $user_ship['empty_bays']) {
$out .= "You can't carry that many colonists.<p />";
} elseif ($amount * $GAME_VARS['cost_colonist'] > $user['cash']) {
$out .= "You can't afford that many colonists.<p />";
} else {
take_cash($GAME_VARS['cost_colonist'] * $amount);
charge_turns(1);
dbn("update {$db_name}_ships set colon = colon + '{$amount}' where ship_id = '{$user['ship_id']}'");
$user_ship['colon'] += $amount;
$user_ship['empty_bays'] -= $amount;
}
//the ship shop. listing ships
} elseif (isset($_GET['ship_shop'])) {
$out .= $st[1800] . '<br /><br />';
$array_ships = array("Cargo" => "", "Bataille" => "", "Transport" => "", "Modulaires" => "", "Autres" => "");
$ship_types = load_ship_types(0);
foreach ($ship_types as $type_id => $ship_stats) {
if ($type_id < 3 || $ship_stats['tcost'] != 0) {
//skip the EP and SD, as well as BM ships.
continue;
} else {
$buy_many_link = "<a href='ship_build.php?mass={$type_id}'>" . $cw['buy_many'] . "</a>";
if ($ship_stats['type'] == "Cargo") {
示例8: setAutoLoginCookie
function setAutoLoginCookie($login_id, $login_name, $mdp)
{
if (isset($_POST['auto_login']) && $_POST['auto_login'] && !isset($_COOKIE['astravires_auto_login'])) {
dbn("update user_accounts set auto_login = 1 where login_id = {$login_id} limit 1");
$hash = md5($login_id . $login_name . $mdp) . '|' . $login_id;
$expire = time() + 7 * 24 * 60 * 60;
setcookie('astravires_auto_login', $hash, $expire);
} elseif (isset($_COOKIE['astravires_auto_login']) && isset($_POST['submit']) && !isset($_POST['auto_login'])) {
dbn("update user_accounts set auto_login = 0 where login_id = {$login_id} limit 1");
setcookie('astravires_auto_login', '', time() - 3600);
}
}
示例9: elseif
} elseif ($target_id == -5 && $clan_id > 0) {
send_message($target_id, $text, $clan_id);
$error_str = $cw['message_sent'] . ".";
//send message to central forum
} elseif ($target_id == -99 || $target_id == -50) {
if ($user['login_id'] == OWNER_ID) {
//server admin
$sender_name = "<b class=\"b1\">" . $p_user['login_name'] . "</b> (" . $cw['server_admin'] . ")";
} elseif ($user['login_id'] == 1) {
//admin
$sender_name = "<b class=\"b1\">" . $cw['admin'] . "</b> - ({$game_info['admin_name']} - {$game_info['name']})";
} else {
//regular player
$sender_name = "<b class=\"b1\">" . $p_user['login_name'] . "</b> - {$game_info['name']}";
}
dbn("insert into se_central_messages (timestamp, forum_id, sender_id, sender_name, text, game_id) values(" . time() . ", '{$target_id}', '{$user['login_id']}', '{$sender_name}', '" . mysql_escape_string(substr($text, 0, 5000)) . "', '{$game_info['game_id']}')");
$error_str = $st[911];
} else {
send_message($target_id, $text);
send_templated_email($target_id, 'message');
$error_str = $st[912];
}
if ($target_id == -1 || $target_id == -50) {
$error_str .= "<br /><br /><a href='forum.php?target_id={$target_id}'>" . $cw['back_forum'] . "</a>";
} elseif ($target_id == -2) {
$error_str .= "<br /><br /><a href='clan.php'>" . $st[913] . "</a>";
} elseif ($target_id == -5) {
$error_str .= "<br /><br /><a href='forum.php?target_id=-5&clan_id={$clan_id}'>" . $st[914] . "</a>";
} elseif ($target_id != -99) {
$error_str .= "<br /><br /><a href='mpage.php'>" . $st[915] . "</a>";
}
示例10: explore_sys
function explore_sys(&$user, $loc)
{
global $db_name, $game_info, $GAME_VARS, $cw, $st;
if ($user['explored_sys'] == -1 || $GAME_VARS['uv_explored'] == 1) {
//explored whole universe.
dbn("update {$db_name}_users set location = '{$loc}' where login_id = '{$user['login_id']}'");
return 0;
}
$exp_sys = explode(",", $user['explored_sys']);
//new system explored
if ($GAME_VARS['uv_explored'] == 0 && $loc > 1 && $loc <= $game_info['num_stars'] && array_search($loc, $exp_sys) === false) {
if (count($exp_sys) + 1 >= $game_info['num_stars']) {
//just finished exploring whole universe.
$user['explored_sys'] = -1;
} else {
$exp_sys[] = $loc;
$user['explored_sys'] = implode(",", $exp_sys);
}
dbn("update {$db_name}_users set explored_sys = '{$user['explored_sys']}', location = '{$loc}' where login_id = '{$user['login_id']}'");
} else {
//already explored
if (count($exp_sys) >= $game_info['num_stars']) {
}
dbn("update {$db_name}_users set location = '{$loc}' where login_id = '{$user['login_id']}'");
}
}
示例11: elseif
} elseif ($user['turns'] < 5) {
$error_str = $st[94];
} elseif (empty($planet_name)) {
get_var($st[95], 'planet_build.php', $st[96], 'planet_name', '');
} elseif (strlen($planet_name) < 3) {
$rs = "<p /><a href='javascript:history.back()'>" . $cw['try_again'] . "</a>";
print_page($cw['invalide_name'], $st[97]);
} else {
$planet_name = correct_name($planet_name);
if (!$planet_name || $planet_name == " " || $planet_name == "") {
$rs = "<p /><a href='javascript:history.back()'>" . $cw['try_again'] . "</a>";
print_page($cw['invalide_name'], $st[98]);
}
// remove gen device, but not from admin.
if ($user['login_id'] > 1) {
dbn("update {$db_name}_users set genesis = genesis - 1 where login_id = {$user['login_id']}");
}
charge_turns(5);
if ($user['clan_id']) {
$clan_id = $user['clan_id'];
} else {
$clan_id = -1;
}
// build the new planet
dbn("insert into {$db_name}_planets (planet_name,location,login_id,login_name,clan_id,planet_img, max_population) values ('{$planet_name}', '{$user['location']}', '{$user['login_id']}', '{$user['login_name']}', '{$clan_id}', '{$planet_img}', '{$max_pop}')");
$last_planet = mysql_insert_id();
dbn("update {$db_name}_stars set planetary_slots = planetary_slots - 1 where star_id = {$star['star_id']}");
post_news(sprintf($st[99], $user[login_name], $planet_name), $cw['planet']);
$error_str .= sprintf($st[100], $last_planet);
}
print_page($cw['planet_built'], $error_str);
示例12: take_tech
take_tech($terra_i_t);
$user['terra_imploder']++;
dbn("update {$db_name}_users set terra_imploder = terra_imploder + 1 where login_id = '{$user['login_id']}'");
}
} elseif ($buy == 9) {
//Advanced Engine Upgrade
if ($user_ship['move_turn_cost'] < 3) {
$error_str .= $st[414];
} elseif (config_check("e1", $user_ship)) {
$error_str .= $st[415];
} elseif (!isset($sure)) {
get_var($cw['purchase_advanced_engine_upgrade'], $filename, $st[416] . "<b class='b1'>{$user_ship['ship_name']}</b>?", 'sure', '');
} else {
$error_str .= make_standard_upgrade($cw['advanced_engine_upgrade'], "e2", $advanced_engine_c, 5003, $advanced_engine_t);
$user_ship['move_turn_cost'] = $user_ship['move_turn_cost'] - 2;
dbn("update {$db_name}_ships set move_turn_cost = move_turn_cost - 2 where ship_id = '{$user['ship_id']}'");
}
}
$error_str .= sprintf($st[417], $upgrade_pods[upgrade_slots]);
$error_str .= $st[418];
$error_str .= $st[419];
$error_str .= make_table(array($cw['item_name'], $cw['notes'], $cw['credits_cost'], $cw['tech_cost']), "75%");
if (avail_check(5000)) {
$buy_many = "";
$num = $max_pc - $user_ship['num_pc'];
if ($user_ship['upgrade_slots'] > 1 && $num > 1) {
$buy_many .= "<a href='{$filename}?buy=3&many_pc={$num}'>Acheter {$num}</a>";
}
$error_str .= make_row(array($cw['plasma_cannon'], sprintf($st[420], $max_pc), $plasma_cannon_c, $plasma_cannon_t, "<a href='{$filename}?buy=3'>" . $cw['buy'] . "</a>", $buy_many, popup_help("help.php?upgrades=1&popup=1&chosen=pc", 350, 315)));
}
if (avail_check(5002)) {
示例13: mysql_affected_rows
$final_str .= "\n<br />" . mysql_affected_rows() . " old rows from the user_history deleted...<br />";
//delete posts to the central forum that are older than 3 weeks.
dbn("delete from se_central_messages where timestamp < " . time() . "-1814400");
$final_str .= "\n<br />" . mysql_affected_rows() . " messages from the central forum were deleted...<br />";
print_time();
//backup the DB if requested. & delete old files
if ($make_database_backups == 1) {
backup_db();
print_time();
delete_old_backups($max_num_db_backups, "_db_backup");
print_time();
}
//build a new index of the stylesheets directory.
build_ss_index();
print_time();
dbn("update se_central_table set last_ran_s_maint = '" . time() . "'");
//print that maint was run, and how long it took.
$end_time = explode(" ", microtime());
$end_time = $end_time[1] + $end_time[0];
$total_time = $end_time - $maint_time;
$final_str .= "\n<p>... All done in {$total_time} seconds.<br />\n";
return 1;
/******************************* Functions *********************************/
//This function will create a backup of the entire database.
//it will try to compress the resulting file if it can.
function backup_db()
{
global $db_name, $final_str, $directories, $comp, $db_func_query;
set_time_limit(500);
//this could take time (get's done inside 1 sec on my comp, but servers arn't that dedicated. Plus they have more db entries. :)
//can compress the files.
示例14: foreach
***********/
foreach ($players_array as $player_id => $player) {
//think the player has lost EP, so wipe them out.
if ($player['ship_id'] == 1 && $player['location'] == 1 && $player['login_id'] > 4) {
wipe_player($player_id, $player['clan_id']);
}
}
//ships are now free to do as they will
if (!empty($disengage_sql)) {
$disengage_sql = preg_replace("/\\|\\| \$/", "", $disengage_sql);
dbn("update {$db_name}_ships set ship_engaged = 0 where " . $disengage_sql);
}
//planets are now free to do as they will as well
if (!empty($disengage_planets_sql)) {
$disengage_planets_sql = preg_replace("/\\|\\| \$/", "", $disengage_planets_sql);
dbn("update {$db_name}_planets set planet_engaged = 0 where " . $disengage_planets_sql);
}
charge_turns($total_attack_turn_cost);
} else {
//even simulations take turns to run!
charge_turns($simulate_attack_turn_cost);
}
/***************************
* Now leaving the attack system code.
****************************/
}
//end of fleet attacking 'if' - inner
}
//end of fleet attacking 'if' - outer
//print the page and be done with it.
print_page("Fleet Attacking", $tech_str);
示例15: dbn
dbn("delete from {$db_name}_clans where clan_id = {$clan['clan_id']}");
dbn("delete from {$db_name}_messages where clan_id = {$clan['clan_id']}");
post_news(sprintf($st[125], $clan[clan_name], $clan[sym_color], $clan[symbol]), "clan, player_status");
} elseif ($what_to_do == 2 && !$leader_id) {
$new_page = $st[126];
$new_page .= "<form action=retire.php method=POST name=retiring2>";
#$new_page .= "<input type=hidden name=what_to_do value='$what_to_do' />";
db2("select login_id,login_name from {$db_name}_users where clan_id = '{$clan['clan_id']}' && login_id != '{$clan['login_id']}'");
$new_page .= "<select name=leader_id>";
while ($member_name = dbr2(1)) {
$new_page .= "<option value={$member_name['login_id']}>{$member_name['login_name']}</option>";
}
$new_page .= "</select>";
while (list($var, $value) = each($HTTP_POST_VARS)) {
$new_page .= "<input type=hidden name={$var} value='{$value}' />";
}
$new_page .= "<p /><input type='submit' value='" . $cw['submit'] . "' /></form>";
print_page($st[127], $new_page);
} else {
dbn("update {$db_name}_clans set leader_id = {$leader_id} where clan_id = {$clan['clan_id']}");
}
}
}
if (empty($reason)) {
$reason = $cw['no_reason'];
}
retire_user($target);
post_news(sprintf($st[128], $target_info[login_name], $reason), "player_status");
insert_history($user['login_id'], sprintf($st[129], $target_info[login_name]));
insert_history($target_info['login_id'], $st[130]);
print_page($cw['retired'], sprintf($st[131], $target_info[login_name]));