Example #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'];
    }
}
Example #2
0
function determine_route($dest_sector)
{
    global $user, $cw, $st, $db_name, $autowarp, $num_aw_left, $exp_sys_arr, $GAME_VARS;
    //set starting location
    $start_sector = $user['location'];
    //declare systems array
    //will contain distance travelled ('dist'), and source of link to this system (source)
    $systems = array();
    //declare search_queue, and add the destination sector to it.
    $search_queue = array();
    array_unshift($search_queue, $start_sector);
    #loop through the systems.
    while ($search_sector = array_pop($search_queue)) {
        //skip systems that are unexplored
        if ($GAME_VARS['uv_explored'] == 0 && $exp_sys_arr[0] != -1 && array_search($search_sector, $exp_sys_arr) === false) {
            continue 1;
        }
        //get all systems that link to present system
        db("SELECT wormhole, link_1, link_2, link_3, link_4, link_5, link_6 FROM {$db_name}_stars WHERE star_id = '{$search_sector}'");
        $adj_sectors = dbr(1);
        #loop through all links to system to present system
        foreach ($adj_sectors as $key => $vertex) {
            #have reached the destination sector
            if ($vertex == $dest_sector) {
                $ret_str = "";
                $path = "";
                //jump from system to system from the start sector to the end sector.
                for ($linkback = $search_sector; $linkback != $start_sector;) {
                    $ret_str = "<b>{$linkback}</b> - " . $ret_str;
                    if (!empty($systems[$linkback]['worm'])) {
                        //a mid jump by wormhole
                        $ret_str = $cw['wormhole_to'] . ' ' . $ret_str;
                    } elseif ($key == "wormhole") {
                        //final jump is wormhole one
                        $ret_str .= $cw['wormhole_to'] . ' ';
                    }
                    $path = "{$linkback} " . $path;
                    $linkback = $systems[$linkback]['source'];
                }
                $ret_str = $cw['distance_is'] . " <b>" . (substr_count($ret_str, "-") + 1) . "</b> " . $cw['warps'] . "<br />" . $cw['path_is'] . " <b>{$start_sector}</b> - " . $ret_str . "<b>{$dest_sector}</b><br /><br />";
                $path .= "{$dest_sector}";
                $autowarp = $path;
                return $ret_str;
            }
            //selected linked system has not been visted before, so add as potential destintation.
            if ($vertex > 0 && empty($systems[$vertex])) {
                $systems[$vertex]['source'] = $search_sector;
                //set where came from.
                if ($key == "wormhole") {
                    //a wormhole jump
                    $systems[$vertex]['worm'] = 1;
                }
                //add link destination to list of systems to search.
                array_unshift($search_queue, $vertex);
            }
        }
    }
    return sprintf($st[0], $dest_sector);
}
Example #3
0
function create_tracking_table($substatus, $textstat)
{
    global $status, $login_id;
    $action = "";
    $issue['id'] = "Bug ID";
    $issue['title'] = "Bug Title";
    $issue['status'] = "Status";
    $issue['login_id'] = "Submitted By";
    $issue['action'] = "Action(s)";
    $out = make_table($issue, "WIDTH=55%");
    $counter = 0;
    db("SELECT id, title, login_id FROM server_issuetracking WHERE status= " . $status . $substatus);
    while ($issues = dbr(1)) {
        $action = "<a href='{$_SERVER['PHP_SELF']}?status={$status}&id={$issues['id']}&action=view'>View</a>";
        if ($login_id == OWNER_ID) {
            //server admin only
            if ($status == 1) {
                $action .= " - <a href='{$_SERVER['PHP_SELF']}?&status={$status}&id={$issues['id']}&action=forward'>Outstanding</a>";
                $action .= " - <a href='{$_SERVER['PHP_SELF']}?&status={$status}&id={$issues['id']}&action=resolve'>Close</a>";
            } elseif ($status == 2) {
                $action .= " - <a href='{$_SERVER['PHP_SELF']}?&status={$status}&id={$issues['id']}&action=forward'>Close</a>";
                $action .= " - <a href='{$_SERVER['PHP_SELF']}?&status={$status}&id={$issues['id']}&action=up'>Up</a>";
                $action .= " - <a href='{$_SERVER['PHP_SELF']}?&status={$status}&id={$issues['id']}&action=down'>Down</a>";
            } elseif ($status == 3) {
                $action .= " - <a href='{$_SERVER['PHP_SELF']}?&status={$status}&id={$issues['id']}&action=reopen'>Reopen</a>";
                $action .= " - <a href='{$_SERVER['PHP_SELF']}?&status={$status}&id={$issues['id']}&action=up'>Up</a>";
                $action .= " - <a href='{$_SERVER['PHP_SELF']}?&status={$status}&id={$issues['id']}&action=down'>Down</a>";
            }
        }
        //end of admin only.
        $issue['id'] = $issues['id'];
        $issue['title'] = $issues['title'];
        $issue['status'] = $textstat;
        db2("select login_name from user_accounts where login_id = '{$issues['login_id']}'");
        $temp_store = dbr2(1);
        $issue['login_id'] = $temp_store['login_name'];
        $issue['action'] = $action;
        $out .= make_row($issue);
        $counter++;
    }
    if ($counter == 0) {
        //if no bugs
        $issue['id'] = "NONE";
        $issue['title'] = "";
        $issue['status'] = "";
        $issue['login_id'] = "";
        $issue['action'] = "";
        $out .= make_row($issue);
    }
    $out .= "</table>";
    return " - {$counter} Entries<br />" . $out;
}
Example #4
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;
}
Example #5
0
db("select * from {$db_name}_planets where planet_id = '{$planet_id}'");
$planet = dbr(1);
$out = "";
$header = $cw['error'];
$status_bar_help = "?topic=Planets";
if ($user['location'] != $planet['location']) {
    $out = $st[107];
} elseif ($planet['login_id'] != $user['login_id']) {
    $out = $st[108];
    #build a research facility
} elseif ($GAME_VARS['uv_num_bmrkt'] > 0 && isset($_REQUEST['research_fac'])) {
    $header = $cw['research_facility'];
    $status_bar_help = "?topic=Blackmarkets";
    #check to see how many research centres the user has.
    db("select count(planet_id) from {$db_name}_planets where research_fac = 1 && login_id = '{$user['login_id']}'");
    $num_research = dbr();
    if ($user['cash'] < $research_fac_cost) {
        $out .= $st[109];
    } elseif (!avail_check(4000)) {
        $out .= $st[110];
    } 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']}'");
    }
