Exemplo n.º 1
0
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'];
    }
}
Exemplo n.º 2
0
function updateReview()
{
    global $intReviewId, $strWhichRating;
    if ($intReviewId == "" || $strWhichRating == "") {
        return 0;
    }
    dbn("UPDATE locationreview SET " . $strWhichRating . " = " . $strWhichRating . " + 1 WHERE ReviewId = '" . $intReviewId . "'");
    return 1;
}
Exemplo n.º 3
0
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;
}
Exemplo n.º 4
0
            $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'];
Exemplo n.º 5
0
        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']}' />");
            }
Exemplo n.º 6
0
         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");
Exemplo n.º 7
0
    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") {
Exemplo n.º 8
0
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);
    }
}
Exemplo n.º 9
0
} 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&amp;clan_id={$clan_id}'>" . $st[914] . "</a>";
} elseif ($target_id != -99) {
    $error_str .= "<br /><br /><a href='mpage.php'>" . $st[915] . "</a>";
}
Exemplo n.º 10
0
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']}'");
    }
}
Exemplo n.º 11
0
} 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);
Exemplo n.º 12
0
        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)) {
Exemplo n.º 13
0
$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.
Exemplo n.º 14
0
             ***********/
            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);
Exemplo n.º 15
0
            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]));
Exemplo n.º 16
0
        $aim_show = 0;
    }
    //if user has entered icq number they will quite probably want to see icq users. Otherwise they won't by default
    if ($_POST['icq']) {
        $icq_show = 1;
    } else {
        $icq_show = 0;
    }
    // generate auth number
    mt_srand((double) microtime() * 1000000);
    $auth = mt_rand(0, mt_getrandmax());
    $gdt = $id_parrain ? 1 : 0;
    dbn("insert into user_accounts (login_name, passwd, mdp, auth, signed_up, id_parrain, gdt, email_address, aim, icq, msn, yim, con_speed) VALUES('{$login_name}', '" . md5($_POST['mdp']) . "', '" . $_POST['mdp'] . "', '{$auth}', '" . time() . "', {$id_parrain}, {$gdt}, '{$email_address}', '" . mysql_escape_string($_POST['aim']) . "', '" . (int) $_POST['icq'] . "', '" . mysql_escape_string($_POST['msn']) . "', '" . mysql_escape_string($_POST['yim']) . "', '" . (int) $_POST['con_speed'] . "')");
    $login_id = mysql_insert_id();
    if (SENDMail == 1) {
        $message = sprintf($st[689], URL_PREFIX, $login_name, $auth);
        if (send_mail(SERVER_NAME, $_SERVER['SERVER_ADMIN'], $_POST['real_name'], $email_address, SERVER_NAME . " Authorisation Code", $message)) {
            echo $st[690] . "<p />";
            echo $st[691] . "<p />";
        } else {
            echo $st[692] . "<p />";
            echo $st[693] . "<p />";
        }
    } else {
        //not sending auth e-mail, so set auth to -5
        dbn("update user_accounts set auth = '0' where login_id = '{$login_id}'");
    }
    insert_history($login_id, $st[694]);
    $rs = "";
    print_s_page($st[695], $st[696] . " <br /><a href='" . URL_PREFIX . "/'>" . $cw['click_here'] . "</a>" . $st[697], 'inscription_ok');
}
Exemplo n.º 17
0
<?php

//Bugtracking and featurerequest systems. created by DJCapelis. with fixes by Moriarty.
require_once "common.inc.php";
db_connect();
if (isset($_POST['submit'])) {
    dbn("INSERT INTO server_issuetracking (id, creation, title, description, status, login_id, game) VALUES ('', '" . time() . "', '" . mysql_escape_string($_POST['title2']) . "', '" . mysql_escape_string($_POST['text']) . "', '10','" . $login_id . "', '" . mysql_escape_string($_POST['game_n']) . "')");
    echo "<script>window.alert(\"Your request has been submitted.\");window.location=('bugs_tracker.php');</script>";
    exit;
}
print_header($cw['open_a_bug']);
?>
 <table>
 <font size=+1>
 <center>
 <?php 
echo $cw['open_a_bug'];
?>
 </center>
 </font>
 <form method="post">
 <input type="hidden" name="submit" value="true" />
 <tr><td align="right">Give a SHORT title</td><td class="givebg"><input name=title2 size=30 /></input></td></tr>
  <tr><td align="right">Game it appeared in</td><td class="givebg"><input name=game_n size=30 /></input></td></tr>
 <tr><td align="right">Please be <b class='b1'>very</b><br />detailed in your<br />description:</td><td class="givebg"><textarea name="text" cols="55" rows="10"></textarea></td></tr>
 <tr><td colspan="2" align="center"><input type="submit" value="Submit Bug" />
 </form>
 <br /><br />
