private function sendDefault() { global $USER, $PLANET, $CONF, $LNG, $UNI, $SESSION, $THEME; $adminprotection = HTTP::_GP('adminprotection', 0); $username = HTTP::_GP('username', $USER['username'], UTF8_SUPPORT); $password = HTTP::_GP('password', ''); $newpassword = HTTP::_GP('newpassword', ''); $newpassword2 = HTTP::_GP('newpassword2', ''); $email = HTTP::_GP('email', $USER['email']); $timezone = HTTP::_GP('timezone', ''); $language = HTTP::_GP('language', ''); $planetSort = HTTP::_GP('planetSort', 0); $planetOrder = HTTP::_GP('planetOrder', 0); $theme = HTTP::_GP('theme', $THEME->getThemeName()); $queueMessages = HTTP::_GP('queueMessages', 0); $spycount = HTTP::_GP('spycount', 1.0); $fblink = HTTP::_GP('fblink', ''); $fleetactions = HTTP::_GP('fleetactions', 5); $galaxySpy = HTTP::_GP('galaxySpy', 0); $galaxyMessage = HTTP::_GP('galaxyMessage', 0); $galaxyBuddyList = HTTP::_GP('galaxyBuddyList', 0); $galaxyMissle = HTTP::_GP('galaxyMissle', 0); $blockPM = HTTP::_GP('blockPM', 0); $vacation = HTTP::_GP('vacation', 0); $delete = HTTP::_GP('delete', 0); $sirena = HTTP::_GP('sirena', 0); // Vertify $adminprotection = $adminprotection == 1 && $USER['authlevel'] != AUTH_USR ? $USER['authlevel'] : 0; $spycount = min(max(round($spycount), 1), 4294967295); $fleetactions = min(max($fleetactions, 1), 99); $language = array_key_exists($language, $LNG->getAllowedLangs(false)) ? $language : $LNG->getLanguage(); $theme = array_key_exists($theme, Theme::getAvalibleSkins()) ? $theme : $THEME->getThemeName(); $SQL = ""; $redirectTo = 'game.php?page=settings'; if (!empty($username) && $USER['username'] != $username) { if (!CheckName($username)) { $this->printMessage($LNG['op_user_name_no_alphanumeric']); } elseif ($USER['uctime'] >= TIMESTAMP - USERNAME_CHANGETIME) { $this->printMessage($LNG['op_change_name_pro_week']); } else { $Count = $GLOBALS['DATABASE']->getFirstCell("SELECT (SELECT COUNT(*) FROM " . USERS . " WHERE `universe` = " . $UNI . " AND `username` = '" . $GLOBALS['DATABASE']->sql_escape($username) . "') + (SELECT COUNT(*) FROM " . USERS_VALID . " WHERE `universe` = " . $UNI . " AND `username` = '" . $GLOBALS['DATABASE']->sql_escape($username) . "')"); if (!empty($Count)) { $this->printMessage(sprintf($LNG['op_change_name_exist'], $username)); } else { $SQL .= "UPDATE " . USERS . " SET username = '******'DATABASE']->sql_escape($username) . "', uctime = " . TIMESTAMP . " WHERE id = " . $USER['id'] . ";"; $redirectTo = 'index.php'; $SESSION->DestroySession(); } } } if (!empty($newpassword) && md5($password) == $USER["password"]) { $newpass = md5($newpassword); $SQL .= "UPDATE " . USERS . " SET password = '******' WHERE id = " . $USER['id'] . ";"; $redirectTo = 'index.php'; $SESSION->DestroySession(); } if (!empty($email) && $email != $USER['email']) { if (cryptPassword($password) != $USER['password']) { $this->printMessage($LNG['op_need_pass_mail']); } elseif (!ValidateAddress($email)) { $this->printMessage($LNG['op_not_vaild_mail']); } else { $Count = $GLOBALS['DATABASE']->getFirstCell("SELECT (SELECT COUNT(*) FROM " . USERS . " WHERE id != " . $USER['id'] . " AND universe = " . $UNI . " AND (email = '" . $GLOBALS['DATABASE']->sql_escape($email) . "' OR email_2 = '" . $GLOBALS['DATABASE']->sql_escape($email) . "')) + (SELECT COUNT(*) FROM " . USERS_VALID . " WHERE universe = " . $UNI . " AND email = '" . $GLOBALS['DATABASE']->sql_escape($email) . "')"); if (!empty($Count)) { $this->printMessage(sprintf($LNG['op_change_mail_exist'], $email)); } else { $SQL .= "UPDATE " . USERS . " SET email = '" . $GLOBALS['DATABASE']->sql_escape($email) . "', setmail = " . (TIMESTAMP + 604800) . " WHERE id = " . $USER['id'] . ";"; } } } if ($vacation == 1) { if (!$this->CheckVMode()) { $this->printMessage($LNG['op_cant_activate_vacation_mode']); } else { $SQL .= "UPDATE " . USERS . " SET \n\t\t\t\t\t\t\turlaubs_modus = '1',\n\t\t\t\t\t\t\turlaubs_until = " . (TIMESTAMP + Config::get('vmode_min_time')) . "\n\t\t\t\t\t\t\tWHERE id = " . $USER["id"] . ";\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tUPDATE " . PLANETS . " SET\n\t\t\t\t\t\t\tmetal_mine_porcent = '0',\n\t\t\t\t\t\t\tcrystal_mine_porcent = '0',\n\t\t\t\t\t\t\tdeuterium_sintetizer_porcent = '0',\n\t\t\t\t\t\t\tmetal_perhour = '0',\n\t\t\t\t\t\t\tcrystal_perhour = '0',\n\t\t\t\t\t\t\tdeuterium_perhour = '0'\n\t\t\t\t\t\t\tWHERE id_owner = " . $USER["id"] . ";"; } } if ($delete == 1) { $SQL .= "UPDATE " . USERS . " SET db_deaktjava = " . TIMESTAMP . " WHERE id = " . $USER['id'] . ";"; } else { $SQL .= "UPDATE " . USERS . " SET db_deaktjava = 0 WHERE id = " . $USER['id'] . ";"; } $SQL .= "UPDATE " . USERS . " SET\n\t\t\t\t\tdpath = '" . $GLOBALS['DATABASE']->sql_escape($theme) . "',\n\t\t\t\t\ttimezone = '" . $timezone . "',\n\t\t\t\t\tplanet_sort = " . $planetSort . ",\n\t\t\t\t\tplanet_sort_order = " . $planetOrder . ",\n\t\t\t\t\tspio_anz = " . $spycount . ",\n\t\t\t\t\tfblink = '" . $fblink . "',\n\t\t\t\t\tsettings_fleetactions = " . $fleetactions . ",\n\t\t\t\t\tsettings_esp = " . $galaxySpy . ",\n\t\t\t\t\tsettings_wri = " . $galaxyMessage . ",\n\t\t\t\t\tsettings_bud = " . $galaxyBuddyList . ",\n\t\t\t\t\tsettings_mis = " . $galaxyMissle . ",\n\t\t\t\t\tsettings_blockPM = " . $blockPM . ",\n\t\t\t\t\talarm_volume = " . $sirena / 10 . ",\n\t\t\t\t\tauthattack = " . $adminprotection . ",\n\t\t\t\t\tlang = '" . $language . "',\n\t\t\t\t\thof = " . $queueMessages . "\n\t\t\t\t\tWHERE id = '" . $USER["id"] . "';"; $GLOBALS['DATABASE']->multi_query($SQL); $this->printMessage($LNG['op_options_changed']); }
private function sendDefault() { global $USER, $LNG, $THEME; $adminprotection = HTTP::_GP('adminprotection', 0); $username = HTTP::_GP('username', $USER['username'], UTF8_SUPPORT); $password = HTTP::_GP('password', ''); $newpassword = HTTP::_GP('newpassword', ''); $newpassword2 = HTTP::_GP('newpassword2', ''); $email = HTTP::_GP('email', $USER['email']); $timezone = HTTP::_GP('timezone', ''); $language = HTTP::_GP('language', ''); $planetSort = HTTP::_GP('planetSort', 0); $planetOrder = HTTP::_GP('planetOrder', 0); $theme = HTTP::_GP('theme', $THEME->getThemeName()); $queueMessages = HTTP::_GP('queueMessages', 0); $spyMessagesMode = HTTP::_GP('spyMessagesMode', 0); $spycount = HTTP::_GP('spycount', 1.0); $fleetactions = HTTP::_GP('fleetactions', 5); $galaxySpy = HTTP::_GP('galaxySpy', 0); $galaxyMessage = HTTP::_GP('galaxyMessage', 0); $galaxyBuddyList = HTTP::_GP('galaxyBuddyList', 0); $galaxyMissle = HTTP::_GP('galaxyMissle', 0); $blockPM = HTTP::_GP('blockPM', 0); $vacation = HTTP::_GP('vacation', 0); $delete = HTTP::_GP('delete', 0); // Vertify $adminprotection = $adminprotection == 1 && $USER['authlevel'] != AUTH_USR ? $USER['authlevel'] : 0; $spycount = min(max(round($spycount), 1), 4294967295); $fleetactions = min(max($fleetactions, 1), 99); $language = array_key_exists($language, $LNG->getAllowedLangs(false)) ? $language : $LNG->getLanguage(); $theme = array_key_exists($theme, Theme::getAvalibleSkins()) ? $theme : $THEME->getThemeName(); $db = Database::get(); if (!empty($username) && $USER['username'] != $username) { if (PlayerUtil::isNameValid($username)) { $this->printMessage($LNG['op_user_name_no_alphanumeric'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=settings'))); } elseif ($USER['uctime'] >= TIMESTAMP - USERNAME_CHANGETIME) { $this->printMessage($LNG['op_change_name_pro_week'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=settings'))); } else { $sql = "SELECT\n\t\t\t\t\t(SELECT COUNT(*) FROM %%USERS%% WHERE universe = :universe AND username = :username) +\n\t\t\t\t\t(SELECT COUNT(*) FROM %%USERS_VALID%% WHERE universe = :universe AND username = :username)\n\t\t\t\tAS count"; $Count = $db->selectSingle($sql, array(':universe' => Universe::current(), ':username' => $username), 'count'); if (!empty($Count)) { $this->printMessage(sprintf($LNG['op_change_name_exist'], $username), array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=settings'))); } else { $sql = "UPDATE %%USERS%% SET username = :username, uctime = :timestampt WHERE id = :userID;"; $db->update($sql, array(':username' => $username, ':userID' => $USER['id'], ':timestamp' => TIMESTAMP)); Session::load()->delete(); } } } if (!empty($newpassword) && PlayerUtil::cryptPassword($password) == $USER["password"] && $newpassword == $newpassword2) { $newpass = PlayerUtil::cryptPassword($newpassword); $sql = "UPDATE %%USERS%% SET password = :newpass WHERE id = :userID;"; $db->update($sql, array(':newpass' => $newpass, ':userID' => $USER['id'])); Session::load()->delete(); } if (!empty($email) && $email != $USER['email']) { if (PlayerUtil::cryptPassword($password) != $USER['password']) { $this->printMessage($LNG['op_need_pass_mail'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=settings'))); } elseif (!ValidateAddress($email)) { $this->printMessage($LNG['op_not_vaild_mail'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=settings'))); } else { $sql = "SELECT\n\t\t\t\t\t\t\t(SELECT COUNT(*) FROM %%USERS%% WHERE id != :userID AND universe = :universe AND (email = :email OR email_2 = :email)) +\n\t\t\t\t\t\t\t(SELECT COUNT(*) FROM %%USERS_VALID%% WHERE universe = :universe AND email = :email)\n\t\t\t\t\t\tas COUNT"; $Count = $db->selectSingle($sql, array(':universe' => Universe::current(), ':userID' => $USER['id'], ':email' => $email), 'count'); if (!empty($Count)) { $this->printMessage(sprintf($LNG['op_change_mail_exist'], $email), array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=settings'))); } else { $sql = "UPDATE %%USERS%% SET email = :email, setmail = :time WHERE id = :userID;"; $db->update($sql, array(':email' => $email, ':time' => TIMESTAMP + 604800, ':userID' => $USER['id'])); } } } if ($vacation == 1) { if (!$this->CheckVMode()) { $this->printMessage($LNG['op_cant_activate_vacation_mode'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=settings'))); } else { $sql = "UPDATE %%USERS%% SET urlaubs_modus = '1', urlaubs_until = :time WHERE id = :userID"; $db->update($sql, array(':userID' => $USER['id'], ':time' => TIMESTAMP + Config::get()->vmode_min_time)); $sql = "UPDATE %%PLANETS%% SET energy_used = '0', energy = '0', metal_mine_porcent = '0', crystal_mine_porcent = '0', deuterium_sintetizer_porcent = '0', solar_plant_porcent = '0', fusion_plant_porcent = '0', solar_satelit_porcent = '0', metal_perhour = '0', crystal_perhour = '0', deuterium_perhour = '0' WHERE id_owner = :userID;"; $db->update($sql, array(':userID' => $USER['id'])); } } if ($delete == 1) { $sql = "UPDATE %%USERS%% SET db_deaktjava = :timestamp WHERE id = :userID;"; $db->update($sql, array(':userID' => $USER['id'], ':timestamp' => TIMESTAMP)); } else { $sql = "UPDATE %%USERS%% SET db_deaktjava = 0 WHERE id = :userID;"; $db->update($sql, array(':userID' => $USER['id'])); } $sql = "UPDATE %%USERS%% SET\n\t\tdpath\t\t\t\t\t= :theme,\n\t\ttimezone\t\t\t\t= :timezone,\n\t\tplanet_sort\t\t\t\t= :planetSort,\n\t\tplanet_sort_order\t\t= :planetOrder,\n\t\tspio_anz\t\t\t\t= :spyCount,\n\t\tsettings_fleetactions\t= :fleetActions,\n\t\tsettings_esp\t\t\t= :galaxySpy,\n\t\tsettings_wri\t\t\t= :galaxyMessage,\n\t\tsettings_bud\t\t\t= :galaxyBuddyList,\n\t\tsettings_mis\t\t\t= :galaxyMissle,\n\t\tsettings_blockPM\t\t= :blockPM,\n\t\tauthattack\t\t\t\t= :adminProtection,\n\t\tlang\t\t\t\t\t= :language,\n\t\thof\t\t\t\t\t\t= :queueMessages,\n\t\tspyMessagesMode\t\t\t= :spyMessagesMode\n\t\tWHERE id = :userID;"; $db->update($sql, array(':theme' => $theme, ':timezone' => $timezone, ':planetSort' => $planetSort, ':planetOrder' => $planetOrder, ':spyCount' => $spycount, ':fleetActions' => $fleetactions, ':galaxySpy' => $galaxySpy, ':galaxyMessage' => $galaxyMessage, ':galaxyBuddyList' => $galaxyBuddyList, ':galaxyMissle' => $galaxyMissle, ':blockPM' => $blockPM, ':adminProtection' => $adminprotection, ':language' => $language, ':queueMessages' => $queueMessages, ':spyMessagesMode' => $spyMessagesMode, ':userID' => $USER['id'])); $this->printMessage($LNG['op_options_changed'], array(array('label' => $LNG['sys_forward'], 'url' => 'game.php?page=settings'))); }
function ShowCreatorPage() { global $LNG, $USER, $UNI, $CONF; $template = new template(); switch ($_GET['mode']) { case 'user': $LNG->includeData(array('PUBLIC')); if ($_POST) { $UserName = HTTP::_GP('name', '', UTF8_SUPPORT); $UserPass = HTTP::_GP('password', ''); $UserPass2 = HTTP::_GP('password2', ''); $UserMail = HTTP::_GP('email', ''); $UserMail2 = HTTP::_GP('email2', ''); $UserLang = HTTP::_GP('lang', ''); $UserAuth = HTTP::_GP('authlevel', 0); $Galaxy = HTTP::_GP('galaxy', 0); $System = HTTP::_GP('system', 0); $Planet = HTTP::_GP('planet', 0); $ExistsUser = $GLOBALS['DATABASE']->getFirstCell("SELECT (SELECT COUNT(*) FROM " . USERS . " WHERE universe = " . $_SESSION['adminuni'] . " AND username = '******'DATABASE']->sql_escape($UserName) . "') + (SELECT COUNT(*) FROM " . USERS_VALID . " WHERE universe = " . $_SESSION['adminuni'] . " AND username = '******'DATABASE']->sql_escape($UserName) . "')"); $ExistsMails = $GLOBALS['DATABASE']->getFirstCell("SELECT (SELECT COUNT(*) FROM " . USERS . " WHERE universe = " . $_SESSION['adminuni'] . " AND (email = '" . $GLOBALS['DATABASE']->sql_escape($UserMail) . "' OR email_2 = '" . $GLOBALS['DATABASE']->sql_escape($UserMail) . "')) + (SELECT COUNT(*) FROM " . USERS_VALID . " WHERE universe = " . $_SESSION['adminuni'] . " AND email = '" . $GLOBALS['DATABASE']->sql_escape($UserMail) . "')"); if (!ValidateAddress($UserMail)) { $errors .= $LNG['invalid_mail_adress']; } if (empty($UserName)) { $errors .= $LNG['empty_user_field']; } if (strlen($UserPass) < 6) { $errors .= $LNG['password_lenght_error']; } if ($UserPass != $UserPass2) { $errors .= $LNG['different_passwords']; } if ($UserMail != $UserMail2) { $errors .= $LNG['different_mails']; } if (!CheckName($UserName)) { $errors .= $LNG['user_field_specialchar']; } if ($ExistsUser != 0) { $errors .= $LNG['user_already_exists']; } if ($ExistsMails != 0) { $errors .= $LNG['mail_already_exists']; } if (CheckPlanetIfExist($Galaxy, $System, $Planet, $_SESSION['adminuni'])) { $errors .= $LNG['planet_already_exists']; } if ($Galaxy > Config::get('max_galaxy') || $System > Config::get('max_system') || $Planet > Config::get('max_planets')) { $errors .= $LNG['po_complete_all2']; } if (!empty($errors)) { $template->message($errors, '?page=create&mode=user', 10, true); exit; } $SQL = "INSERT INTO " . USERS . " SET\n\t\t\t\tusername\t\t= '" . $GLOBALS['DATABASE']->sql_escape($UserName) . "',\n\t\t\t\tpassword\t\t= '" . cryptPassword($UserPass) . "',\n\t\t\t\temail\t\t\t= '" . $GLOBALS['DATABASE']->sql_escape($UserMail) . "',\n\t\t\t\temail_2\t\t\t= '" . $GLOBALS['DATABASE']->sql_escape($UserMail) . "',\n\t\t\t\tlang\t\t\t= '" . $GLOBALS['DATABASE']->sql_escape($UserLang) . "',\n\t\t\t\tauthlevel\t\t= " . $UserAuth . ",\n\t\t\t\tip_at_reg\t\t= '" . $_SERVER['REMOTE_ADDR'] . "',\n\t\t\t\tid_planet\t\t= 0,\n\t\t\t\tuniverse\t\t= " . $_SESSION['adminuni'] . ",\n\t\t\t\tonlinetime\t\t= " . TIMESTAMP . ",\n\t\t\t\tregister_time\t= " . TIMESTAMP . ",\n\t\t\t\tdpath\t\t\t= '" . DEFAULT_THEME . "',\n\t\t\t\ttimezone\t\t= '" . Config::get('timezone') . "',\n\t\t\t\tuctime\t\t\t= 0;"; $GLOBALS['DATABASE']->query($SQL); $UserID = $GLOBALS['DATABASE']->GetInsertID(); require_once 'includes/functions/CreateOnePlanetRecord.php'; $PlanerID = CreateOnePlanetRecord($Galaxy, $System, $Planet, $_SESSION['adminuni'], $UserID, $LNG['fcm_planet'], true, $UserAuth); $SQL = "UPDATE " . USERS . " SET \n\t\t\t\tid_planet\t= " . $PlanerID . ",\n\t\t\t\tgalaxy\t\t= " . $Galaxy . ",\n\t\t\t\tsystem\t\t= " . $System . ",\n\t\t\t\tplanet\t\t= " . $Planet . "\n\t\t\t\tWHERE\n\t\t\t\tid\t\t\t= " . $UserID . ";\n\t\t\t\tINSERT INTO " . STATPOINTS . " SET \n\t\t\t\tid_owner\t= " . $UserID . ",\n\t\t\t\tuniverse\t= " . $_SESSION['adminuni'] . ",\n\t\t\t\tstat_type\t= 1,\n\t\t\t\ttech_rank\t= " . (Config::get('users_amount') + 1) . ",\n\t\t\t\tbuild_rank\t= " . (Config::get('users_amount') + 1) . ",\n\t\t\t\tdefs_rank\t= " . (Config::get('users_amount') + 1) . ",\n\t\t\t\tfleet_rank\t= " . (Config::get('users_amount') + 1) . ",\n\t\t\t\ttotal_rank\t= " . (Config::get('users_amount') + 1) . ";"; $GLOBALS['DATABASE']->multi_query($SQL); Config::update(array('users_amount' => Config::get('users_amount') + 1)); $template->message($LNG['new_user_success'], '?page=create&mode=user', 5, true); exit; } $AUTH = array(); $AUTH[AUTH_USR] = $LNG['user_level'][AUTH_USR]; if ($USER['authlevel'] >= AUTH_OPS) { $AUTH[AUTH_OPS] = $LNG['user_level'][AUTH_OPS]; } if ($USER['authlevel'] >= AUTH_MOD) { $AUTH[AUTH_MOD] = $LNG['user_level'][AUTH_MOD]; } if ($USER['authlevel'] >= AUTH_ADM) { $AUTH[AUTH_ADM] = $LNG['user_level'][AUTH_ADM]; } $template->assign_vars(array('admin_auth' => $USER['authlevel'], 'new_add_user' => $LNG['new_add_user'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'new_creator_go_back' => $LNG['new_creator_go_back'], 'universe' => $LNG['mu_universe'], 'user_reg' => $LNG['user_reg'], 'pass_reg' => $LNG['pass_reg'], 'pass2_reg' => $LNG['pass2_reg'], 'email_reg' => $LNG['email_reg'], 'email2_reg' => $LNG['email2_reg'], 'new_coord' => $LNG['new_coord'], 'new_range' => $LNG['new_range'], 'lang_reg' => $LNG['lang_reg'], 'new_title' => $LNG['new_title'], 'Selector' => array('auth' => $AUTH, 'lang' => $LNG->getAllowedLangs(false)))); $template->show('CreatePageUser.tpl'); break; case 'moon': if ($_POST) { $PlanetID = HTTP::_GP('add_moon', 0); $MoonName = HTTP::_GP('name', '', UTF8_SUPPORT); $Diameter = HTTP::_GP('diameter', 0); $FieldMax = HTTP::_GP('field_max', 0); $MoonPlanet = $GLOBALS['DATABASE']->getFirstRow("SELECT temp_max, temp_min, id_luna, galaxy, system, planet, planet_type, destruyed, id_owner FROM " . PLANETS . " WHERE id = '" . $PlanetID . "' AND universe = '" . $_SESSION['adminuni'] . "' AND planet_type = '1' AND destruyed = '0';"); if (!isset($MoonPlanet)) { $template->message($LNG['mo_planet_doesnt_exist'], '?page=create&mode=moon', 3, true); exit; } require_once 'includes/functions/CreateOneMoonRecord.php'; if (empty($MoonName)) { $MoonName = $LNG['type_planet'][3]; } if (CreateOneMoonRecord($MoonPlanet['galaxy'], $MoonPlanet['system'], $MoonPlanet['planet'], $_SESSION['adminuni'], $MoonPlanet['id_owner'], $MoonName, 20, TIMESTAMP, $_POST['diameter_check'] == 'on' ? 0 : $Diameter) !== false) { $template->message($LNG['mo_moon_added'], '?page=create&mode=moon', 3, true); } else { $template->message($LNG['mo_moon_unavaible'], '?page=create&mode=moon', 3, true); } exit; } $template->assign_vars(array('admin_auth' => $USER['authlevel'], 'universum' => $LNG['mu_universe'], 'po_add_moon' => $LNG['po_add_moon'], 'input_id_planet' => $LNG['input_id_planet'], 'mo_moon_name' => $LNG['mo_moon_name'], 'mo_diameter' => $LNG['mo_diameter'], 'mo_temperature' => $LNG['mo_temperature'], 'mo_fields_avaibles' => $LNG['mo_fields_avaibles'], 'button_add' => $LNG['button_add'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'mo_moon' => $LNG['fcm_moon'], 'new_creator_go_back' => $LNG['new_creator_go_back'])); $template->show('CreatePageMoon.tpl'); break; case 'planet': if ($_POST) { $id = HTTP::_GP('id', 0); $Galaxy = HTTP::_GP('galaxy', 0); $System = HTTP::_GP('system', 0); $Planet = HTTP::_GP('planet', 0); $name = HTTP::_GP('name', '', UTF8_SUPPORT); $field_max = HTTP::_GP('field_max', 0); if ($Galaxy > Config::get('max_galaxy') || $System > Config::get('max_system') || $Planet > Config::get('max_planets')) { $template->message($LNG['po_complete_all2'], '?page=create&mode=planet', 3, true); exit; } $ISUser = $GLOBALS['DATABASE']->getFirstRow("SELECT id, authlevel FROM " . USERS . " WHERE id = '" . $id . "' AND universe = '" . $_SESSION['adminuni'] . "';"); if (CheckPlanetIfExist($Galaxy, $System, $Planet, $_SESSION['adminuni']) || !isset($ISUser)) { $template->message($LNG['po_complete_all'], '?page=create&mode=planet', 3, true); exit; } require_once 'includes/functions/CreateOnePlanetRecord.php'; CreateOnePlanetRecord($Galaxy, $System, $Planet, $_SESSION['adminuni'], $id, '', '', false); $SQL = "UPDATE " . PLANETS . " SET "; if ($_POST['diameter_check'] != 'on' || $field_max > 0) { $SQL .= "field_max = '" . $field_max . "' "; } if (!empty($name)) { $SQL .= ", name = '" . $GLOBALS['DATABASE']->sql_escape($name) . "' "; } $SQL .= "WHERE "; $SQL .= "universe = '" . $_SESSION['adminuni'] . "' AND "; $SQL .= "galaxy = '" . $Galaxy . "' AND "; $SQL .= "system = '" . $System . "' AND "; $SQL .= "planet = '" . $Planet . "' AND "; $SQL .= "planet_type = '1'"; $GLOBALS['DATABASE']->query($SQL); $template->message($LNG['po_complete_succes'], '?page=create&mode=planet', 3, true); exit; } $Query = $GLOBALS['DATABASE']->query("SELECT uni, game_name FROM " . CONFIG . " ORDER BY uni ASC;"); while ($Unis = $GLOBALS['DATABASE']->fetch_array($Query)) { $AvailableUnis[$Unis['uni']] = $Unis; } $template->assign_vars(array('AvailableUnis' => $AvailableUnis, 'admin_auth' => $USER['authlevel'], 'universum' => $LNG['mu_universe'], 'po_add_planet' => $LNG['po_add_planet'], 'po_galaxy' => $LNG['po_galaxy'], 'po_system' => $LNG['po_system'], 'po_planet' => $LNG['po_planet'], 'input_id_user' => $LNG['input_id_user'], 'new_creator_coor' => $LNG['new_creator_coor'], 'po_name_planet' => $LNG['po_name_planet'], 'po_fields_max' => $LNG['po_fields_max'], 'button_add' => $LNG['button_add'], 'po_colony' => $LNG['fcp_colony'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'new_creator_go_back' => $LNG['new_creator_go_back'])); $template->show('CreatePagePlanet.tpl'); break; default: $template->assign_vars(array('new_creator_title_u' => $LNG['new_creator_title_u'], 'new_creator_title_p' => $LNG['new_creator_title_p'], 'new_creator_title_l' => $LNG['new_creator_title_l'], 'new_creator_title' => $LNG['new_creator_title'])); $template->show('CreatePage.tpl'); break; } }
$UserName = request_var('character', '', UTF8_SUPPORT); $UserPlanet = request_var('planet', '', UTF8_SUPPORT); $UserEmail = request_var('email', ''); $UserEmail2 = request_var('email2', ''); $agbrules = request_var('rgt', ''); $UserLang = request_var('lang', ''); if ($CONF['capaktiv'] === '1') { require_once 'includes/libs/reCAPTCHA/recaptchalib.php'; $resp = recaptcha_check_answer($CONF['capprivate'], $_SERVER['REMOTE_ADDR'], $_REQUEST['recaptcha_challenge_field'], $_REQUEST['recaptcha_response_field']); if (!$resp->is_valid) { $errors .= $LNG['wrong_captcha']; } } $Exist['userv'] = $db->uniquequery("SELECT username, email FROM " . USERS . " WHERE username = '******' OR email = '" . $db->sql_escape($UserEmail) . "';"); $Exist['valid'] = $db->uniquequery("SELECT username, email FROM " . USERS_VALID . " WHERE username = '******' OR email = '" . $db->sql_escape($UserEmail) . "';"); if (!ValidateAddress($UserEmail)) { $errors .= $LNG['invalid_mail_adress']; } if (empty($UserName)) { $errors .= $LNG['empty_user_field']; } if (empty($UserPlanet)) { $errors .= $LNG['empty_planet_field']; } if (!isset($UserPass[5])) { $errors .= $LNG['password_lenght_error']; } if ($UserPass != $UserPass2) { $errors .= $LNG['different_passwords']; } if ($UserEmail != $UserEmail2) {
public function __construct() { global $USER, $PLANET, $CONF, $LNG, $LANG, $UNI, $db, $SESSION, $THEME; $mode = request_var('mode', ''); $exit = request_var('exit_modus', ''); $db_deaktjava = request_var('db_deaktjava', ''); $PlanetRess = new ResourceUpdate(); $PlanetRess->CalcResource(); $PlanetRess->SavePlanetToDB(); $template = new template(); $SQLQuery = ""; switch ($mode) { case "exit": if ($exit == 'on' and $USER['urlaubs_until'] <= TIMESTAMP) { $SQLQuery .= "UPDATE " . USERS . " SET `urlaubs_modus` = '0', `urlaubs_until` = '0' WHERE `id` = '" . $USER['id'] . "' LIMIT 1;UPDATE " . PLANETS . " SET `last_update` = '" . TIMESTAMP . "', `energy_used` = '10', `energy_max` = '10', `metal_mine_porcent` = '10', `crystal_mine_porcent` = '10', `deuterium_sintetizer_porcent` = '10', `solar_plant_porcent` = '10', `fusion_plant_porcent` = '10', `solar_satelit_porcent` = '10' WHERE `id_owner` = '" . $USER["id"] . "';"; } $SQLQuery .= $db_deaktjava == 'on' ? "UPDATE " . USERS . " SET `db_deaktjava` = '" . TIMESTAMP . "' WHERE `id` = '" . $USER['id'] . "' LIMIT 1;" : "UPDATE " . USERS . " SET `db_deaktjava` = '0' WHERE `id` = '" . $USER['id'] . "' LIMIT 1;"; $db->multi_query($SQLQuery); $template->message($LNG['op_options_changed'], '?page=options', 1); break; case "change": $design = request_var('design', ''); $noipcheck = request_var('noipcheck', ''); $USERname = request_var('db_character', $USER['username'], UTF8_SUPPORT); $db_email = request_var('db_email', $USER['email']); $spio_anz = max(request_var('spio_anz', 5), 1); $settings_tooltiptime = request_var('settings_tooltiptime', 1); $settings_fleetactions = max(request_var('settings_fleetactions', 1), 1); $settings_planetmenu = request_var('settings_planetmenu', ''); $settings_esp = request_var('settings_esp', ''); $settings_wri = request_var('settings_wri', ''); $settings_bud = request_var('settings_bud', ''); $settings_mis = request_var('settings_mis', ''); $settings_rep = request_var('settings_rep', ''); $settings_tnstor = request_var('settings_tnstor', ''); $urlaubs_modus = request_var('urlaubs_modus', ''); $SetSort = request_var('settings_sort', 0); $SetOrder = request_var('settings_order', 0); $db_password = request_var('db_password', ''); $newpass1 = request_var('newpass1', ''); $newpass2 = request_var('newpass2', ''); $hof = request_var('hof', ''); $adm_pl_prot = request_var('adm_pl_prot', ''); $langs = request_var('langs', $LANG->getUser()); $dpath = request_var('dpath', $THEME->getThemeName()); $design = $design == 'on' ? 1 : 0; $hof = $hof == 'on' ? 1 : 0; $noipcheck = $noipcheck == 'on' ? 1 : 0; $settings_esp = $settings_esp == 'on' ? 1 : 0; $settings_wri = $settings_wri == 'on' ? 1 : 0; $settings_bud = $settings_bud == 'on' ? 1 : 0; $settings_mis = $settings_mis == 'on' ? 1 : 0; $settings_rep = $settings_rep == 'on' ? 1 : 0; $settings_tnstor = $settings_tnstor == 'on' ? 1 : 0; $settings_planetmenu = $settings_planetmenu == 'on' ? 1 : 0; $db_deaktjava = $db_deaktjava == 'on' ? TIMESTAMP : 0; $langs = in_array($langs, $LANG->getAllowedLangs()) ? $langs : $LANG->getUser(); $dpath = in_array($dpath, Theme::getAvalibleSkins()) ? $dpath : $THEME->getThemeName(); if ($urlaubs_modus == 'on') { if (!$this->CheckVMode()) { $template->message($LNG['op_cant_activate_vacation_mode'], '?page=options', 3); exit; } $SQLQuery .= "UPDATE " . USERS . " SET \r\n\t\t\t\t\t\t\t\t\t`urlaubs_modus` = '1',\r\n\t\t\t\t\t\t\t\t\t`urlaubs_until` = '" . (TIMESTAMP + VACATION_MIN_TIME) . "'\r\n\t\t\t\t\t\t\t\t\tWHERE `id` = '" . $USER["id"] . "';\r\n\t\t\t\t\t\t\t\t\tUPDATE " . PLANETS . " SET\r\n\t\t\t\t\t\t\t\t\t`energy_used` = '0',\r\n\t\t\t\t\t\t\t\t\t`energy_max` = '0',\r\n\t\t\t\t\t\t\t\t\t`metal_mine_porcent` = '0',\r\n\t\t\t\t\t\t\t\t\t`crystal_mine_porcent` = '0',\r\n\t\t\t\t\t\t\t\t\t`deuterium_sintetizer_porcent` = '0',\r\n\t\t\t\t\t\t\t\t\t`solar_plant_porcent` = '0',\r\n\t\t\t\t\t\t\t\t\t`fusion_plant_porcent` = '0',\r\n\t\t\t\t\t\t\t\t\t`solar_satelit_porcent` = '0',\r\n\t\t\t\t\t\t\t\t\t`metal_perhour` = '0',\r\n `crystal_perhour` = '0',\r\n `deuterium_perhour` = '0'\r\n WHERE `id_owner` = '" . $USER["id"] . "';"; } $SQLQuery .= "UPDATE " . USERS . " SET\r\n\t\t\t\t\t\t\t\t`dpath` = '" . $db->sql_escape($dpath) . "',\r\n\t\t\t\t\t\t\t\t`design` = '" . $design . "',\r\n\t\t\t\t\t\t\t\t`noipcheck` = '" . $noipcheck . "',\r\n\t\t\t\t\t\t\t\t`planet_sort` = '" . $SetSort . "',\r\n\t\t\t\t\t\t\t\t`planet_sort_order` = '" . $SetOrder . "',\r\n\t\t\t\t\t\t\t\t`spio_anz` = '" . $spio_anz . "',\r\n\t\t\t\t\t\t\t\t`settings_tooltiptime` = '" . $settings_tooltiptime . "',\r\n\t\t\t\t\t\t\t\t`settings_fleetactions` = '" . $settings_fleetactions . "',\r\n\t\t\t\t\t\t\t\t`settings_planetmenu` = '" . $settings_planetmenu . "',\r\n\t\t\t\t\t\t\t\t`settings_esp` = '" . $settings_esp . "',\r\n\t\t\t\t\t\t\t\t`settings_wri` = '" . $settings_wri . "',\r\n\t\t\t\t\t\t\t\t`settings_bud` = '" . $settings_bud . "',\r\n\t\t\t\t\t\t\t\t`settings_mis` = '" . $settings_mis . "',\r\n\t\t\t\t\t\t\t\t`settings_tnstor` = '" . $settings_tnstor . "',\r\n\t\t\t\t\t\t\t\t`db_deaktjava` = '" . $db_deaktjava . "',\r\n\t\t\t\t\t\t\t\t`lang` = '" . $langs . "',\r\n\t\t\t\t\t\t\t\t`hof` = '" . $hof . "',\r\n\t\t\t\t\t\t\t\t`settings_rep` = '" . $settings_rep . "' \r\n\t\t\t\t\t\t\t\tWHERE `id` = '" . $USER["id"] . "';"; if ($USER['authlevel'] > 0) { $SQLQuery .= $adm_pl_prot == 'on' ? "UPDATE " . PLANETS . " SET `id_level` = '" . $USER['authlevel'] . "' WHERE `id_owner` = '" . $USER['id'] . "';" : "UPDATE " . PLANETS . " SET `id_level` = '0' WHERE `id_owner` = '" . $USER['id'] . "';"; } if (!empty($db_email) && $db_email != $USER['email'] && md5($db_password) == $USER['password']) { if (!ValidateAddress($db_email)) { $template->message($LNG['op_not_vaild_mail'], '?page=options', 3); exit; } $query = $db->uniquequery("SELECT id FROM " . USERS . " WHERE email = '" . $db->sql_escape($db_email) . "' OR email_2 = '" . $db->sql_escape($db_email) . "';"); if (!empty($query)) { $template->message(sprintf($LNG['op_change_mail_exist'], $db_email), '?page=options', 3); exit; } $SQLQuery .= "UPDATE " . USERS . " SET `email` = '" . $db->sql_escape($db_email) . "', `setmail` = '" . (TIMESTAMP + 604800) . "' WHERE `id` = '" . $USER['id'] . "';"; } if (!empty($newpass1) && md5($db_password) == $USER["password"] && $newpass1 == $newpass2) { $newpass = md5($newpass1); $SQLQuery .= "UPDATE " . USERS . " SET `password` = '" . $newpass . "' WHERE `id` = '" . $USER['id'] . "';"; $SESSION->DestroySession(); $template->message($LNG['op_password_changed'], "index.php", 3); } elseif ($USER['username'] != $USERname) { if (!CheckName($USERname)) { $template->message($LNG['op_user_name_no_alphanumeric'], '?page=options', 3); } elseif ($USER['uctime'] >= TIMESTAMP - 60 * 60 * 24 * 7) { $template->message($LNG['op_change_name_pro_week'], '?page=options', 3); } else { $query = $db->uniquequery("SELECT id FROM " . USERS . " WHERE username='******';"); if (!empty($query)) { $template->message(sprintf($LNG['op_change_name_exist'], $USERname), '?page=options', 3); } else { require ROOT_PATH . 'includes/classes/class.Records.php'; $Records = new records(); $RecordsArray = $Records->RenameRecordOwner($USER['username'], $USERname, $UNI); $SQLQuery .= "UPDATE " . USERS . " SET `username` = '" . $db->sql_escape($USERname) . "', `uctime` = '" . TIMESTAMP . "' WHERE `id`= '" . $USER['id'] . "';"; $SESSION->DestroySession(); $template->message($LNG['op_username_changed'], 'index.php', 3); } } } else { $template->message($LNG['op_options_changed'], '?page=options', 3); } $db->multi_query($SQLQuery); break; default: if ($USER['urlaubs_modus'] == 1) { $template->assign_vars(array('vacation_until' => date(TDFORMAT, $USER['urlaubs_until']), 'op_save_changes' => $LNG['op_save_changes'], 'op_end_vacation_mode' => $LNG['op_end_vacation_mode'], 'op_vacation_mode_active_message' => $LNG['op_vacation_mode_active_message'], 'op_dlte_account_descrip' => $LNG['op_dlte_account_descrip'], 'op_dlte_account' => $LNG['op_dlte_account'], 'opt_delac_data' => $USER['db_deaktjava'], 'is_deak_vacation' => $USER['urlaubs_until'] <= TIMESTAMP ? true : false)); $template->show("options_overview_vmode.tpl"); } else { $template->assign_vars(array('opt_usern_data' => $USER['username'], 'opt_mail1_data' => $USER['email'], 'opt_mail2_data' => $USER['email_2'], 'opt_dpath_data' => $USER['dpath'], 'opt_dpath_data_sel' => substr($USER['dpath'], 13, -1), 'opt_probe_data' => $USER['spio_anz'], 'opt_toolt_data' => $USER['settings_tooltiptime'], 'opt_fleet_data' => $USER['settings_fleetactions'], 'opt_sskin_data' => $USER['design'], 'opt_noipc_data' => $USER['noipcheck'], 'opt_allyl_data' => $USER['settings_planetmenu'], 'opt_delac_data' => $USER['db_deaktjava'], 'opt_stor_data' => $USER['settings_tnstor'], 'user_settings_rep' => $USER['settings_rep'], 'user_settings_esp' => $USER['settings_esp'], 'user_settings_wri' => $USER['settings_wri'], 'user_settings_mis' => $USER['settings_mis'], 'user_settings_bud' => $USER['settings_bud'], 'opt_hof' => $USER['hof'], 'langs' => $USER['lang'], 'adm_pl_prot_data' => $PLANET['id_level'], 'user_authlevel' => $USER['authlevel'], 'Selectors' => array('Sort' => array(0 => $LNG['op_sort_normal'], 1 => $LNG['op_sort_koords'], 2 => $LNG['op_sort_abc']), 'SortUpDown' => array(0 => $LNG['op_sort_up'], 1 => $LNG['op_sort_down']), 'Skins' => Theme::getAvalibleSkins(), 'lang' => $LANG->getAllowedLangs(false)), 'planet_sort' => $USER['planet_sort'], 'planet_sort_order' => $USER['planet_sort_order'], 'uctime' => TIMESTAMP - $USER['uctime'] >= 60 * 60 * 24 * 7 ? true : false, 'op_admin_planets_protection' => $LNG['op_admin_planets_protection'], 'op_admin_title_options' => $LNG['op_admin_title_options'], 'op_user_data' => $LNG['op_user_data'], 'op_username' => $LNG['op_username'], 'op_old_pass' => $LNG['op_old_pass'], 'op_new_pass' => $LNG['op_new_pass'], 'op_repeat_new_pass' => $LNG['op_repeat_new_pass'], 'op_email_adress_descrip' => $LNG['op_email_adress_descrip'], 'op_email_adress' => $LNG['op_email_adress'], 'op_permanent_email_adress' => $LNG['op_permanent_email_adress'], 'op_general_settings' => $LNG['op_general_settings'], 'op_lang' => $LNG['op_lang'], 'op_sort_planets_by' => $LNG['op_sort_planets_by'], 'op_sort_kind' => $LNG['op_sort_kind'], 'op_skin_example' => $LNG['op_skin_example'], 'op_show_skin' => $LNG['op_show_skin'], 'op_active_build_messages' => $LNG['op_active_build_messages'], 'op_deactivate_ipcheck_descrip' => $LNG['op_deactivate_ipcheck_descrip'], 'op_deactivate_ipcheck' => $LNG['op_deactivate_ipcheck'], 'op_galaxy_settings' => $LNG['op_galaxy_settings'], 'op_spy_probes_number_descrip' => $LNG['op_spy_probes_number_descrip'], 'op_spy_probes_number' => $LNG['op_spy_probes_number'], 'op_seconds' => $LNG['op_seconds'], 'op_toolt_data' => $LNG['op_toolt_data'], 'op_max_fleets_messages' => $LNG['op_max_fleets_messages'], 'op_show_planetmenu' => $LNG['op_show_planetmenu'], 'op_shortcut' => $LNG['op_shortcut'], 'op_show' => $LNG['op_show'], 'op_spy' => $LNG['op_spy'], 'op_write_message' => $LNG['op_write_message'], 'op_add_to_buddy_list' => $LNG['op_add_to_buddy_list'], 'op_missile_attack' => $LNG['op_missile_attack'], 'op_send_report' => $LNG['op_send_report'], 'op_vacation_delete_mode' => $LNG['op_vacation_delete_mode'], 'op_activate_vacation_mode_descrip' => $LNG['op_activate_vacation_mode_descrip'], 'op_activate_vacation_mode' => $LNG['op_activate_vacation_mode'], 'op_dlte_account_descrip' => $LNG['op_dlte_account_descrip'], 'op_dlte_account' => $LNG['op_dlte_account'], 'op_save_changes' => $LNG['op_save_changes'], 'op_small_storage' => $LNG['op_small_storage'])); $template->show("options_overview.tpl"); } break; } }
function ShowCreatorPage() { global $LNG, $db, $USER; $template = new template(); $template->page_header(); switch ($_GET['mode']) { case 'user': includeLang('PUBLIC'); if ($_POST) { $UserName = request_var('name', '', UTF8_SUPPORT); $UserPass = request_var('password', ''); $UserPass2 = request_var('password2', ''); $UserMail = request_var('email', ''); $UserMail2 = request_var('email2', ''); $UserLang = request_var('lang', ''); $UserAuth = request_var('authlevel', 0); $Galaxy = request_var('galaxy', 0); $System = request_var('system', 0); $Planet = request_var('planet', 0); if ($CONF['capaktiv'] === '1') { require_once 'includes/libs/reCAPTCHA/recaptchalib.php'; $resp = recaptcha_check_answer($CONF['capprivate'], $_SERVER['REMOTE_ADDR'], request_var('recaptcha_challenge_field', ''), request_var('recaptcha_response_field', '')); if (!$resp->is_valid) { $errorlist .= $LNG['wrong_captcha']; } } $Exist['userv'] = $db->uniquequery("SELECT username, email FROM " . USERS . " WHERE username = '******' OR email = '" . $db->sql_escape($UserEmail) . "';"); $Exist['vaild'] = $db->uniquequery("SELECT username, email FROM " . USERS_VALID . " WHERE username = '******' OR email = '" . $db->sql_escape($UserEmail) . "';"); if (!ValidateAddress($UserMail)) { $errors .= $LNG['invalid_mail_adress']; } if (empty($UserName)) { $errors .= $LNG['empty_user_field']; } if (strlen($UserPass) < 6) { $errors .= $LNG['password_lenght_error']; } if ($UserPass != $UserPass2) { $errors .= $LNG['different_passwords']; } if ($UserMail != $UserMail2) { $errors .= $LNG['different_mails']; } if (!CheckName($UserName)) { $errors .= UTF8_SUPPORT ? $LNG['user_field_no_space'] : $LNG['user_field_no_alphanumeric']; } if (isset($Exist['userv']['username']) || isset($Exist['vaild']['username']) && ($UserName == $Exist['userv']['username'] || $UserName == $Exist['vaild']['username'])) { $errors .= $LNG['user_already_exists']; } if ((isset($Exist['userv']['email']) || isset($Exist['vaild']['email'])) && ($UserEmail == $Exist['userv']['email'] || $UserEmail == $Exist['vaild']['email'])) { $errors .= $LNG['mail_already_exists']; } if (CheckPlanetIfExist($Galaxy, $System, $Position)) { $errors .= $LNG['planet_already_exists']; } if (!empty($errors)) { $template->message($errors, '?page=create&mode=user', 3, true); exit; } $SQL = "INSERT INTO " . USERS . " SET "; $SQL .= "`username` = '" . $db->sql_escape($UserName) . "', "; $SQL .= "`email` = '" . $db->sql_escape($UserMail) . "', "; $SQL .= "`email_2` = '" . $db->sql_escape($UserMail) . "', "; $SQL .= "`lang` = '" . $db->sql_escape($UserLang) . "', "; $SQL .= "`authlevel` = '" . $UserAuth . "', "; $SQL .= "`ip_at_reg` = '" . $_SERVER['REMOTE_ADDR'] . "', "; $SQL .= "`id_planet` = '0', "; $SQL .= "`onlinetime` = '" . TIMESTAMP . "', "; $SQL .= "`register_time` = '" . TIMESTAMP . "', "; $SQL .= "`password` = '" . md5($UserPass) . "', "; $SQL .= "`dpath` = '" . DEFAULT_SKINPATH . "', "; $SQL .= "`uctime`= '0';"; $db->query($SQL); $db->query("UPDATE " . CONFIG . " SET `config_value` = config_value + '1' WHERE `config_name` = 'users_amount';"); $ID_USER = $db->uniquequery("SELECT `id` FROM " . USERS . " WHERE `username` = '" . $db->sql_escape($UserName) . "';"); require_once ROOT_PATH . 'includes/functions/CreateOnePlanetRecord.' . PHP_EXT; CreateOnePlanetRecord($Galaxy, $System, $Planet, $ID_USER['id'], $UserPlanet, true, $UserAuth); $ID_PLANET = $db->uniquequery("SELECT `id` FROM " . PLANETS . " WHERE `id_owner` = '" . $ID_USER['id'] . "';"); $SQL = "UPDATE " . USERS . " SET "; $SQL .= "`id_planet` = '" . $ID_PLANET['id'] . "', "; $SQL .= "`galaxy` = '" . $Galaxy . "', "; $SQL .= "`system` = '" . $System . "', "; $SQL .= "`planet` = '" . $Planet . "' "; $SQL .= "WHERE "; $SQL .= "`id` = '" . $ID_USER['id'] . "' "; $SQL .= "LIMIT 1;"; $db->query($SQL); $template->message($LNG['new_user_success'], '?page=create&mode=user', 3, true); exit; } $AUTH[0] = $LNG['user_level'][0]; if ($USER['authlevel'] >= AUTH_OPS) { $AUTH[AUTH_OPS] = $LNG['user_level'][AUTH_OPS]; } if ($USER['authlevel'] >= AUTH_MOD) { $AUTH[AUTH_MOD] = $LNG['user_level'][AUTH_MOD]; } if ($USER['authlevel'] >= AUTH_ADM) { $AUTH[AUTH_ADM] = $LNG['user_level'][AUTH_ADM]; } $template->assign_vars(array('new_add_user' => $LNG['new_add_user'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'new_creator_go_back' => $LNG['new_creator_go_back'], 'user_reg' => $LNG['user_reg'], 'pass_reg' => $LNG['pass_reg'], 'pass2_reg' => $LNG['pass2_reg'], 'email_reg' => $LNG['email_reg'], 'email2_reg' => $LNG['email2_reg'], 'new_coord' => $LNG['new_coord'], 'new_range' => $LNG['new_range'], 'new_title' => $LNG['new_title'], 'Selector' => $AUTH)); $template->show('adm/CreatePageUser.tpl'); break; case 'moon': if ($_POST) { $PlanetID = request_var('add_moon', 0); $MoonName = request_var('name', '', UTF8_SUPPORT); $Diameter = request_var('diameter', 0); $FieldMax = request_var('field_max', 0); $MoonPlanet = $db->uniquequery("SELECT `temp_max`, `temp_min`, `id_luna`, `galaxy`, `system`, `planet`, `planet_type`, `destruyed`, `id_level`, `id_owner` FROM " . PLANETS . " WHERE `id` = '" . $PlanetID . "' AND `planet_type` = '1' AND `destruyed` = '0';"); if (!isset($MoonPlanet)) { $template->message($LNG['mo_planet_doesnt_exist'], '?page=create&mode=moon', 3, true); exit; } require_once ROOT_PATH . 'includes/functions/CreateOneMoonRecord.' . PHP_EXT; if (CreateOneMoonRecord($MoonPlanet['galaxy'], $MoonPlanet['system'], $MoonPlanet['planet'], $MoonPlanet['id_owner'], 0, $MoonName, 20, $_POST['diameter_check'] == 'on' ? 0 : $Diameter) !== false) { $template->message($LNG['mo_moon_added'], '?page=create&mode=moon', 3, true); } else { $template->message($LNG['mo_moon_unavaible'], '?page=create&mode=moon', 3, true); } exit; } $template->assign_vars(array('po_add_moon' => $LNG['po_add_moon'], 'input_id_planet' => $LNG['input_id_planet'], 'mo_moon_name' => $LNG['mo_moon_name'], 'mo_diameter' => $LNG['mo_diameter'], 'mo_temperature' => $LNG['mo_temperature'], 'mo_fields_avaibles' => $LNG['mo_fields_avaibles'], 'button_add' => $LNG['button_add'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'mo_moon' => $LNG['fcm_moon'], 'new_creator_go_back' => $LNG['new_creator_go_back'])); $template->show('adm/CreatePageMoon.tpl'); break; case 'planet': if ($_POST) { $id = request_var('id', 0); $Galaxy = request_var('galaxy', 0); $System = request_var('system', 0); $Planet = request_var('planet', 0); $name = request_var('name', '', UTF8_SUPPORT); $field_max = request_var('field_max', 0); $ISUser = $db->uniquequery("SELECT id, authlevel FROM " . USERS . " WHERE `id` = '" . $id . "';"); if (CheckPlanetIfExist($Galaxy, $System, $Planet) || !isset($ISUser)) { $template->message($LNG['po_complete_all'], '?page=create&mode=planet', 3, true); exit; } require_once ROOT_PATH . 'includes/functions/CreateOnePlanetRecord.' . PHP_EXT; CreateOnePlanetRecord($Galaxy, $System, $Planet, $id, '', '', false); $SQL = "UPDATE " . PLANETS . " SET "; if ($_POST['diameter_check'] != 'on' || $field_max > 0) { $SQL .= "`field_max` = '" . $field_max . "', "; } if (!empty($name)) { $SQL .= "`name` = '" . $db->sql_escape($name) . "', "; } $SQL .= "`id_level` = '" . $ISUser['authlevel'] . "' "; $SQL .= "WHERE "; $SQL .= "`galaxy` = '" . $Galaxy . "' AND "; $SQL .= "`system` = '" . $System . "' AND "; $SQL .= "`planet` = '" . $Planet . "' AND "; $SQL .= "`planet_type` = '1'"; $db->query($SQL); $template->message($LNG['po_complete_succes'], '?page=create&mode=planet', 3, true); exit; } $template->assign_vars(array('po_add_planet' => $LNG['po_add_planet'], 'po_galaxy' => $LNG['po_galaxy'], 'po_system' => $LNG['po_system'], 'po_planet' => $LNG['po_planet'], 'input_id_user' => $LNG['input_id_user'], 'new_creator_coor' => $LNG['new_creator_coor'], 'po_name_planet' => $LNG['po_name_planet'], 'po_fields_max' => $LNG['po_fields_max'], 'button_add' => $LNG['button_add'], 'po_colony' => $LNG['fcp_colony'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'new_creator_go_back' => $LNG['new_creator_go_back'])); $template->show('adm/CreatePagePlanet.tpl'); break; default: $template->assign_vars(array('new_creator_title_u' => $LNG['new_creator_title_u'], 'new_creator_title_p' => $LNG['new_creator_title_p'], 'new_creator_title_l' => $LNG['new_creator_title_l'], 'new_creator_title' => $LNG['new_creator_title'])); $template->show('adm/CreatePage.tpl'); break; } }