Example #6
0
function checkbox_ship_list($select_sql, $command_option = 0)
{
    global $user, $user_ship, $planet_id, $type, $cw, $st, $table_head_array, $db_name;
    db2($select_sql);
    $ships = dbr2(1);
    $ret_str = "";
    $plocation = 0;
    if (empty($ships)) {
        return -1;
    } else {
        $i = 0;
        $last_fleet = '';
        while ($ships) {
            $ship_cargo = "";
            $ships['fighters'] = $ships['fighters'] . " / " . $ships['max_fighters'];
            $ships['shields'] = $ships['shields'] . " / " . $ships['max_shields'];
            $ships['armour'] = $ships['armour'] . " / " . $ships['max_armour'];
            unset($ships['max_fighters'], $ships['max_shields'], $ships['max_armour']);
            $ships['ship_name'] = popup_help("ship_info.php?s_id={$ships['ship_id']}", 320, 520, $ships['ship_name']);
            //Si db_name est inexistant, la popup n'est pas affichée.
            if ($db_name) {
                $ships['class_name_abbr'] = popup_help("help.php?popup=1&ship_info={$ships['shipclass']}&db_name={$db_name}", 300, 600, $ships['class_name_abbr']);
            }
            if (empty($ships['config'])) {
                $ships['config'] = $cw['none'];
            } else {
                $ships['config'] = config_list(0, $ships['config']);
            }
            if ($command_option == 1) {
                if ($ships['ship_id'] == $user_ship['ship_id']) {
                    $bgcolor = '000000';
                    array_push($ships, "<i>" . $cw['aux_commandes'] . "</i>");
                } else {
                    $bgcolor = '333333';
                    array_push($ships, "<a href='location.php?command={$ships['ship_id']}'>" . $cw['command'] . "</a>");
                }
            } elseif ($command_option == 2) {
                array_push($ships, "<a href='planet.php?planet_id={$planet_id}&amp;chosen_ship={$ships['ship_id']}&amp;single_ship_deal=1&amp;type={$type}'>" . $cw['load/unload'] . "</a>" . $cw['ship']);
            }
            $ships['cargo_bays'] = bay_storage_little($ships);
            unset($ships['metal'], $ships['fuel'], $ships['elect'], $ships['colon']);
            $ships['ship_id'] = "<input type='checkbox' name='do_ship[{$ships['ship_id']}]' value='{$ships['ship_id']}' />";
            //$bgcolor = ($i % 2 == 0) ? '444444':'333333';
            // if the location is different of the previous
            if ($plocation && $plocation != $ships['location'] && $command_option == 1) {
                $ret_str .= "</table><br /><h2>Système " . $ships['location'] . "</h2>";
                $ret_str .= make_table($table_head_array);
            } elseif (!$plocation) {
                // if this is the first ship listed
                if ($command_option == 1) {
                    $ret_str .= "<h2>Système " . $ships['location'] . "</h2>";
                }
                $ret_str .= make_table($table_head_array);
            }
            // suppression du champ ship class (utilisé pour la popup)
            unset($ships['shipclass']);
            // previous location
            $plocation = $ships['location'];
            $rowspan = array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
            //var_dump($ships);
            if ($last_fleet != $ships['fleet_id']) {
                //calcul du nombre de vaisseaux dans la flotte actuelle
                db("select count(ship_id) from {$db_name}_ships where login_id = " . $user['login_id'] . " AND fleet_id = " . $ships['fleet_id'] . " AND location = " . $ships['location']);
                $rowspan_count = dbr();
                //rowspan[4] = nombre de vaisseaux dans la flottte ($rowspan_count[0];)
                $rowspan['fleet_id'] = $rowspan_count[0];
                $last_fleet = $ships['fleet_id'];
            } else {
                unset($ships['fleet_id']);
            }
            if ($command_option == 2) {
                unset($ships['location']);
            }
            $ret_str .= "\n" . make_row($ships, $bgcolor, $rowspan);
            $i++;
            $ships = dbr2(1);
        }
        $ret_str .= "</table><br />";
        return $ret_str;
    }
}
Example #7
0
    print_page($cw['error'], $st[388]);
}
// Tech and Credit costs of Advanced Upgrades
// Credit Cost
#turret costs - based on size of ship
$cost_temp = get_cost("pc");
$plasma_cannon_c = round($cost_temp['cost'] * ($user_ship['size'] / 100)) * 15;
$plasma_cannon_t = round($cost_temp['tech_cost'] * ($user_ship['size'] / 100)) * 5;
$cost_temp = get_cost("bo");
$bio_armour_c = $cost_temp['cost'] * $user_ship['max_armour'];
$bio_armour_t = $cost_temp['tech_cost'] * $user_ship['max_armour'];
$cost_temp = get_cost("e2");
$advanced_engine_c = round($cost_temp['cost'] * ($user_ship['size'] / 100)) * 15;
$advanced_engine_t = round($cost_temp['tech_cost'] * ($user_ship['size'] / 100)) * 5;
db("select upgrade_slots from {$db_name}_ships where ship_id = {$user['ship_id']}");
$upgrade_pods = dbr();
$old_config = $user_ship['config'];
// value of $buy determines upgrade to be purchased
// new if statement to prevent multiple occurance of config abbrs
// new addition of num_ot,num_dt, etc to allow multiple upgrades of same type
if ($buy == 3) {
    //Plasma Cannon
    if (isset($many_pc) && $many_pc > 1) {
        $plasma_cannon_c *= $many_pc;
        $plasma_cannon_t *= $many_pc;
        $num_to_buy = $many_pc;
    } else {
        $num_to_buy = 1;
    }
    if ($user['cash'] < $plasma_cannon_c) {
        $error_str .= $st[389];
Example #8
0
            insert_history($user['login_id'], sprintf($st[750], $transfer_counter, $target[login_name]));
        }
    }
    print_page($cw['transfer_ship'], $text);
}
$text .= sprintf($st[751], $target[login_name]) . "<br /><br />";
$text .= "<b class='b1'>" . $st[752] . "<br />";
$text .= "<form action=send_ship.php method=POST name=transfer_ships><table>";
db("select ship_name, class_name, location, fighters, max_fighters, shields, max_shields, armour, max_armour, config, ship_id from {$db_name}_ships where login_id = '{$user['login_id']}' && ship_id != '{$user['ship_id']}' order by class_name");
$ships = dbr(1);
if (!isset($ships)) {
    #ensure there are some ships to display
    $text .= $st[753];
} else {
    $text .= make_table(array("Nom du vaisseau", "Type de vaisseau", "Emplacement", "Chasseurs", "Boucliers", "Coques", "Configuration"));
    while ($ships) {
        $ships['fighters'] = $ships['fighters'] . " / " . $ships['max_fighters'];
        $ships['shields'] = $ships['shields'] . " / " . $ships['max_shields'];
        $ships['armour'] = $ships['armour'] . " / " . $ships['max_armour'];
        #remove the un-necassaries from the array. As well as their numerical counterparts (it's a multi-indexed array).
        unset($ships['max_fighters']);
        unset($ships['max_shields']);
        unset($ships['max_armour']);
        $ships['ship_id'] = "<input type=checkbox name=do_ship[{$ships['ship_id']}] value={$ships['ship_id']} /> - <a href='send_ship.php?target={$target['login_id']}&do_ship[{$ships['ship_id']}]={$ships['ship_id']}'>" . $cw['sign_over'] . "</a>";
        $text .= make_row($ships);
        $ships = dbr(1);
    }
}
$text .= "</table><br /><input type=hidden name=target value={$target['login_id']} /><input type='submit' name='submit' value='Envoyer les vaisseaux' /> - <a href=javascript:TickAll(\"transfer_ships\")>" . $st[754] . "</a><br /></form>";
$text .= "<br /><a href='send_ship.php?target={$target['login_id']}'>" . $st[755] . "</a>";
print_page($cw['transfer_ship_registration'], $text);
Example #9
0
// change password
if (isset($_REQUEST['changepass'])) {
    $rs = "<br /><a href='options.php'>" . $cw['back_to_options'] . "</a>";
    if (isset($_GET['changepass']) && $_GET['changepass'] == 'change') {
        $temp_str = $st[946];
        $temp_str .= "<table><form action='options.php' method='post'><input type='hidden' name='changepass' value='changed' />";
        $temp_str .= "<tr><td align='right'>" . $st[947] . ":</td><td><input type='password' name='oldpass' /></td></tr>";
        $temp_str .= "<tr><td align='right'>" . $st[948] . ":</td><td><input type='password' name='newpass' /></td></tr>";
        $temp_str .= "<tr><td align='right'>" . $st[949] . ":</td><td><input type='password' name='newpass2' /></td></tr>";
        $temp_str .= "<tr><td></td><td><input type='submit' value='" . $st[950] . "' /></td></tr></form></table><br />";
        print_page($st[950], $temp_str);
    } elseif ($_POST['changepass'] == 'changed') {
        if ($user['login_id'] == 1) {
            //admin pass. Not encrypted
            db("select admin_pw from se_games where db_name = '{$db_name}'");
            $a_pas_temp = dbr();
            $enc_newpass = $p_user['passwd'] = $a_pas_temp[0];
            $enc_oldpass = $_POST['oldpass'];
            //make sure there are two letters and two nums in it.
            if (!preg_match("/[0-9].*[0-9]/", $_POST['newpass']) || !preg_match("/[a-z].*[a-z]/i", $_POST['newpass'])) {
                print_page($cw['error'], $st[951]);
            }
        } else {
            //user passes are encrypted
            $enc_oldpass = md5($_POST['oldpass']);
            $enc_newpass = md5($_POST['newpass']);
        }
        if (!empty($_POST['newpass']) && $_POST['newpass'] == $_POST['newpass2']) {
            if (strlen($_POST['newpass']) < 5) {
                //ensure length
                $temp_str = $st[952] . "<br />";
Example #10
0
         * Links in plugin listing.
         *
         * @since 1.0.0
         *
         * @param array $links Array of links.
         * @return array Modified array of links.
         */
        public static function add_settings_link($links)
        {
            $url = add_query_arg(array('page' => 'demo-bar', 'post_type' => 'dbsite'), admin_url('edit.php'));
            $settings_link = '<a href="' . esc_url($url) . '">' . __('Settings', 'demo-bar') . '</a>';
            array_unshift($links, $settings_link);
            return $links;
        }
    }
}
/**
 * Main instance of DemoBar.
 *
 * Returns the main instance of dbr to prevent the need to use globals.
 *
 * @since  1.0.0
 * @return DemoBar
 */
function dbr()
{
    return DemoBar::instance();
}
// Global for backwards compatibility.
$GLOBALS['demobar'] = dbr();
Example #11
0
        //	echo "<br /><a href='bugs_submit.php'>".$cw['report_a_bug']."</a>\n";
        /*echo "<br /> - <a href='bugs_tracker.php'>Bug Tracking</a><br />\n";
        	echo "<br /> - <a href='http://se.cornerjukebox.com/forum/' target='_blank'>Global Forums</a>";*/
        if ($p_user['login_id'] != 1) {
            //		echo "<br><a href='logout.php?logout_game_listing=1'>".$cw['complete_logout']."</a>";
        }
        $admin_req_str = "";
        //echo "<td>$admin_req_str<br /><br /><B>Server News</b><br /><br />";
        //require_once("$directories[includes]/server_news.inc.htm");
        /*echo "</td></tr></table><br /><br /><br /><center>
        	<p /><a href='credits.php' target='_blank'>Credits</a> - <a href='old_news.php' target='_blank'>Old News</a>
        	<br /><br /><a href='http://www.solarempire.com/' target='_blank'><img src='$directories[images]/logos/se_small.gif' border='0' /></a><br />";*/
        $rs = "";
    } elseif ($p_user['ban']) {
        echo "<p>Votre compte a été banni pour la raison suivante :<br /><br /><b>" . $p_user['raison'] . "</b><br /><br />Pour toute réclamation vous pouvez envoyer un e-mail à info@astravires.fr</p>";
    }
}
db("select login_count from user_accounts where login_id=" . $p_user['login_id']);
$res = dbr(1);
if ($res['login_count'] == 2) {
    $nom_page_analytics = '2e_login';
}
?>
	</div>

	<div class="spacer"></div>

