function set_relation($src_user_id, $dst_user_id, $relation) { assert(is_numeric($serc_user_id)); assert(is_numeric($dst_user_id)); assert(is_numeric($relation)); $errors['PARAMS'] = "No decent params given."; $data['uid'] = $src_user_id; $data['dst_uid'] = $dst_user_id; $data['wid'] = $relation; comm_send_to_server("RELATION", $data, "", $errors); }
$uid = user_ourself(); } if ($cmd == "show") { if ($sid == "") { sector_show_all_sectors($uid); } else { sector_show_sector($sid, $uid); } } if ($cmd == "claim") { $ok = ""; $errors['PARAMS'] = "Incorrect parameters specified..\n"; $errors['NAME'] = "The sector name already exists.\n"; $data['sector_id'] = $sid; $data['name'] = convert_crlf_to_px_tag($ne_name); comm_send_to_server("SECTOR", $data, $ok, $errors); } print_footer(); exit; // ============================================================================================ // // // Description: // // // Parameters: // // // Returns: // //
} else { if ($distance < $_GALAXY['galaxy_core']) { print_line("<li><font color=red>You cannot fly that far into the galaxy core. Try a higher distance (minimum is " . $_GALAXY['galaxy_core'] . ").</font>\n"); } elseif ($distance > $_GALAXY['galaxy_size']) { print_line("<li><font color=red>You cannot fly outside of the galaxy. Try a lower distance (maximum is " . $_GALAXY['galaxy_size'] . ").</font>\n"); } else { $ok = ""; $errors['PARAMS'] = "Incorrect parameters specified..\n"; $errors['NAME'] = "The preset name you already used.\n"; $data['action'] = "create"; $data['distance'] = $distance; $data['angle'] = $angle; $data['name'] = $ne_name; $data['uid'] = $uid; $data['pid'] = 0; comm_send_to_server("PRESET", $data, $ok, $errors); } } } // Show command, always executed. if ($uid == "") { $uid = user_ourself(); } preset_show_all_presets($uid); print_footer(); exit; // ============================================================================================ // // // Description: //
print_header(); $ok = ""; $errors['PARAMS'] = "Incorrect parameters specified..\n"; $data['tag'] = $_POST['tag']; $data['name'] = $_POST['name']; $data['email'] = $_POST['email']; $data['inform'] = $_POST['inform']; $data['gender'] = $_POST['gender']; $data['city'] = $_POST['city']; $data['country'] = $_POST['country']; $data['species'] = $_POST['species']; $data['planet'] = $_POST['planet']; $data['sector'] = $_POST['sector']; $data['login_name'] = $_POST['login_name']; $data['login_pass'] = $_POST['login_pass']; if (comm_send_to_server("REGISTER", $data, $ok, $errors) == 1) { echo "You have registered correctly. Now click here (Which doesn't work because i didn't finish it)...\n"; } else { echo "An unknown error has occured...\n"; } print_footer(); } } // if $(submit) exit; /**************************************************************************************************** */ function register($errors_txt = "", $errors = "") { if (!isset($errors)) { $errors = array();
if ($ne_explore_rate == "") { $ne_explore_rate = $user['science_explore']; } if ($ne_building_rate + $ne_vessel_rate + $ne_invention_rate + $ne_explore_rate != 100) { print_line("<font color=red><center><strong>Warning:</strong><br>Your percentage settings must be equal to 100%!<br>New rating is not set!</center></font>"); } else { $ok = ""; $errors['PARAMS'] = "Incorrect parameters specified..\n"; $errors['100'] = "The rating must add to 100%\n"; $data['id'] = user_ourself(); $data['ratio'] = $ne_science_ratio; $data['invention'] = $ne_invention_rate; $data['building'] = $ne_building_rate; $data['vessel'] = $ne_vessel_rate; $data['explore'] = $ne_explore_rate; comm_send_to_server("SCIENCE", $data, $ok, $errors); } } // Show user info if ($uid == "") { $uid = user_ourself(); } $user = user_get_user($uid, NOCACHE); // Reload, since the $user data may have changed show_invention_levels($uid); show_science_table($uid, $user['impulse'], $user['science_ratio'], $user['science_invention'], $user['science_building'], $user['science_vessel'], $user['science_explore']); print_footer(); exit; // ============================================================================================ // //
function request_join_alliance($request_id) { assert(is_numeric($request_id)); $data['alliancecmd'] = "REQ"; $data['aid'] = 0; $data['uid'] = $request_id; $errors['PARAMS'] = "No decent params given."; $errors['GONE'] = "This request is no longer valid."; $errors['ALREADYJOINED'] = "The user already joined another alliance."; comm_send_to_server("ALLIANCE", $data, "", $errors); }
function upgrade_speed($_USER, $vessel_id) { // Get global information $user = user_get_user($_USER['id']); $result = sql_query("SELECT * FROM g_flags WHERE user_id=" . $_USER['id']); $flags = sql_fetchrow($result); $vessel = vessel_get_vessel($vessel_id); // Show Ship and User Capabilities echo "<table align=center border=1>"; echo "<tr><td>"; echo "<table width=100% border=0 cellpadding=0 cellspacing=0>"; echo "<tr><th colspan=2>Current Ship Capabilities</th></tr>"; echo "<tr><td>Impulse Speed: </td><td>" . $vessel['impulse'] . "%</td></tr>"; echo "<tr><td>Warp Speed: </td><td>" . number_format($vessel['warp'] / 10, 1) . "</td></tr>"; echo "<tr><td> </td><td> </td></tr>"; echo "</table>"; echo "</td><td>"; echo "<table width=100% border=0 cellpadding=0 cellspacing=0>"; echo "<tr><th colspan=2>User Statistics</th></tr>"; echo "<tr><td>Credits:</td><td>" . $user['credits'] . "</td></tr>"; echo "<tr><td> </td><td> </td></tr>"; echo "<tr><td> </td><td> </td></tr>"; echo "</table>"; echo "</td></tr>"; echo "</table>"; echo "<br>"; echo "<br>"; if ($vessel['impulse'] == $user['impulse'] and $vessel['warp'] == $user['warp']) { echo " <table align=center>"; echo " <tr><td>Ship Name: </td><td>" . $vessel['name'] . "</td></tr>"; echo " <tr><td> </td><td>No upgrade Possible</td></tr>"; echo " </table>"; } // Stage 1: Create Ship and ship name if (!isset($stage) || $stage == 1) { form_start(); echo "<input type=hidden name=vid value={$vid}>"; echo " <table align=center>"; echo " <tr><td>Ship Name: </td><td>" . $vessel['name'] . "</td></tr>"; echo " <tr><td colspan=2></td></tr>"; echo " <tr><td>Impulse speed: </td><td>"; if ($flags['can_warp'] == 1) { echo "<input type=hidden name=impulse value=100>100 % (" . $config['s_impulse_costs'] * 100 . " Credits)"; } else { echo " <select name='impulse'>"; for ($i = $vessel['impulse'] + 1; $i != $user['impulse'] + 1; $i++) { echo "<option value=" . $i . ">" . $i . " % (" . ($i - $vessel['impulse']) * $config['s_impulse_costs'] . " Credits)</option>"; } echo " </select>"; } echo " </td></tr>"; echo " <tr><td>Warp Speed: </td><td>"; if ($flags['can_warp'] == 1) { echo " <select name=warp>"; for ($i = $vessel['warp'] + 1; $i != $user['warp'] + 1; $i++) { echo "<option value=" . $i . "> Warp " . number_format($i / 10, 1) . " (" . ($i - $vessel['warp']) * $config['s_warp_costs'] . " Credits)</option>"; } echo " </select>"; } else { echo "<input type=hidden name=warp value=0>"; echo "None"; } echo " </td></tr>"; echo " <tr><td> </td><td><input type=submit name=submit value=\"Upgrade Ship\"></td></tr>"; echo " </table>"; form_end(); } // Stage 2: Add or Delete weaponary if ($stage == 2 and ($vessel['type'] == VESSEL_TYPE_TRADE or $vessel['type'] == VESSEL_TYPE_EXPLORE)) { $stage = 3; } if ($stage == 2) { // Get all weapons we can view $visible_weapons = array(); $result = sql_query("SELECT * FROM g_weapons WHERE user_id=" . $_USER['id']); $visible_weapons = csl_create_array($result, "csl_weapon_id"); // And dump them into the table echo "<table border=1 align=center>"; echo "<tr><th colspan=8>Weaponary</th></tr>"; echo "<tr>"; echo "<th>Name</th>"; echo "<th>Costs</th>"; echo "<th>Power</th>"; echo "<th>Attack</th>"; echo "<th>Defense</th>"; echo "<th>Qty</th>"; echo "<th colspan=2>Action</th>"; echo "</tr>"; reset($visible_weapons); while (list($key, $weapon_id) = each($visible_weapons)) { $result = sql_query("SELECT * FROM s_weapons WHERE id=" . $weapon_id); $weapon = sql_fetchrow($result); echo "<tr>"; echo "<td>" . $weapon['name'] . "</td>"; echo "<td>" . $weapon['costs'] . "</td>"; echo "<td>" . $weapon['power'] . "</td>"; echo "<td>" . $weapon['attack'] . "</td>"; echo "<td>" . $weapon['defense'] . "</td>"; echo "<td><input type=text size=3 maxlength=3 value=0 name=T1></td>"; echo "<td><b>Add</b></td>"; echo "<td><b>Delete</b></td>"; echo "</tr>"; } echo "</table>"; echo "<br><br>"; } if ($stage == 3) { $ok = "Vessel upgrade in process..\n"; $errors['PARAMS'] = "Incorrect parameters specified...\n"; $errors['SPEED'] = "Incorrect speed settings...\n"; $errors['CREDITS'] = "Not enough credits...\n"; $data['impulse'] = $_POST['impulse']; $data['warp'] = $_POST['warp']; $data['vid'] = decrypt_get_vars($_POST['vid']); comm_send_to_server("VESSELUPGRADE", $data, $ok, $errors); } }
function post_preferences($user_id, $prefs) { global $_USER; global $ext; // Now move the avatar if any was uploaded if ($_FILES['avatar']['error'] != 4) { // TODO: Change PATH into config thingie move_uploaded_file($_FILES['avatar']['tmp_name'], "c:\\perihelion\\WWW\\perihelion\\images\\users\\" . $_USER['login_name'] . $ext); } // And set the preferences $ok = ""; $errors['PARAMS'] = "Incorrect parameters specified..\n"; $data['name'] = $prefs['name']; $data['email'] = $prefs['email']; $data['inform'] = $prefs['inform']; $data['gender'] = $prefs['gender']; $data['city'] = $prefs['city']; $data['country'] = $prefs['country']; $data['tag'] = $prefs['tag']; if ($_FILES['avatar']['error'] != 4) { $data['avatar'] = $_USER['login_name'] . $ext; } else { $data['avatar'] = ''; } $data['login_pass'] = $prefs['login_pass']; $data['dob'] = $prefs['doby'] . "-" . $prefs['dobm'] . "-" . $prefs['dobd']; $data['user_id'] = $user_id; comm_send_to_server("SETPREFS", $data, $ok, $errors); $result = sql_query("SELECT * FROM perihelion.u_users WHERE id=" . $user_id); $_USER = sql_fetchrow($result); session_reinit($_USER); }
$errors['PARAMS'] = "Incorrect parameters specified..\n"; $data['vid'] = $vid; $data['aid'] = $aid; $data['iid'] = $iid; comm_send_to_server("CARGO2", $data, $ok, $errors); vessel_show_details($vid); } if ($cmd == "cargo") { $ok = ""; $errors['PARAMS'] = "Incorrect parameters specified..\n"; $data['vid'] = $vid; $data['pid'] = $aid; $data['sl'] = $sl; $data['pc'] = $pc; $data['sp'] = $sp; comm_send_to_server("CARGO", $data, $ok, $errors); vessel_show_details($vid); } print_footer(); exit; // ============================================================================================ // // // Description: // // // Parameters: // // // Returns: //
} } if ($cmd == "build") { $ok = ""; $errors['PARAMS'] = "Incorrect parameters specified..\n"; $errors['CREDITS'] = "You don't have enough cash to construct the building...\n"; $errors['ORE'] = "You don't have enough ores to construct the building...\n"; $errors['POWER'] = "You need more (advanced) powerplants to construct the building...\n"; $errors['MAX'] = "You cannot build anymore buildings of this type on the planet...\n"; $errors['DEPS'] = "You cannot build this building before you have build all dependencies...\n"; $errors['QUEUE'] = "Maximum number of constructions per planet reached. Wait until other buildings are finished...\n"; $errors['SCIENCE'] = "You cannot build the construction since you haven't invented it yet...\n"; $data['building_id'] = $bid; $data['anomaly_id'] = $aid; $data['user_id'] = user_ourself(); if (comm_send_to_server("BUILD", $data, $ok, $errors) == 1) { $building = building_get_building($data['bid']); echo "<br><br><br><br>"; echo "<table align=center border=0>"; echo " <tr><th>New construction in progress</th></tr>"; echo " <tr><td align=center><img align=center src=\"" . $_CONFIG['URL'] . $_GALAXY['image_dir'] . "/buildings/" . $building['image'] . ".jpg\" width=150 height=150></td></tr>"; echo "</table>"; } } print_footer(); exit; // ============================================================================================ // // // Description: //
message_show_all($uid, $bid); } if ($cmd == "post") { $ok = "Message send succesfully."; $errors['PARAMS'] = "No decent params given."; $errors['SUBJECT'] = "Please enter a subject."; $errors['LEVEL'] = "Please enter a minimum level between 0 and 99999"; $errors['MSG'] = "Cannot send an empty message."; $data['target'] = $target; $data['src_uid'] = $src_uid; $data['dst_uid'] = $dst_uid; $data['prio'] = $ne_priority; $data['level'] = $ne_level; $data['msg'] = convert_crlf_to_px_tags($ne_msg); $data['subject'] = $ne_subject; comm_send_to_server("MESSAGECREATE", $data, $ok, $errors); } if ($cmd == "createuser") { message_create($dst_uid); } if ($cmd == "creategalaxy") { message_create_galaxy(user_ourself()); } if ($cmd == "createalliance") { message_create_alliance(user_ourself()); } if ($cmd == "show") { if ($uid == "") { $uid = user_ourself(); } if ($msgbox == "") {
show_all_user_anomalies($uid); } else { show_anomaly($aid); } } if ($cmd == "claim") { if ($uid == "") { $uid = user_ourself(); } $ok = ""; $errors['PARAMS'] = "Incorrect parameters specified..\n"; $errors['NAME'] = "The anomaly name already exists.\n"; $data['anomaly_id'] = $aid; $data['user_id'] = $uid; $data['name'] = convert_crlf_to_px_tag($ne_name); comm_send_to_server("ANOMALYNAME", $data, $ok, $errors); show_anomaly($aid); } print_footer(); exit; // ============================================================================================ // // // Description: // // // Parameters: // // // Returns: //
} if (array_key_exists($tmp2s, $_REQUEST)) { $data[$tmp2] = $_REQUEST[$tmp2]; } else { $data[$tmp2] = ""; } } if (comm_send_to_server("TRADECREATE", $data, $ok, $errors) == 1) { // Make sure we move our vessel to the source planet. After this, the heartbeat deamon // takes over and start moving the vessel from source to destination and back... $vessel = vessel_get_vessel($vid); $data = ""; $data['vid'] = $vid; $data['did'] = $src_pid; $data['uid'] = $vessel['user_id']; comm_send_to_server("MOVE", $data, "", ""); print_line("Traderoute created.\n"); } } create_submenu(array("Show Traderoutes" => "trade.php?cmd=" . encrypt_get_vars("show"), "Create Traderoutes" => "trade.php?cmd=" . encrypt_get_vars("create"), "Delete Traderoutes" => "trade.php?cmd=" . encrypt_get_vars("delete"))); print_footer(); exit; // ============================================================================================ // // // Description: // // // Parameters: // //
if ($aid == "") { show_inventions(user_get_home_planet(user_ourself())); } else { show_inventions($aid); } } if ($cmd == "manufacture") { $ok = ""; $errors['PARAMS'] = "Incorrect parameters specified..\n"; $errors['CREDITS'] = "You don't have enough cash to construct the item...\n"; $errors['ORE'] = "You don't have enough ores to construct the item...\n"; $errors['MAX'] = "You cannot build anymore items of this type on the planet...\n"; $errors['DEPS'] = "You cannot build this item before you have build all dependencies...\n"; $data['anomaly_id'] = $aid; $data['item_id'] = $iid; if (comm_send_to_server("MANUFACTURE", $data, $ok, $errors) == 1) { $invention = item_get_item($data['item_id']); echo "<br><br><br><br>"; echo "<table align=center border=0>"; echo " <tr><th>New construction in progress</th></tr>"; echo " <tr><td align=center><img align=center src=\"" . $_CONFIG['URL'] . $_GALAXY['image_dir'] . "/inventions/" . $invention['image'] . ".jpg\" width=150 height=150></td></tr>"; echo "</table>"; } } print_footer(); exit; // ============================================================================================ // // // Description: //
if (!preg_match("/^\\d+\$/", $distance)) { print_line("<li><font color=red>You should enter a distance in the format ######.</font>\n"); } elseif (!preg_match("/^\\d{1,6}\$/", $angle)) { print_line("<li><font color=red>You should enter an angle in the format ######.</font>\n"); } else { if ($distance < $_GALAXY['galaxy_core']) { print_line("<li><font color=red>You cannot fly that far into the galaxy core. Try a higher distance (minimum is " . $_GALAXY['galaxy_core'] . ").</font>\n"); } elseif ($distance > $_GALAXY['galaxy_size']) { print_line("<li><font color=red>You cannot fly outside of the galaxy. Try a lower distance (maximum is " . $_GALAXY['galaxy_size'] . ").</font>\n"); } else { $ok = "Manual vessel flight engaged to " . $distance . " / " . $angle . "\n"; $errors['PARAMS'] = "Incorrect parameters specified..\n"; $data['vid'] = $vid; $data['distance'] = $distance; $data['angle'] = $angle; comm_send_to_server("MMOVE", $data, $ok, $errors); $try_again = false; } } if ($try_again == true) { select_destination($vid); } } print_footer(); exit; /* if (isset ($go)) { if (decrypt_get_vars ($_POST['did']) == "0") { $ok = "Vessel stopped at current location..\n"; } else { $ok = "Vessel flight in process..\n";