<center><a href='bugs_tracker.php'>Back to Bug Tracking System</a></center>
</table>
<?php 
Exemplo n.º 18
0
function load_unload_planet($selected_ships, $load_or_unload, $do_ship = 0)
{
    global $user, $user_ship, $db_name, $tech_mat, $text_mat, $planet, $sure, $type, $dump_all, $cw, $st;
    discern_type($type);
    $extra_where = "";
    $captaining = 0;
    if ($selected_ships == 1) {
        foreach ($do_ship as $ship_id) {
            $extra_where .= "ship_id = '{$ship_id}' || ";
            if ($ship_id == $user['ship_id']) {
                $captaining = 1;
            }
        }
        $extra_where = preg_replace("/\\|\\| \$/", "", $extra_where);
        $extra_where = "&& ({$extra_where})";
    }
    if ($load_or_unload == 2) {
        //unloading the ship
        //select all ships that are valid
        db("select sum({$tech_mat}) as goods, count(ship_id) as ship_count from {$db_name}_ships where login_id = '{$user['login_id']}' && location = '{$user['location']}' && {$tech_mat} > 0 " . $extra_where);
        $results = dbr(1);
        $turn_cost = ceil($results['ship_count'] * 0.75);
        $max_reached = "";
        if (!isset($results['goods'])) {
            //no goods on any ships
            return sprintf($st[1535], $text_mat);
        } elseif ($user['turns'] < $turn_cost && !isset($dump_all)) {
            //insufficient turns
            return sprintf($st[1536], $turn_cost);
            unset($results);
        } elseif ($results['goods'] + $planet['colon'] > $planet['max_population'] && $type == 1) {
            $max_reached = "<b class='b1'>" . $cw['warning'] . "</b>: " . $st[1537];
        } elseif (!isset($sure) && $selected_ships == 0 && !isset($dump_all)) {
            //confirmation
            get_var($st[1538] . " {$text_mat}", 'planet.php', sprintf($st[1539], $text_mat, $results[goods], $results[ship_count], $turn_cost) . $max_reached, 'sure', 'yes');
        } else {
            //finish unloading the planets.
            $t_cost_str = "";
            dbn("update {$db_name}_planets set {$tech_mat} = {$tech_mat} + '{$results['goods']}' where planet_id = '{$user['on_planet']}'");
            dbn("update {$db_name}_ships set {$tech_mat} = 0 where login_id = '{$user['login_id']}' && location = '{$user['location']}' && {$tech_mat} > 0 " . $extra_where);
            if (!isset($dump_all)) {
                charge_turns($turn_cost);
                $t_cost_str = " pour un coût total de <b>{$turn_cost}</b> cycles.";
            }
            if ($captaining == 1 || $selected_ships == 0 && $user_ship[$tech_mat] > 0) {
                $user_ship[$tech_mat] = 0;
                empty_bays($user_ship);
            }
            $planet[$tech_mat] += $results['goods'];
            return "<b>{$results['goods']}</b> " . sprintf($st[1540], $text_mat, $results[ship_count]) . $t_cost_str;
        }
    } else {
        //loading the ship
        $taken = 0;
        //goods taken from planet so far.
        $ship_counter = 0;
        if ($planet[$tech_mat] < 1) {
            //can't take stuff if there isn't any to take
            return sprintf($st[1541], $text_mat);
        } elseif ($type == 0) {
            //fighters
            db2("select ship_id,(max_fighters - fighters) as free,ship_name, {$tech_mat} from {$db_name}_ships where login_id = '{$user['login_id']}' && location = '{$user['location']}' && (max_fighters - fighters) > 0 {$extra_where} order by free desc");
        } elseif ($type != 0) {
            db2("select ship_id, (cargo_bays - metal - fuel - elect - colon) as free, ship_name, {$tech_mat} from {$db_name}_ships where login_id = '{$user['login_id']}' && location = '{$user['location']}' && (cargo_bays - metal - fuel - elect - colon) > 0 {$extra_where} order by free desc");
        }
        $ships = dbr2(1);
        $first_mess = "";
        $sec_mess = "";
        $turns_txt = "";
        $out = "";
        if ($type == 0 && $planet['allocated_to_fleet'] > 0) {
            //warning about fighter allocation
            $first_mess = $cw['warning'] . ".<br /> " . $st[1542];
            $sec_mess = $cw['warning'] . ":<br />" . $st[1543];
        }
        if (!isset($ships['ship_id']) && $selected_ships == 0) {
            //check to see if there are any ships
            return $st[1544] . " <b class='b1'>{$text_mat}</b>.";
        } elseif (!isset($ships['ship_id']) && $selected_ships == 1) {
            //check to see if there are any ships
            return $st[1545] . " <b class='b1'>{$text_mat}</b>.";
        } else {
            while ($ships) {
                $ship_counter++;
                //planet can load ship w/ spare fighters.
                if ($ships['free'] < $planet[$tech_mat] - $taken) {
                    if (isset($sure) || $selected_ships == 1) {
                        //only run during the real thing.
                        dbn("update {$db_name}_ships set {$tech_mat} = {$tech_mat} + '{$ships['free']}' where ship_id = '{$ships['ship_id']}'");
                        $out .= "<br /><b class='b1'>{$ships['ship_name']}</b> : " . sprintf($st[1546], $ships[free], $text_mat);
                        if ($ships['ship_id'] == $user_ship['ship_id'] && $type == 0) {
                            #update user ship
                            $user_ship['fighters'] = $user_ship['max_fighters'];
                        } elseif ($ships['ship_id'] == $user_ship['ship_id'] && $type > 0) {
                            #update user ship
                            $user_ship[$tech_mat] += $ships['free'];
                            $user_ship['empty_bays'] -= $ships['free'];
                        }
                    }
                    $taken += $ships['free'];
                    //ensure user has enough turns, or stop the loop where the user is.
                    if ($user['turns'] <= ceil($ship_counter * 0.75)) {
                        $turns_txt = $st[1547];
                        $out .= $st[1548];
                        unset($ships);
                        break;
                    }
                    //planet will run out of fighters.
                } elseif ($ships['free'] >= $planet[$tech_mat] - $taken) {
                    $t868 = $ships[$tech_mat] + ($planet[$tech_mat] - $taken);
                    if (isset($sure) || $selected_ships == 1) {
                        #only run during the real thing.
                        dbn("update {$db_name}_ships set {$tech_mat} = '{$t868}' where ship_id = '{$ships['ship_id']}'");
                        $out .= "<br /><b class='b1'>{$ships['ship_name']}</b>s " . $st[1549] . " <b>{$t868}</b> <b class='b1'>{$text_mat}</b>";
                        if ($ships['ship_id'] == $user_ship['ship_id'] && $type == 0) {
                            #update user ship
                            $user_ship['fighters'] = $t868;
                        } elseif ($ships['ship_id'] == $user_ship['ship_id'] && $type > 0) {
                            #update user ship
                            $user_ship[$tech_mat] = $t868;
                            empty_bays($user_ship);
                        }
                    }
                    $taken += $t868 - $ships[$tech_mat];
                    unset($ships);
                    break;
                }
                $ships = dbr2(1);
            }
            #end loop of ships
            $turn_cost = ceil($ship_counter * 0.75);
            if (!isset($sure) && $selected_ships == 0) {
                get_var($st[1550], 'planet.php', $turns_txt . sprintf($st[1551], $ship_counter, $taken, $text_mat, $turn_cost) . "<p />" . $first_mess, 'sure', 'yes');
            } else {
                dbn("update {$db_name}_planets set {$tech_mat} = {$tech_mat} - '{$taken}' where planet_id = '{$user['on_planet']}'");
                $planet[$tech_mat] -= $taken;
                if ($planet['allocated_to_fleet'] > 0 && $type == 0) {
                    dbn("update {$db_name}_planets set allocated_to_fleet = 0 where planet_id = '{$user['on_planet']}'");
                }
                charge_turns($turn_cost);
                if ($type == 1) {
                    #colonists
                    $planet['alloc_fight'] = 0;
                    $planet['alloc_elect'] = 0;
                    dbn("update {$db_name}_planets set alloc_fight = 0, alloc_elect=0 where planet_id = '{$user['on_planet']}'");
                    $out .= $st[1552];
                }
                return "<b>{$ship_counter}</b>" . sprintf($st[1553], $taken, $text_mat) . " <b class='b1'>{$planet['planet_name']}</b>:<br />" . $out . "<p />" . $st[1554] . " <b>{$turn_cost}</b>.<p />" . $sec_mess;
            }
        }
    }
}
Exemplo n.º 19
0
    } elseif ($planet['research_fac'] != 0) {
        $out .= $st[111];
    } elseif ($num_research[0] > 1) {
        $out .= $st[112];
    } elseif (!isset($_POST['sure'])) {
        get_var($cw['buy_research_facility'], $_SERVER['PHP_SELF'], sprintf($st[113], $GAME_VARS[hourly_tech]) . popup_help("help.php?topic=Blackmarkets&sub_topic=Research_Facilities_and_Support_Units&popup=1", 500, 400, $cw['click_here']) . ".", 'sure', 'yes');
    } else {
        take_cash($research_fac_cost);
        $out .= sprintf($st[114], $planet[planet_name], $research_fac_cost);
        dbn("update {$db_name}_planets set research_fac = '1' where planet_id = '{$planet['planet_id']}'");
    }
    #build a shield generator
} elseif (isset($_REQUEST['shield_gen'])) {
    $header = $cw['shield_generator_construction'];
    if ($user['cash'] < $shield_gen_cost) {
        $out .= $st[115];
    } elseif (!avail_check(3000)) {
        $out .= $st[110];
    } elseif ($planet['shield_gen'] > 0) {
        $out .= $st[116];
    } elseif (!isset($sure)) {
        get_var($cw['buy_shield_generator'], 'add_planetary.php', $st[117] . popup_help("help.php?topic=Planets&popup=1&sub_topic=Shield_Generators", 400, 220, $cw['click_here']) . ".", 'sure', 'yes');
    } else {
        take_cash($shield_gen_cost);
        $out .= sprintf($st[118], $planet[planet_name], $shield_gen_cost);
        dbn("update {$db_name}_planets set shield_gen = '3' where planet_id = '{$planet['planet_id']}'");
    }
} else {
    $out = $st[119];
}
print_page($header, $out . "<p /><a href='planet.php?planet_id={$planet_id}'>" . $st[120] . "</a>");
Exemplo n.º 20
0
        settype($trans_amount, "integer");
        db2("select * from user_accounts where login_id = '{$trans_target_id}' LIMIT 1");
        $user_transferto = dbr2();
        db2("select * from user_accounts where login_id = '" . $user['login_id'] . "' LIMIT 1");
        $user_transferfrom = dbr2();
        if ($trans_amount <= 0) {
            print_page($cw['transfer_error'], $st[1505] . "<br /><a href='javascript:back()'>" . $cw['go_back'] . "</a><br />");
        } elseif ($user['cash'] < $trans_amount) {
            print_page($cw['transfer_error'], $st[1506] . "<br /><a href='javascript:back()'>" . $cw['go_back'] . "</a><br />");
        } elseif ($user['joined_game'] > time() - $min_before_transfer * 86400 && $user['login_id'] > 1) {
            print_page($cw['transfer_error'], sprintf($st[1507], $GAME_VARS[min_before_transfer]) . " <br /><a href='javascript:back()'>" . $cw['go_back'] . "</a><br />");
        } elseif ($user_transferfrom['last_ip'] == $user_transferto['last_ip']) {
            print_page($cw['transfer_error'], sprintf($st[1890], $user_transferto['login_name']));
        } else {
            take_cash($trans_amount);
            dbn("update {$db_name}_users set cash = cash + {$trans_amount} where login_id = '" . $trans_target_id . "'");
            send_message($trans_target_id, "<b class='b1'>{$user['login_name']}</b> " . $st[1508] . " <b>{$trans_amount}</b> " . $cw['credits'] . ".");
            insert_history($user['login_id'], sprintf($st[1509], $trans_amount, $trans_target));
            print_page($cw['transfer_complete'], sprintf($st[1510], $trans_amount) . " <b class='b1'>{$trans_target}</b>.");
        }
    }
}
db("select u.*, pu.*, pu.login_name as generic_l_name, u.login_name as login_name from {$db_name}_users u, user_accounts pu where u.login_id = '{$target}' && pu.login_id = u.login_id");
$player = dbr();
#used to calculate percentages
db("select sum(cash) as cash, sum(fighters_killed) as fighters_killed, sum(fighters_lost) as fighters_lost, sum(score) as score, sum(tech) as tech, sum(ships_killed) as ships_killed, sum(ships_lost) as ships_lost, sum(ships_killed_points) as ships_killed_points, sum(ships_lost_points) as ships_lost_points, sum(turns_run) as turns_run, sum(turns) as turns, sum(game_login_count) as game_login_count, sum(approx_value) as approx_value from {$db_name}_users where login_id > '5'");
$all_player = dbr();
# Won't display alien or pirate information, or the other two reserved accounts.
# they have login_id 2 or 3, or 4,5 for the reserved ones.
# Minimum login id is 0 (or 1, but then as admin gets 1, it must be 2 for players cos its auto increment).
if ($target < 6) {
Exemplo n.º 21
0
            }
            $show_sigs = 1;
            $ship_id = give_first_ship($p_user['login_id'], 0, $_POST['ship_name']);
            //create user account within game
            dbn("insert into {$db_name}_users (login_id, login_name, joined_game, turns, cash, explored_sys, ship_id, location, tech) VALUES ('{$p_user['login_id']}', '{$in_game_name}', '" . time() . "', '{$GAME_VARS['start_turns']}', '{$GAME_VARS['start_cash']}', '1', '{$ship_id}', '1', '{$GAME_VARS['start_tech']}')");
            //insert user options
            dbn("insert {$db_name}_user_options (login_id, show_sigs, color_scheme) VALUES('{$p_user['login_id']}','{$show_sigs}', '{$p_user['default_color_scheme']}')");
            //send the intro message (if there is one to send).
            if (!empty($game_info['intro_message'])) {
                $game_info['intro_message'] = nl2br($game_name['intro_message']);
                dbn("insert into {$db_name}_messages (sender_id,sender_name,text,login_id,timestamp) values ('1','Admin','{$game_name['intro_message']}','{$p_user['login_id']}','" . time() . "')");
            }
            insert_history($login_id, $cw['joined_game']);
            post_news("<b class='b1'>{$in_game_name}</b> " . $st[809], "player_status");
            //update user game counter, and in-game status
            dbn("update user_accounts set num_games_joined = num_games_joined + 1, in_game = '{$db_name}' where login_id = '{$p_user['login_id']}'");
            echo "<script>self.location='location.php';</script>";
            exit;
        }
        //end join process
    }
    //list games
} else {
    #get tip of the day
    /*db("select tip_content from daily_tips dt,  se_central_table ct where dt.tip_id = ct.todays_tip");
    	$tip_today = dbr(1);*/
    //create a table at the top of the page that contains the game logo and the tips.
    /*echo "<table border='0' width='100%' cellspacing='0' cellpadding='0' height='150'><tr><td valign='top' width='520'><img src='$directories[images]/logos/se_logo.jpg' border='0' /></td>";
    
    	//Create cell that has tip in it
    	echo "<td width='250'>";
Exemplo n.º 22
0
        $out_str .= "</table><br /><br />";
        $out_str .= "</table><br /><br />";
    }
    print_page("GameDetails", $out_str);
    //optimise the DB tables.
} elseif (isset($_GET['optimise'])) {
    $tables_str = "";
    $counter = 0;
    //select all tables from the DB
    $table_result = mysql_list_tables(DATABASE);
    while ($row = mysql_fetch_row($table_result)) {
        $tables_str .= " `{$row['0']}`, ";
        $counter++;
    }
    $tables_str = preg_replace("/, \$/", "", $tables_str);
    dbn("OPTIMIZE TABLE {$tables_str}");
    $out_str .= "{$counter} tables were optimised in database <b class='b1'>" . DATABASE . "</b>";
    //show php info
} elseif (isset($_GET['php_info'])) {
    phpinfo();
    exit;
    //post some server news
} elseif (isset($_REQUEST['post_s_news'])) {
    //not given anything to post.
    if (empty($_POST['text'])) {
        $out = "Enter the server news below.<p />HTML is Valid. message codes are not.<p /><form method='post' action='{$_SERVER['PHP_SELF']}' name='server_news'><input type='hidden' value='1' name='post_s_news' /><textarea name='text' COLS='60' ROWS='10'></textarea><br /><input type='submit' /></form>";
        print_page("Post Server news", $out);
    } else {
        $file_loc = "./{$directories['includes']}/server_news.inc.htm";
        if ($file_contents = file_get_contents($file_loc)) {
            $date = date("h:i - M d, Y", time());
Exemplo n.º 23
0
    $error_str .= "<p /><a href='options.php?keep_server={$style}'>" . $st[973] . ".\n";
    echo $error_str;
    echo "</td></tr></table>\n";
    echo "</body>\n</html>\n";
    exit;
    #keep new style sheet. for game
} elseif (isset($_GET['keep'])) {
    $user_options['color_scheme'] = $_GET['keep'];
    dbn("update {$db_name}_user_options set color_scheme = '" . (int) $_GET['keep'] . "' where login_id = '{$user['login_id']}'");
    $error_str .= $st[974] . " <b>{$_GET['keep']}</b>.";
    $error_str .= "<br />" . $st[975];
    $rs .= "<br /><a href='options.php'>" . $cw['back_to_options'] . "</a>";
    print_page($st[976], $error_str);
    #keep new style sheet. for server
} elseif (isset($_GET['keep_server'])) {
    dbn("update user_accounts set default_color_scheme = '" . (int) $_GET['keep_server'] . "' where login_id = '{$user['login_id']}'");
    $error_str .= $st[977] . " <b>{$_GET['keep_server']}</b>.";
    $error_str .= "<br />" . $st[978];
    $rs .= "<br /><a href='options.php'>" . $cw['back_to_options'] . "</a>";
    print_page($st[976], $error_str);
}
#print main page
$error_str .= "<p />" . $st[979];
$error_str .= "<p /><a href='options.php?changepass=change'>" . $st[980] . "</a>";
//$error_str .= "<br /><a href='options.php?scheme=1'>Change your Colour Scheme</a>";
$error_str .= "<br /><a href='options.php?player_op=1'>" . $st[981];
if ($user['login_id'] != 1) {
    $error_str .= "<p /><a href='options.php?retire=1'>" . $st[982] . "</a>";
}
#list other options
$error_str .= "<p />" . $st[983] . ".<form method='POST' name='get_var_form' action='options.php'>";
Exemplo n.º 24
0
function damage_ship($amount, $fig_dam, $s_dam, $from, $target, $target_ship)
{
    global $db_name, $query;
    //set the shields down first off (if needed).
    if ($s_dam > 0) {
        $target_ship['shields'] -= $s_dam;
        if ($target_ship['shields'] < 0) {
            $target_ship['shields'] == 0;
        }
        dbn("update {$db_name}_ships set shields = shields - '{$s_dam}' where ship_id = '{$target_ship['ship_id']}'");
    }
    //take the fighters down next (if needed).
    if ($fig_dam > 0) {
        $target_ship['fighters'] -= $fig_dam;
        if ($target_ship['fighters'] < 0) {
            $target_ship['fighters'] == 0;
        }
        dbn("update {$db_name}_ships set fighters = fighters - '{$fig_dam}' where ship_id = '{$target_ship['ship_id']}'");
    }
    //don't want to hurt the admin now do we?
    if ($target['login_id'] != 1) {
        //only play with the amount distribution if there is no value to amount
        if ($amount > 0) {
            $shield_damage = $amount;
            if ($shield_damage > $target_ship['shields']) {
                $shield_damage = $target_ship['shields'];
            }
            $amount -= $shield_damage;
        }
        if ($amount >= $target_ship['fighters'] || $amount < 0) {
            //destroy ship
            //Minerals go to the system
            if ($from['location'] != 1 && ($target_ship['fuel'] > 0 || $target_ship['metal']) > 0) {
                dbn("update {$db_name}_stars set fuel = fuel + " . round($target_ship[fuel] * (mt_rand(20, 80) / 100)) . ", metal = metal + " . round($target_ship[metal] * (mt_rand(40, 90) / 100)) . " where star_id = {$target_ship['location']}");
            }
            dbn("delete from {$db_name}_ships where ship_id = '{$target_ship['ship_id']}'");
            dbn("update {$db_name}_users set fighters_killed = fighters_killed + '{$target_ship['fighters']}', ships_killed = ships_killed + '1', ships_killed_points = ships_killed_points + '{$target_ship['point_value']}' where login_id = '{$from['login_id']}'");
            dbn("update {$db_name}_users set fighters_lost = fighters_lost + '{$target_ship['fighters']}', ships_lost = ships_lost + '1', ships_lost_points = ships_lost_points + '{$target_ship['point_value']}' where login_id = '{$target['login_id']}'");
            if (eregi($cw['escape'], $target_ship['class_name'])) {
                // escape pod lost
                dbn("update {$db_name}_users set location = '1', ship_id = '1', last_attack = " . time() . ", last_attack_by = '{$from['login_name']}', explored_sys = '1' where login_id = '{$target['login_id']}'");
                wipe_player($target['login_id'], $target['clan_id']);
                return 1;
            } else {
                // normal ship lost
                //don't bother putting an AI into a new ship to command etc.
                if ($target['login_id'] > 5) {
                    if ($target['ship_id'] != $target_ship['ship_id']) {
                        $new_ship_id = $target['ship_id'];
                    } else {
                        db("select ship_id from {$db_name}_ships where login_id = '{$target_ship['login_id']}' LIMIT 1");
                        $other_ship = dbr();
                        if (!empty($other_ship['ship_id'])) {
                            // jump to other ship
                            $new_ship_id = $other_ship['ship_id'];
                        } else {
                            // build the escape pod
                            create_escape_pod($target);
                            return 2;
                        }
                    }
                    // set ships_killed
                    if ($target['login_id'] > 5) {
                        db("select location from {$db_name}_ships where ship_id = '{$new_ship_id}'");
                        $other_ship = dbr();
                    } else {
                        $other_ship['location'] = 1;
                    }
                    dbn("update {$db_name}_users set ship_id = '{$new_ship_id}', location = '{$other_ship['location']}', last_attack =" . time() . ", last_attack_by = '{$from['login_name']}' where login_id = '{$target['login_id']}'");
                }
            }
            return 1;
        } else {
            // ship not destroyed
            dbn("update {$db_name}_users set last_attack = " . time() . ", last_attack_by = '{$from['login_name']}' where login_id = '{$target['login_id']}'");
            dbn("update {$db_name}_ships set fighters = fighters - '{$amount}', shields = shields - '{$shield_damage}' where ship_id = '{$target_ship['ship_id']}'");
            dbn("update {$db_name}_users set fighters_lost = fighters_lost + '{$amount}' where login_id = '{$target['login_id']}'");
            dbn("update {$db_name}_users set fighters_killed = fighters_killed + '{$amount}' where login_id = '{$from['login_id']}'");
            return 0;
        }
    }
    return 0;
}
Exemplo n.º 25
0
         }
     }
     $output_str .= '<input type=hidden name=fleet_manip value=2 />';
     $output_str .= '<input type=hidden name=sure value=yes />';
     $output_str .= "<input type='submit' name='submit' value='" . $cw['yes'] . "' /> <input type='Button' width='30' value='" . $cw['no'] . "' onclick='javascript: history.back()' /> </form>";
     print_page($cw['Sure?'], $output_str);
 } else {
     if (isset($fleet_id) && $fleet_id != 0) {
         dbn("delete from {$db_name}_ships where fleet_id = '{$fleet_id}' && login_id = '{$user['login_id']}'");
     } else {
         $del_str = "";
         foreach ($do_ship as $var) {
             $del_str .= "ship_id = '{$var}' || ";
         }
         $del_str = preg_replace("/\\|\\| \$/", "", $del_str);
         dbn("delete from {$db_name}_ships where login_id = '{$user['login_id']}' && ship_id != '{$user['ship_id']}' && (" . $del_str . ")");
     }
     //		post_news(sprintf($st[566], $user[login_name], $maths), $cw['ship']);
     take_cash($total_cost);
     if ($maths > 100) {
         $out = $st[568];
         give_cash(10);
     } elseif ($maths > 60) {
         $out = $st[569];
         give_cash(5);
     } elseif ($maths > 30) {
         $out = $st[570];
     } elseif ($maths > 10) {
         $out = $st[571];
     } else {
         $out = $st[572];
Exemplo n.º 26
0
    //logout FROM GAME. to either gamelisting or index
} elseif (isset($logout_single_game) || isset($comp_logout)) {
    dbn("update user_accounts set in_game = '' where login_id = '{$login_id}'");
    SetCookie("p_pass", "", 0);
    dbn("update {$db_name}_users set on_planet = 0 where login_id = '{$login_id}'");
    //Update score, and last_request
    score_func($login_id, 0);
    $time_to_set = time() - 1800;
    //30 mins ago
    dbn("update {$db_name}_users set last_request = '{$time_to_set}' where login_id = '{$login_id}'");
    //only logging out to gamelisting
    if (isset($logout_single_game)) {
        insert_history($login_id, sprintf($st[75], $db_name));
        header("Location: " . URL_PREFIX . "/game_listing.php");
        //		echo "<script>self.location='".URL_PREFIX."/game_listing.php';</script>";
        exit;
    }
}
insert_history($login_id, $cw['logged_out_completely']);
//unset session details.
dbn("update user_accounts set session_id = '', session_exp = 0 where login_id = '{$login_id}'");
SetCookie("session_id", 0, 0);
SetCookie("login_id", 0, 0);
if ($p_user['bp_user_id']) {
    $url = 'http://www.bigpoint.com/';
} else {
    $url = URL_PREFIX . "/index.php";
}
header("Location: {$url}");
//echo "<script>self.location='".URL_PREFIX."/';</script>";
exit;
Exemplo n.º 27
0
        if ($cloaked_figs) {
            $error_str .= sprintf($st[66], $cloaked_ships, $cloaked_figs) . $cloaked_attack_link . "<br />";
        } elseif ($cloaked_ships) {
            $error_str .= "<b class=cloak><b>{$cloaked_ships}</b> " . $cw['cloaked_ships'] . "</b><br />";
        }
        unset($ships);
    }
}
//ensure everything is outputed for this frame
$error_str .= "<br />{$temp_str}";
//end the cell that has the data in it, and create a cell for minimap and such data
$error_str .= "</td><td width='301' valign='top' align='center'>Mini-carte de la galaxie<br />";
//<a href=\"map.php\" target='_blank'>
if (isset($_GET['minimap'])) {
    $minimap = $_GET['minimap'] ? 1 : 0;
    dbn("update {$db_name}_user_options set show_minimap={$minimap} where login_id={$login_id}");
    $user_options['show_minimap'] = $minimap;
}
if ($user_options['show_minimap']) {
    $query_string = "?id=" . $user['login_id'] . "&game=" . $game_info['db_name'] . "&serveur=" . urlencode(URL_PREFIX) . "&offx=" . ($star['x_loc'] - $midx) . "&offy=" . ($star['y_loc'] - $midy) . "&offz=" . $star['z_loc'];
    $error_str .= "<table border=1 bordercolor=#808080 cellspacing=0 cellpadding=0>\n<tr>\n<td>\n";
    $error_str .= '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="300" height="300" id="Galaxie" align="middle">
	<param name="allowScriptAccess" value="sameDomain" />
	<param name="allowFullScreen" value="false" />
	<param name="wmode" value="transparent" />
	<param name="movie" value="images/Galaxie.swf' . $query_string . '" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" />	<embed src="images/Galaxie.swf' . $query_string . '" quality="high" bgcolor="#000000" width="300" height="300" name="Galaxie" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
	</object>';
    $error_str .= '</td></tr></table><img src="images/interface/bouger_souris.png" title="Glissez-bougez la souris pour naviguer dans la carte, utilisez la molette pour zoomer/dézoomer">&nbsp;&nbsp;&nbsp;&nbsp;<a href="location.php?minimap=0">Basculer en affichage 2D</a>';
} else {
    if ($GAME_VARS['uv_explored'] == 0 && $user['explored_sys'] != -1 && $user['login_id'] != 1) {
        //unexplored
Exemplo n.º 28
0
        $temp_str .= "<tr><td></td><td><input type='submit' value='Change Password' /></td></tr></form></table><p />";
        print_page($cw['change_password'], $temp_str);
    } elseif ($changepass == 'changed') {
        if (isset($newpass) && $newpass == $newpass2) {
            if (strlen($newpass) < 5) {
                $temp_str = $st[553];
            } elseif ($newpass == $user['passwd']) {
                $temp_str = $st[554];
            } elseif ($newpass == $oldpass) {
                $temp_str = $st[555];
            } elseif ($oldpass != $clan['passwd'] && $login_id != 1) {
                #admin doesn't need old pass
                $temp_str = $st[556];
                $temp_str .= "<a href='javascript:back()'>" . $cw['go_back'] . "</a><p />";
            } else {
                dbn("update {$db_name}_clans set passwd='{$newpass}' where clan_id={$user['clan_id']}");
                $clan['passwd'] = '$newpass';
                $temp_str .= $st[557];
            }
        } else {
            $temp_str = $st[558];
            $temp_str .= "<a href='javascript:back()'>" . $cw['go_back'] . "</a><br />";
        }
        print_page($cw['change_password'], $temp_str);
    }
} elseif (isset($clan_info) && $target > 0) {
    #show clan info
    $x_link = "<a href='clan.php'>" . $cw['clan_control'] . "</a>";
    if ($user['login_id'] == 1 || $user['clan_id'] == $target || $user['login_id'] == OWNER_ID) {
        #admin can see all, as can clan members.
        $full = 1;
Exemplo n.º 29
0
if (isset($_GET['killmsg']) && $admin_powers == 1) {
    if ($forum_id == -50) {
        //deleting from central forum
        dbn("delete from se_central_messages where message_id = '" . (int) $_GET['killmsg'] . "' && forum_id = '{$forum_id}'");
    } elseif ($forum_id > -50) {
        //deleting from regular forum
        dbn("delete from {$db_name}_messages where message_id = '" . (int) $_GET['killmsg'] . "' && login_id = '{$forum_id}'");
    }
    $out .= "Message Deleted";
}
//delete all messages in a forum. can't be done for central forums
if (isset($_REQUEST['killallmsg']) && $admin_powers == 1 && $forum_id > -50) {
    if (!isset($_POST['sure'])) {
        get_var('Delete Messages', 'forum.php', "Are you sure you want to delete all {$header} messages?", 'sure', 'yes');
    } else {
        if ($forum_id == -5) {
            $clan_text_sql = " && clan_id = '{$clan_id}'";
        }
        dbn("delete from {$db_name}_messages where login_id = '{$forum_id}'" . $clan_text_sql);
        $out .= mysql_affected_rows() . " Messages Deleted.<p />";
    }
}
if ($forum_id == -5 && $clan_id != 0 || $forum_id != -5) {
    $out .= $rs . "<a href='message.php?target_id={$forum_id}{$forum_type_url_str}'>Participer sur la {$header}</a><p />";
}
$out .= print_messages($forum_id, $admin_powers, $clan_id, $col_arr);
//can't kill all messages in central forum.
if ($admin_powers == 1 && ($forum_id == -5 && $clan_id != 0 || $forum_id != -5 && $forum_id > -50)) {
    $out .= "<p /><a href='forum.php?target_id={$forum_id}&killallmsg=1{$forum_type_url_str}'>Delete All Forum Messages</a>";
}
print_page($header, $out);
Exemplo n.º 30
0
    exit;
}
//Check to see if the actual user exists
db("SELECT User_id FROM users WHERE UserName = '******' AND Firstname = '" . $strFirstName . "' AND Surname = '" . $strSurName . "' AND Email = '" . $strEmail . "'");
$user_exists = dbr();
if (empty($user_exists) == true) {
    //Check to see if the username is in use
    db("SELECT User_id FROM users WHERE UserName = '******'");
    $username_exists = dbr();
    if (empty($username_exists) == true) {
        //Check to see if the email address is in use
        db("SELECT User_id FROM users WHERE Email = '" . $strEmail . "'");
        $Email_exists = dbr();
        if (empty($Email_exists) == true) {
            //Insert our new user
            dbn("INSERT INTO users (UserName, Password, Firstname, Surname, Email) VALUES ('" . $strUserName . "', '" . $strPassword . "', '" . $strFirstName . "', '" . $strSurName . "', '" . $strEmail . "')");
            db("SELECT User_id FROM users WHERE UserName = '******' AND Firstname = '" . $strFirstName . "' AND Surname = '" . $strSurName . "' AND Email = '" . $strEmail . "'");
            $user_registered = dbr();
            if (empty($user_registered) == false) {
                echo "User has successfully registered";
                exit;
            } else {
                echo "User was not registered";
                exit;
            }
        } else {
            echo "Email Address is already in use";
            exit;
        }
    } else {
        echo "Username is already in use";