</div>
<?php 
//print_footer($nom_page_analytics);
include 'includes/bas_index.inc.php';
Example #12
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;
}
Example #13
0
 db("select count(login_id) from {$db_name}_users where ship_id != 1 && login_id > 5");
 $ct2 = dbr();
 db("select count(login_id),sum(fighters) from {$db_name}_ships where login_id > 5");
 $ct3 = dbr();
 db("select count(planet_id),sum(fighters),sum(colon),sum(elect),sum(metal),sum(fuel) from {$db_name}_planets where login_id != 1");
 $ct4 = dbr();
 db("select count(distinct clan_id),count(login_id) from {$db_name}_users where clan_id > 0 && login_id > 5");
 $ct5 = dbr();
 db("select count(*) from {$db_name}_news");
 $ct6 = dbr();
 db("select count(message_id) from {$db_name}_messages where login_id = -1");
 $forum_posts = dbr();
 db("select count(message_id) from {$db_name}_messages where login_id > 1");
 $player_mess = dbr();
 db("select count(message_id) from {$db_name}_messages where login_id = -5");
 $clan_forum_posts = dbr();
 $out_str .= "<table border=0 cellpadding=5><tr valign=top><td colspan=3>";
 $out_str .= make_table(array("", ""));
 $out_str .= quick_row("Game Name:", "{$game['name']}");
 $out_str .= quick_row("Game ID:", "{$game['game_id']}");
 $out_str .= quick_row("db_name: ", "{$game['db_name']}");
 $out_str .= quick_row("Paused: ", "{$game['paused']}");
 $out_str .= quick_row("Status: ", "{$game['status']}");
 $out_str .= quick_row("", "");
 $out_str .= quick_row("", "");
 $out_str .= quick_row("Admin Name:", "{$game['admin_name']}");
 $out_str .= quick_row("Description:", "{$game['description']}");
 $out_str .= quick_row("Intro Message:", "{$game['intro_message']}");
 $out_str .= quick_row("Num Stars:", "{$game['num_stars']}");
 $out_str .= quick_row("", "");
 $out_str .= "</table></td></tr><tr><td>";
Example #14
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;
            }
        }
    }
}
Example #15
0
    } elseif (isset($gen_tab) && $gen_tab == 5) {
        $sql_order_str = "turns_run";
        $order_by_str = $cw['turns_run'];
    } else {
        $sql_order_str = "score";
        $order_by_str = $cw['score'];
    }
    db("select cash,login_name,fighters_killed,ships_killed,ships_lost,turns_run,score,login_id from {$db_name}_users where login_id > 5 order by {$sql_order_str} {$order_dir}");
    $text .= "<br />" . $st[992] . " <b>{$order_by_str}</b>";
    $text .= make_table(array($cw['rank'], $cw['name'], $cw['fighters'] . "<br />" . $cw['killed'], $cw['ships'] . " <br />" . $cw['killed'], $cw['ships'] . " <br />" . $st[995], $cw['turns'] . " <br />" . $st[996], $cw['score']));
}
$text .= '<br />';
$ct1 = 1;
$ct2 = 1;
$last = "";
while ($player = dbr(1)) {
    if (isset($player[$sql_order_str]) && $player[$sql_order_str] != $last) {
        $last = $player[$sql_order_str];
        if ($ct2 > 1) {
            $ct1 = $ct2;
        }
    }
    if ($table != 2) {
        $player['cash'] = $ct1;
    }
    if (!isset($player['last_attack_by']) && $table == 2) {
        $player['last_attack_by'] = "~";
    }
    if (isset($player['clan_sym']) && $table == 2) {
        $player['clan_sym'] = "<font color=#{$player['clan_sym_color']}>{$player['clan_sym']}</font>";
        $player['clan_sym_color'] = "";
Example #16
0
//height of 'local area' map.
$sol = 1;
// system Sol is in.
if (!isset($_GET['large_map'])) {
    $large_map = false;
} else {
    $large_map = true;
}
if ($user['explored_sys'] == -1) {
    exit;
}
$exp_sys_arr = explode(",", $user['explored_sys']);
$systems = array();
$all_links = array();
db("select * from {$db_name}_stars");
while ($temp_star_store = dbr(1)) {
    $temp_star_store['links'] = array($temp_star_store['link_1'], $temp_star_store['link_2'], $temp_star_store['link_3'], $temp_star_store['link_4'], $temp_star_store['link_5'], $temp_star_store['link_6']);
    $systems[$temp_star_store['star_id']] = $temp_star_store;
}
unset($temp_star_store);
if ($large_map) {
    //creating large maps
    $size_x = $GAME_VARS['uv_size_x_width'] + $UNI['map_border'] * 2;
    $size_y = $GAME_VARS['uv_size_y_height'] + $UNI['map_border'] * 2;
    $offset_x = $UNI['map_border'];
    $offset_y = $UNI['map_border'];
    $central_star = 1;
} else {
    $size_x = $UNI['localmapwidth'];
    $size_y = $UNI['localmapwidth'];
    $offset_x = -$systems[$user['location']]['x_loc'] + $UNI['localmapwidth'] / 2;
Example #17
0
        echo "\n";
        db("select login_id from user_accounts where login_name != '' and bp_user_id != 0 and signed_up > " . (time() - 24 * 3600));
        echo dbc();
        break;
    case 'connectes':
        db("select login_id from user_accounts where last_request > " . (time() - 300));
        echo dbc();
        echo "\n";
        db("select login_id from user_accounts where bp_user_id != 0 and last_request > " . (time() - 300));
        echo dbc();
        break;
    case 'nbjoueurs':
        db("select login_id from user_accounts where login_count >= 4 and last_request > " . (time() - 4 * 24 * 3600));
        echo dbc();
        echo "\n";
        db("select login_id from user_accounts where bp_user_id != 0 and login_count >= 4 and last_request > " . (time() - 4 * 24 * 3600));
        echo dbc();
        break;
    case 'ressources':
        $gal = $argv[2];
        db("select avg(metal) as titane from {$gal}_stars where star_id > 1");
        $data = dbr();
        echo $data['titane'];
        echo "\n";
        db("select avg(fuel) as larium from {$gal}_stars where star_id > 1");
        $data = dbr();
        echo $data['larium'];
        break;
    default:
        echo 0;
}
Example #18
0
<?php

require_once "user.inc.php";
$filename = "black_market.php";
$status_bar_help = "?topic=Blackmarkets";
ship_status_checker();
$error_str = "";
db("select * from {$db_name}_bmrkt where location = '{$user['location']}' order by bmrkt_type asc");
$bmrkt = dbr(1);
if (empty($bmrkt)) {
    print_page($cw['port'], $st[68]);
} elseif ($GAME_VARS['uv_num_bmrkt'] == 0 && $user['login_id'] != 1) {
    print_page($cw['error'], $st[69]);
}
$error_str .= sprintf($st[70], $bmrkt[bm_name]);
$error_str .= $st[71];
$error_str .= "<br /><a href='bm_ships.php?from_0=1'>" . $st[72] . "</a>";
$error_str .= "<br /><a href='bm_upgrades.php?from_0=1'>" . $st[73] . "</a>";
$rs = "<p /><a href='location.php'>" . $cw['close_contact'] . "</a><br />";
print_page($cw['blackmarket'], $error_str);
Example #19
0
     }
     $people_can_mess .= "\n</select>";
 }
 $page_str = "";
 $data_for_textbox = "";
 $loadable_mess_sql = " (login_id = -1 || login_id = '{$user['login_id']}' || (login_id = -5 && clan_id = '{$clan_id}'))";
 if (isset($_REQUEST['forward'])) {
     //get forwarded message
     db("select text from {$db_name}_messages where message_id = '" . (int) $_REQUEST['forward'] . "' && " . $loadable_mess_sql);
     $forward_message = dbr(1);
     $data_for_textbox = "\n\n\n\n\n\n{$st['906']}:\n\n\"{$forward_message['text']}\"";
     $page_str = $people_can_mess;
 } elseif (isset($_REQUEST['reply_to'])) {
     //a reply to a message, so get reply text
     db("select text from {$db_name}_messages where message_id = '{$reply_to}' && " . $loadable_mess_sql);
     $reply_to = dbr(1);
     $page_str = $st[906] . " :<br /><blockquote><hr><br />" . nl2br($reply_to['text']) . "<br /><hr></blockquote><br />";
 } elseif (!isset($_POST['preview'])) {
     //plain normal message.
     $page_str = $people_can_mess;
 }
 //can be previewing and forwarding/replying, so not part of above if structure.
 if (isset($_POST['preview'])) {
     //previewing
     $prev = mcit($text);
     $page_str .= $people_can_mess . "<p />" . $st[907] . ": <p /><hr width=75% align=left><blockquote>{$prev}</blockquote><hr width='75%' align='left'><br />";
     $data_for_textbox = $text;
     //unset so don't end up back at the preview when clicking submit
     unset($_POST['preview'], $_POST['text']);
 }
 get_var('Send Message', 'message.php', $page_str, 'msg', $data_for_textbox);
Example #20
0
     }
     $error_str .= "</table><p />";
     $error_str .= $st[562] . " <input type=text name=join_fleet_id_2 value='' max=3 size=3 />";
     $error_str .= "<input TYPE='hidden' name=fleet_type value=1 />";
     $error_str .= " - <input type='submit' name=join_fleet_button value=" . $cw['change_fleet'] . " />";
     $error_str .= " - <a href=javascript:TickAll(\"fleet_maint\")>" . $cw['invert_ship_selection'] . "</a><p /></form>";
     /*************
      * Summary of Clan ships
      **************/
 } else {
     db("select login_id, count(ship_id) as total, sum(fighters) as fighters from {$db_name}_ships where clan_id = {$user['clan_id']} group by login_id order by fighters desc, ship_name desc");
     $clan_ship = dbr(1);
     $error_str .= "<br /><br /><a href='clan.php?show_clan_ships=1'>" . $cw['show_all_clan_ships'] . "</a><p />";
     while ($clan_ship) {
         $error_str .= print_name($clan_ship) . " has <b>{$clan_ship['total']}</b> " . $cw['ship(s)'] . " w/ <b>{$clan_ship['fighters']}</b> " . $cw['total_fighters'] . "<br />";
         $clan_ship = dbr(1);
     }
     $error_str .= "<br /><br />";
 }
 $error_str .= "<a href='clan.php?ranking=1'>" . $cw['clan_rankings'] . "</a>";
 $error_str .= "<br /><a href='clan.php?clan_info=1&target={$user['clan_id']}'>" . $cw['clan_information'] . "</a><br /><br />";
 if ($user['login_id'] == $clan['leader_id'] || $user['login_id'] == 1) {
     $error_str .= "<a href='clan.php?changepass=1'>" . $cw['change_clan_password'] . "</a><br />";
     if ($clan_member_count[$clan['clan_id']] > 1) {
         $error_str .= "<a href='clan.php?lead_change=1'>" . $cw['change_clan_leader'] . "</a><br />";
         $error_str .= "<a href='message.php?target_id=-2&clan_id={$user['clan_id']}'>" . $cw['message_clan'] . "</a><br />";
     }
     if ($user['login_id'] == 1 && $user['login_id'] != $clan['leader_id']) {
         $error_str .= "<a href='clan.php?leave=1'>" . $cw['leave_clan'] . "</a><br />";
     }
     $error_str .= "<a href='clan.php?disband=1'>" . $cw['disband_clan'] . "</a><br />";
Example #21
0
$result3 = mysql_query("UPDATE " . $PA["table"] . " SET destroyers_base=0 where destroyers_base < 0", $db);
dbr(mysql_error());
$result3 = mysql_query("UPDATE " . $PA["table"] . " SET scorpions=0 where scorpions < 0", $db);
dbr(mysql_error());
$result3 = mysql_query("UPDATE " . $PA["table"] . " SET scorpions_base=0 where scorpions_base < 0", $db);
dbr(mysql_error());
$result3 = mysql_query("UPDATE " . $PA["table"] . " SET astropods=0 where astropods < 0", $db);
dbr(mysql_error());
$result3 = mysql_query("UPDATE " . $PA["table"] . " SET astropods_base=0 where astropods_base < 0", $db);
dbr(mysql_error());
$result3 = mysql_query("UPDATE " . $PA["table"] . " SET avengers=0 where avengers < 0 ", $db);
dbr(mysql_error());
$result3 = mysql_query("UPDATE " . $PA["table"] . " SET rcannons=0 where rcannons < 0 ", $db);
dbr(mysql_error());
$result3 = mysql_query("UPDATE " . $PA["table"] . " SET lstalkers=0 where lstalkers < 0 ", $db);
dbr(mysql_error());
?>

<?php 
if ($os == "windows") {
    echo "<meta HTTP-EQUIV=\"Refresh\" content=\"60\">";
}
Logging("ticker", "Ticker done in " . (time() - $time1) . " seconds. MySQL Report: {$dbr}\nOB: " . ob_get_contents());
/*mysql_query("unlock tables");
while(@mysql_close($db)) { }
while(@mysql_close()) { }
while(mysql_close()) { }
while(@mysql_kill()) { }
while(@mysql_kill($db)) { }*/
mysql_close($db);
/*mysql_close();*/
Example #22
0
$text = '';
$filename = 'planet_list.php';
#little code to allow users to sort planets asc, desc in a number of criteria
if (isset($sort_planets)) {
    if ($sorted == 1) {
        $going = "asc";
        $sorted = 2;
    } else {
        $going = "desc";
        $sorted = 1;
    }
    db("select planet_img,planet_name,location,fighters,colon,cash,metal,fuel,elect from {$db_name}_planets where login_id = {$user['login_id']} and location != 1 order by '{$sort_planets}' {$going}");
} else {
    db("select planet_img,planet_name,location,fighters,colon,cash,metal,fuel,elect from {$db_name}_planets where login_id = {$user['login_id']} and location != 1 order by fighters desc, planet_name asc");
    $sorted = "";
}
$clan_planet = dbr(1);
if ($clan_planet) {
    $text .= make_table(array('', "<a href='{$filename}?sort_planets=planet_name&sorted={$sorted}'>" . $cw['planet_name'] . "</a>", "<a href='{$filename}?sort_planets=location&sorted={$sorted}'>" . $cw['location'] . "</a>", "<a href='{$filename}?sort_planets=fighters&sorted={$sorted}'>" . $cw['fighters'] . "</a>", "<a href='{$filename}?sort_planets=colon&sorted={$sorted}'>" . $cw['colonists'] . "</a>", "<a href='{$filename}?sort_planets=cash&sorted={$sorted}'>" . $cw['cash'] . "</a>", "<a href='{$filename}?sort_planets=metal&sorted={$sorted}'>" . $cw['metal'] . "</a>", "<a href='{$filename}?sort_planets=fuel&sorted={$sorted}'>" . $cw['fuel'] . "</a>", "<a href='{$filename}?sort_planets=elect&sorted={$sorted}'>" . $cw['electronics'] . "</a>"));
    while ($clan_planet) {
        $clan_planet['planet_img'] = '<img src="images/planets/' . $clan_planet['planet_img'] . '_tn.jpg" border=0>';
        $text .= make_row($clan_planet);
        $clan_planet = dbr(1);
    }
    $text .= "</table><br />";
} else {
    $text .= $st[1815];
}
$rs = "<p /><a href='location.php'>" . $cw['back_star_system'] . "</a>";
// print page
print_page($cw['planet_list'], $text);
Example #23
0
function shipExists($ship_name)
{
    db_connect();
    global $db_name;
    if ($db_name == "") {
        $db_name = "bes";
    }
    $query = "SELECT * FROM {$db_name}_ships where ship_name =  '{$ship_name}' ";
    db($query);
    $ship = dbr(1);
    if (!$ship) {
        return false;
    } else {
        return true;
    }
}
Example #24
0
$out .= "<a href='multiscan.php'>Multi scan</a><br />";
$out .= "<a href='{$_SERVER['PHP_SELF']}?ban=1'>Ban Player</a><br />";
$out .= "<a href='{$_SERVER['PHP_SELF']}?update_scores=1'>Update Scores</a><br />";
$out .= "<a href='{$_SERVER['PHP_SELF']}?more_money=1'>Give Money</a><p />";
$out .= "General:<br />";
$out .= "<a href='{$_SERVER['PHP_SELF']}?admin_name=1'>Change Admin Name</a><br />";
$out .= "<a href='{$_SERVER['PHP_SELF']}?email=1'>Change Admin E-mail</a><br />";
$out .= "<a href='{$_SERVER['PHP_SELF']}?descr=1'>Change Game Description</a><br />";
$out .= "<a href='{$_SERVER['PHP_SELF']}?messag=1'>Change Intro Message</a><br />";
$out .= "<a href='{$directories['includes']}/other_admin.php?admin_readme=1'>Admin Readme!</a><br />";
$out .= "<form action='{$_SERVER['PHP_SELF']}' name='get_var_form' method='post'>";
$out .= "<input type='hidden' name='save_vars' value='1' />";
$out .= "<input type='submit' value='Submit Vars' />";
$out .= "<p />Note: Only variables that are within range will be saved.";
//load the vars that are in the DB for this. File vars may be outdated.
load_admin_vars();
db2("select name, min, max, description from se_db_vars order by name");
$out .= list_options(1, $GAME_VARS);
$db_var = dbr(1);
while ($db_var) {
    if ($db_var['value'] < $db_var['min'] || $db_var['value'] > $db_var['max']) {
        //error checking
        $db_var['value'] = $db_var['default_value'];
    }
    $out .= "<p /><table border=2 cellspacing=1 width=350><tr bgcolor='#333333' width='350'><td width='250'><b><font color='#AAAAEE'>{$db_var['name']}</font></b> ( {$db_var['min']} .. {$db_var['max']} )</td><td align='right' width='100'><input type='text' name='{$db_var['name']}' value='{$db_var['value']}' size='8' /></td></tr><tr bgcolor='#555555' width='350'><td colspan='2' width='350'><blockquote>{$db_var['descript']} <p />Server Default: <b>{$db_var['default_value']}</b></blockquote></td></tr></table><br />";
    $db_var = dbr(1);
}
$out .= "<p /><input type='submit' value='Submit Vars' />";
$out .= "<br /></form>";
$rs = "<p /><a href='location.php'>Back to Star System</a>";
print_page("Admin", $out);
Example #25
0
        } elseif ($maths > 30) {
            $out = $st[570];
        } elseif ($maths > 10) {
            $out = $st[571];
        } else {
            $out = $st[572];
        }
        $output_str .= sprintf($st[573], $maths, $total_cost) . $out . "<br /><br />";
    }
}
/*************
* Default page
**************/
#find out the basic stats of the fleet.
db("select count(ship_id) as ships, count(distinct shipclass) as types, count(distinct fleet_id) as fleets, sum(cargo_bays) as cargo_cap from {$db_name}_ships where login_id = '{$user['login_id']}'");
$fleet_count = dbr();
#user has no ships
if (!$fleet_count) {
    print_page($cw['fleet_command'], $st[574]);
}
if (isset($sort_ships)) {
    if ($sorted_ships == 1) {
        $going = "asc";
        $sorted_ships = 2;
    } else {
        $going = "desc";
        $sorted_ships = 1;
    }
    $select_ships_sql = "select ship_name, class_name_abbr, location, shipclass, fighters ,max_fighters, shields, max_shields, armour, max_armour, cargo_bays, metal, fuel, elect, colon, fleet_id, clan_fleet_id, config, ship_id from {$db_name}_ships where login_id = '{$user['login_id']}' order by '{$sort_ships}' {$going}";
} else {
    $select_ships_sql = "select ship_name, class_name_abbr, location, shipclass, fighters ,max_fighters, shields, max_shields, armour, max_armour, cargo_bays, metal, fuel, elect, colon, fleet_id, clan_fleet_id, config, ship_id from {$db_name}_ships where login_id = '{$user['login_id']}' order by  location asc, fleet_id asc, fighters desc, ship_name asc";
Example #26
0
function search_the_db2($orig_search, $all_any)
{
    global $db_name, $cw, $st;
    //initialise an array containing topic headings
    $topic_array = array('admin' => 0, 'attacking' => 0, 'bomb' => 0, 'clan' => 0, 'game_status' => 0, 'maint' => 0, 'other' => 0, 'player_status' => 0, 'planet' => 0, 'random_event' => 0, 'ship' => 0);
    //make sure doesn't contain nasties, or mysql REGEXP trip-ups
    $term = trim(mysql_escape_string(preg_replace("/(\\^|\\\$|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\{|\\}|\\,|\\=|\\:)/", "", $orig_search)));
    $keywords = preg_split("/\\s/", $term);
    //create the sql query
    $sql_query = "";
    //clear query text
    //want to search for all of the relevent terms
    if ($all_any == 1) {
        $operator = " &&";
        $text_any_all = $cw['all'];
    } else {
        //searching for any terms.
        $operator = " ||";
        $text_any_all = $cw['any'];
    }
    //loop through keywords
    foreach ($keywords as $value) {
        //add to sql_query text.
        $sql_query .= "{$operator} headline REGEXP '{$value}'";
    }
    //get rid of leading operator, place surrounding brackets around it
    $sql_query = "(" . preg_replace("/^" . preg_quote($operator) . " /", "", $sql_query) . ") && ( ";
    //deal with the topics
    $counter = 0;
    $topic_sql_q = "";
    foreach ($topic_array as $key => $val) {
        if (!empty($_POST[$key])) {
            $topic_sql_q .= " || topic_set LIKE '{$key}'";
            $counter++;
        }
    }
    //make sure at least some topics were selected
    if ($counter == 0) {
        print_page($st[921], $st[922]);
    }
    //get rid of lead || and add a trailing bracket )
    $sql_query .= preg_replace("/^ \\|\\| /", "", $topic_sql_q) . ")";
    $t_str = "";
    $counter = 0;
    db("select timestamp, headline from {$db_name}_news where {$sql_query}");
    while ($results = dbr(1)) {
        $counter++;
        $t_str .= quick_row("<b>" . date("M d - H:i", $results['timestamp']), stripslashes($results['headline']));
    }
    $text = "<a href='{$_SERVER['PHP_SELF']}'>" . $st[923] . "</a><p /><b>{$counter}</b> " . sprintf($st[924], $orig_search, $text_any_all) . ".";
    //if there were results, print a nice page.
    if ($counter != 0) {
        $text .= "<p />" . make_table(array("", "")) . $t_str . "</table>";
    }
    print_page($st[920], news_search_bar() . $text);
}
Example #27
0
 } elseif (!eregi($pattern, $email_address)) {
     $error_str .= "<p />" . $st[683];
 }
 //there was an error somewhere. so quit signup
 if ($error_str != "") {
     print_s_page($cw['sign_up'], "<b class='b1'>" . $cw['warning'] . "</b>! " . $st[685] . " " . $error_str);
 }
 // check for existing username
 db("select login_id from user_accounts where login_name = '{$login_name}'");
 $user_check = dbr(1);
 if (!empty($user_check['login_id'])) {
     print_s_page($st[686], $st[687]);
 }
 // check for existing email_address
 db("select login_id from user_accounts where email_address = '{$email_address}'");
 $mail_check = dbr(1);
 if (!empty($mail_check['login_id'])) {
     print_s_page($st[686], $st[688]);
 }
 /*******************
  * All optionals are acceptable. Begin account creation
  ********************/
 //if user has entered aim number they will quite probably want to see aim users. Otherwise they won't by default
 if ($_POST['aim']) {
     $aim_show = 1;
 } else {
     $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;
Example #28
0
<?php

require_once "user.inc.php";
if (!isset($sys1) || !isset($sys2)) {
    echo $cw['required_parems_missing'];
    exit;
} elseif ($GAME_VARS['uv_explored'] == 0 && $user['explored_sys'] != -1) {
    echo $st[74];
    exit;
}
db_connect();
db("select x_loc,y_loc from {$db_name}_stars where star_id = '{$sys1}'");
$star_one = dbr(1);
db("select x_loc,y_loc from {$db_name}_stars where star_id = '{$sys2}'");
$star_two = dbr(1);
if ($game_info['random_filename'] == -1) {
    $file_rand = "";
} else {
    $file_rand = "_" . $game_info['random_filename'];
}
$im = imagecreatefrompng("{$directories['images']}/{$db_name}_maps/sm_full{$file_rand}.png");
$red = ImageColorAllocate($im, 255, 50, 50);
$red2 = ImageColorAllocate($im, 255, 150, 150);
$green = ImageColorAllocate($im, 50, 255, 50);
$green2 = ImageColorAllocate($im, 50, 255, 150);
imagestring($im, 3, $star_one['x_loc'] - 10, $star_one['y_loc'] - 5, $cw['you_are_here'], $red2);
imagearc($im, $star_one['x_loc'] + 30, $star_one['y_loc'] + 25, 30, 30, 0, 360, $red);
if ($sys1 != $sys2) {
    #imagestring($im,3,($star_two[x_loc]-15),$star_two[y_loc]+40,"System $sys2 here",$green2);
    imagearc($im, $star_two['x_loc'] + 29, $star_two['y_loc'] + 25, 35, 35, 0, 360, $green);
}
Example #29
0
    $col_arr = array(0 => '#003000', 1 => '#113322');
    dbn("update user_accounts set last_access_global_forum = '" . time() . "' where login_id = '{$p_user['login_id']}'");
    /*******************
    * Regular Forum Precursers
    *******************/
} elseif ($target_id == -1) {
    $header = "Shoutbox";
    $forum_id = -1;
    $col_arr = array('#444444', '#282828', '#202020', '#888888');
    dbn("update {$db_name}_users set last_access_forum='" . time() . "' where login_id = '{$user['login_id']}'");
    $out .= '<div id="derniers_messages">' . make_table2(array('Derniers messages<br />du forum'));
    $phpbb_root_path = 'forum/';
    $sql = 'SELECT p.*, t.* FROM phpbb_posts p JOIN phpbb_topics t ON p.topic_id = t.topic_id GROUP BY t.topic_id ORDER BY p.post_id DESC LIMIT 12';
    db($sql);
    $messages = '';
    while ($row = dbr()) {
        if (strlen($row['topic_title']) > 40) {
            $row['topic_title'] = substr($row['topic_title'], 0, 37) . '...';
        }
        $messages .= '<a href="' . $phpbb_root_path . 'viewtopic.php?t=' . $row['topic_id'] . '" target="_blank">' . ucfirst($row['topic_title']) . '</a><br />';
    }
    $out .= q_row($messages, 'l_col');
    //end the left-bar cell
    $out .= "\n</table></div>";
    // facebook like box
    $out .= '<iframe src="http://www.facebook.com/plugins/likebox.php?id=151362804883979&amp;width=292&amp;connections=10&amp;stream=false&amp;header=false&amp;height=255" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:292px; height:255px; background-color: #FFFFFF;" allowTransparency="false"></iframe>';
    $out .= '<div class="spacer"></div>';
} else {
    //messing around
    print_page("Dunno", "You've been messing with things you don't understand again, havn't you?");
}
Example #30
0
                $out3 .= '<br /><a href="player_info.php?target=' . $sec_ret[login_id] . '"><b class="b1">' . $sec_ret['login_name'] . '</b></a>';
            }
        }
    }
}
if (!$out1) {
    $out1 = '<br /><b class="b1"><i>No Definite Multiple Accounts</i></b>';
}
$out = $out . $out1;
$out .= '<p><b>Likely Multi\'s</b> <i>(peeps who could be a multi, however one of the two accounts hasn\'t logged in yet)</i></p>';
if (!$out3) {
    $out3 = '<br /><b class=b1><i>No Likely Multiple Accounts</i></b>';
}
$out = $out . $out3;
//Same IP Check
if ($dup_ip) {
    $t_ip = $dup_ip;
    $out .= '<p><br /><b>Players with identical IPs</b>:';
    while ($d_i = each($t_ip)) {
        db("select login_name from {$db_name}_users where login_id = " . $d_i['key']);
        $ret = dbr();
        $out2 .= '<br /><a href="../player_info.php?target=' . $d_i['key'] . '"><b class="b1">' . $ret['login_name'] . '</b></a>';
    }
}
if (!$out1) {
    $out2 = '<br />No Peeps with same IP.';
}
$out = $out . $out2;
$rs .= '<small><p><br /><br /><div align="center">Multi-checker by Jonathan "Moriarty" 2001 <i>(Modified 2003 - Maugrim The Reaper) [Modified for new admin panel 2004 - Hades20082]</i></small></div>';
$rs .= '<small><div align="center">Disclaimer: If a player does turn out to not have been a multi, it should be noted this script only claims a 70-90% certainty of determining someone a Multi. All available evidence should be noted.</small></div>';
print_page('Multi Checking', $out);