function ShowResetAdmin($CurrentUser) { global $phpEx, $lang, $db, $displays; if ($CurrentUser['authlevel'] < 3) { die($displays->message($lang['not_enough_permissions'])); } $db->query("RENAME TABLE {{table}} TO {{table}}_s", 'planets'); $db->query("RENAME TABLE {{table}} TO {{table}}_s", 'users'); $db->query("CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'planets'); $db->query("CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'users'); $db->query("TRUNCATE TABLE {{table}}", 'sac'); $db->query("TRUNCATE TABLE {{table}}", 'alliance'); $db->query("TRUNCATE TABLE {{table}}", 'banned'); $db->query("TRUNCATE TABLE {{table}}", 'buddy'); $db->query("TRUNCATE TABLE {{table}}", 'galaxy'); $db->query("TRUNCATE TABLE {{table}}", 'errors'); $db->query("TRUNCATE TABLE {{table}}", 'fleets'); $db->query("TRUNCATE TABLE {{table}}", 'messages'); $db->query("TRUNCATE TABLE {{table}}", 'notes'); $db->query("TRUNCATE TABLE {{table}}", 'rw'); $db->query("TRUNCATE TABLE {{table}}", 'statpoints'); $AllUsers = $db->query("SELECT `username`,`password`,`email`,\r\n\t\t\t\t `email_2`,`authlevel`,`galaxy`,`system`,`planet`,\r\n\t\t\t\t `dpath`, `onlinetime`, `register_time`, `id_planet`\r\n\t\t\t\t FROM {{table}};", 'users_s'); $LimitTime = time() - 15 * (24 * (60 * 60)); $TransUser = 0; while ($TheUser = mysql_fetch_assoc($AllUsers)) { if ($TheUser['onlinetime'] > $LimitTime) { $UserPlanet = $db->query("SELECT `name`\r\n\t\t\t\t\t\t\t FROM {{table}}\r\n\t\t\t\t\t\t\t WHERE `id` = '" . $TheUser['id_planet'] . "';", 'planets_s', true); if ($UserPlanet['name'] != "") { $QryInsertUser = "******"; $QryInsertUser .= "`username` = '" . $TheUser['username'] . "', "; $QryInsertUser .= "`email` = '" . $TheUser['email'] . "', "; $QryInsertUser .= "`email_2` = '" . $TheUser['email_2'] . "', "; $QryInsertUser .= "`id_planet` = '0', "; $QryInsertUser .= "`authlevel` = '" . $TheUser['authlevel'] . "', "; $QryInsertUser .= "`dpath` = '" . $TheUser['dpath'] . "', "; $QryInsertUser .= "`galaxy` = '" . $TheUser['galaxy'] . "', "; $QryInsertUser .= "`system` = '" . $TheUser['system'] . "', "; $QryInsertUser .= "`planet` = '" . $TheUser['planet'] . "', "; $QryInsertUser .= "`register_time` = '" . $TheUser['register_time'] . "', "; $QryInsertUser .= "`password` = '" . $TheUser['password'] . "';"; $db->query($QryInsertUser, 'users'); $NewUser = $db->query("SELECT `id`\r\n\t\t\t\t\t\t\t\t FROM {{table}}\r\n\t\t\t\t\t\t\t\t WHERE `username` = '" . $TheUser['username'] . "'\r\n\t\t\t\t\t\t\t\t LIMIT 1;", 'users', true); CreateOnePlanetRecord($TheUser['galaxy'], $TheUser['system'], $TheUser['planet'], $NewUser['id'], $UserPlanet['name'], '', '', '', true); $PlanetID = $db->query("SELECT `id` FROM {{table}} WHERE `id_owner` = '" . $NewUser['id'] . "' LIMIT 1;", 'planets', true); $QryUpdateUser = "******"; $QryUpdateUser .= "`id_planet` = '" . $PlanetID['id'] . "', "; $QryUpdateUser .= "`current_planet` = '" . $PlanetID['id'] . "' "; $QryUpdateUser .= "WHERE "; $QryUpdateUser .= "`id` = '" . $NewUser['id'] . "';"; $db->query($QryUpdateUser, 'users'); $TransUser++; } } } $db->query("UPDATE {{table}} SET `config_value` = '" . $TransUser . "' WHERE `config_name` = 'users_amount' LIMIT 1;", 'config'); $db->query("DROP TABLE {{table}}", 'planets_s'); $db->query("DROP TABLE {{table}}", 'users_s'); header("location:admin.php?page=overview"); }
function MissionCaseColonisation($FleetRow) { global $lang, $resource; $iPlanetCount = mysql_result(doquery("SELECT count(*) FROM {{table}} WHERE `id_owner` = '" . $FleetRow['fleet_owner'] . "' AND `planet_type` = '1'", 'planets'), 0); if ($FleetRow['fleet_mess'] == 0) { $iGalaxyPlace = mysql_result(doquery("SELECT count(*) FROM {{table}} WHERE `galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND `system` = '" . $FleetRow['fleet_end_system'] . "' AND `planet` = '" . $FleetRow['fleet_end_planet'] . "';", 'galaxy'), 0); $TargetAdress = sprintf($lang['sys_adress_planet'], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']); if ($iGalaxyPlace == 0) { if ($iPlanetCount >= MAX_PLAYER_PLANETS) { $TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_maxcolo'] . MAX_PLAYER_PLANETS . $lang['sys_colo_planet']; SendSimpleMessage($FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage); doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = " . $FleetRow["fleet_id"], 'fleets'); } else { $NewOwnerPlanet = CreateOnePlanetRecord($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $FleetRow['fleet_owner'], $lang['sys_colo_defaultname'], false); if ($NewOwnerPlanet == true) { $TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_allisok']; SendSimpleMessage($FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage); if ($FleetRow['fleet_amount'] == 1) { doquery("DELETE FROM {{table}} WHERE fleet_id=" . $FleetRow["fleet_id"], 'fleets'); } else { $CurrentFleet = explode(";", $FleetRow['fleet_array']); $NewFleet = ""; foreach ($CurrentFleet as $Item => $Group) { if ($Group != '') { $Class = explode(",", $Group); if ($Class[0] == 208) { if ($Class[1] > 1) { $NewFleet .= $Class[0] . "," . ($Class[1] - 1) . ";"; } } else { if ($Class[1] != 0) { $NewFleet .= $Class[0] . "," . $Class[1] . ";"; } } } } $QryUpdateFleet = "UPDATE {{table}} SET "; $QryUpdateFleet .= "`fleet_array` = '" . $NewFleet . "', "; $QryUpdateFleet .= "`fleet_amount` = `fleet_amount` - 1, "; $QryUpdateFleet .= "`fleet_mess` = '1' "; $QryUpdateFleet .= "WHERE `fleet_id` = '" . $FleetRow["fleet_id"] . "';"; doquery($QryUpdateFleet, 'fleets'); } } else { $TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_badpos']; SendSimpleMessage($FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage); doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = " . $FleetRow["fleet_id"], 'fleets'); } } } else { $TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_notfree']; SendSimpleMessage($FleetRow['fleet_owner'], '', $FleetRow['fleet_end_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage); doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = " . $FleetRow["fleet_id"], 'fleets'); } } else { RestoreFleetToPlanet($FleetRow, true); doquery("DELETE FROM {{table}} WHERE fleet_id=" . $FleetRow["fleet_id"], 'fleets'); } }
function ResetUniverse($CurrentUser) { global $phpEx; doquery("RENAME TABLE {{table}} TO {{table}}_s", 'planets'); doquery("RENAME TABLE {{table}} TO {{table}}_s", 'users'); doquery("CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'planets'); doquery("CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'users'); doquery("TRUNCATE TABLE {{table}}", 'aks'); doquery("TRUNCATE TABLE {{table}}", 'alliance'); doquery("TRUNCATE TABLE {{table}}", 'banned'); doquery("TRUNCATE TABLE {{table}}", 'buddy'); doquery("TRUNCATE TABLE {{table}}", 'galaxy'); doquery("TRUNCATE TABLE {{table}}", 'errors'); doquery("TRUNCATE TABLE {{table}}", 'fleets'); doquery("TRUNCATE TABLE {{table}}", 'messages'); doquery("TRUNCATE TABLE {{table}}", 'notes'); doquery("TRUNCATE TABLE {{table}}", 'rw'); doquery("TRUNCATE TABLE {{table}}", 'statpoints'); $AllUsers = doquery("SELECT `username`,`password`,`email`, `email_2`,`authlevel`,`galaxy`,`system`,`planet`, `dpath`, `onlinetime`, `register_time`, `id_planet` FROM {{table}} WHERE 1;", 'users_s'); $LimitTime = time() - 15 * (24 * (60 * 60)); $TransUser = 0; while ($TheUser = mysql_fetch_assoc($AllUsers)) { if ($TheUser['onlinetime'] > $LimitTime) { $UserPlanet = doquery("SELECT `name` FROM {{table}} WHERE `id` = '" . $TheUser['id_planet'] . "';", 'planets_s', true); if ($UserPlanet['name'] != "") { $Time = time(); $QryInsertUser = "******"; $QryInsertUser .= "`username` = '" . $TheUser['username'] . "', "; $QryInsertUser .= "`email` = '" . $TheUser['email'] . "', "; $QryInsertUser .= "`email_2` = '" . $TheUser['email_2'] . "', "; $QryInsertUser .= "`id_planet` = '0', "; $QryInsertUser .= "`authlevel` = '" . $TheUser['authlevel'] . "', "; $QryInsertUser .= "`dpath` = '" . $TheUser['dpath'] . "', "; $QryInsertUser .= "`galaxy` = '" . $TheUser['galaxy'] . "', "; $QryInsertUser .= "`system` = '" . $TheUser['system'] . "', "; $QryInsertUser .= "`planet` = '" . $TheUser['planet'] . "', "; $QryInsertUser .= "`register_time` = '" . $TheUser['register_time'] . "', "; $QryInsertUser .= "`onlinetime` = '" . $Time . "', "; $QryInsertUser .= "`password` = '" . $TheUser['password'] . "';"; doquery($QryInsertUser, 'users'); doquery("UPDATE {{table}} SET `bana` = '0' WHERE `id` > '1'", "users"); $NewUser = doquery("SELECT `id` FROM {{table}} WHERE `username` = '" . $TheUser['username'] . "' LIMIT 1;", 'users', true); CreateOnePlanetRecord($TheUser['galaxy'], $TheUser['system'], $TheUser['planet'], $NewUser['id'], $UserPlanet['name'], true); doquery("UPDATE {{table}} SET `id_level` = '" . $TheUser['authlevel'] . "' WHERE `id_owner` = '" . $NewUser['id'] . "'", "planets"); $PlanetID = doquery("SELECT `id` FROM {{table}} WHERE `id_owner` = '" . $NewUser['id'] . "' LIMIT 1;", 'planets', true); $QryUpdateUser = "******"; $QryUpdateUser .= "`id_planet` = '" . $PlanetID['id'] . "', "; $QryUpdateUser .= "`current_planet` = '" . $PlanetID['id'] . "' "; $QryUpdateUser .= "WHERE "; $QryUpdateUser .= "`id` = '" . $NewUser['id'] . "';"; doquery($QryUpdateUser, 'users'); $TransUser++; } } } doquery("UPDATE {{table}} SET `config_value` = '" . $TransUser . "' WHERE `config_name` = 'users_amount' LIMIT 1;", 'config'); doquery("DROP TABLE {{table}}", 'planets_s'); doquery("DROP TABLE {{table}}", 'users_s'); }
function TargetEvent() { global $resource; $iPlanetCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . PLANETS . " WHERE `id_owner` = '" . $this->_fleet['fleet_owner'] . "' AND `planet_type` = '1' AND `destruyed` = '0';"); $iGalaxyPlace = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . PLANETS . " WHERE `id` = '" . $this->_fleet['fleet_end_id'] . "';"); $senderUser = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . USERS . " WHERE `id` = '" . $this->_fleet['fleet_owner'] . "';"); $senderPlanet = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . PLANETS . " WHERE `id` = '" . $this->_fleet['fleet_start_id'] . "';"); $senderUser['factor'] = getFactors($senderUser, 'basic', $this->_fleet['fleet_start_time']); $LNG = $this->getLanguage($senderUser['lang']); $MaxPlanets = PlayerUtil::maxPlanetCount($senderUser); if ($iGalaxyPlace != 0) { $TheMessage = sprintf($LNG['sys_colo_notfree'], GetTargetAdressLink($this->_fleet, '')); $this->setState(FLEET_RETURN); } elseif ($iPlanetCount >= $MaxPlanets) { $TheMessage = sprintf($LNG['sys_colo_maxcolo'], GetTargetAdressLink($this->_fleet, ''), $MaxPlanets); $this->setState(FLEET_RETURN); } elseif (PlayerUtil::allowPlanetPosition($this->_fleet['fleet_end_planet'], $senderUser) == false) { $TheMessage = sprintf($LNG['sys_colo_notech'], GetTargetAdressLink($this->_fleet, ''), $MaxPlanets); $this->setState(FLEET_RETURN); } else { require_once 'includes/functions/CreateOnePlanetRecord.php'; $NewOwnerPlanet = CreateOnePlanetRecord($this->_fleet['fleet_end_galaxy'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'], $this->_fleet['fleet_universe'], $this->_fleet['fleet_owner'], $LNG['fcp_colony'], false, $senderUser['authlevel']); if ($NewOwnerPlanet === false) { $TheMessage = sprintf($LNG['sys_colo_badpos'], GetTargetAdressLink($this->_fleet, '')); $this->setState(FLEET_RETURN); } else { $this->_fleet['fleet_end_id'] = $NewOwnerPlanet; $TheMessage = sprintf($LNG['sys_colo_allisok'], GetTargetAdressLink($this->_fleet, '')); $this->StoreGoodsToPlanet(); if ($this->_fleet['fleet_amount'] == 1) { $this->KillFleet(); } else { $CurrentFleet = explode(";", $this->_fleet['fleet_array']); $NewFleet = ''; foreach ($CurrentFleet as $Item => $Group) { if (empty($Group)) { continue; } $Class = explode(",", $Group); if ($Class[0] == 208 && $Class[1] > 1) { $NewFleet .= $Class[0] . "," . ($Class[1] - 1) . ";"; } elseif ($Class[0] != 208 && $Class[1] > 0) { $NewFleet .= $Class[0] . "," . $Class[1] . ";"; } } $this->UpdateFleet('fleet_array', $NewFleet); $this->UpdateFleet('fleet_amount', $this->_fleet['fleet_amount'] - 1); $this->UpdateFleet('fleet_resource_metal', 0); $this->UpdateFleet('fleet_resource_crystal', 0); $this->UpdateFleet('fleet_resource_deuterium', 0); $this->setState(FLEET_RETURN); } } } SendSimpleMessage($this->_fleet['fleet_owner'], 0, $this->_fleet['fleet_start_time'], 4, $LNG['sys_colo_mess_from'], $LNG['sys_colo_mess_report'], $TheMessage); $this->SaveFleet(); }
function TargetEvent() { global $db, $resource, $LANG; $iPlanetCount = $db->countquery("SELECT count(*) FROM " . PLANETS . " WHERE `id_owner` = '" . $this->_fleet['fleet_owner'] . "' AND `planet_type` = '1' AND `destruyed` = '0';"); $iGalaxyPlace = $db->countquery("SELECT count(*) AS plani FROM " . PLANETS . " WHERE `id` = '" . $this->_fleet['fleet_end_id'] . "';"); $Player = $db->uniquequery("SELECT `lang`, `authlevel`, `" . $resource[124] . "` FROM " . USERS . " WHERE `id` = '" . $this->_fleet['fleet_owner'] . "';"); $LNG = $LANG->GetUserLang($Player['lang']); $MaxPlanets = MaxPlanets($Player[$resource[124]]); if ($iGalaxyPlace != 0) { $TheMessage = sprintf($LNG['sys_colo_notfree'], GetTargetAdressLink($this->_fleet, '')); $this->UpdateFleet('fleet_mess', 1); } elseif ($iPlanetCount >= $MaxPlanets) { $TheMessage = sprintf($LNG['sys_colo_maxcolo'], GetTargetAdressLink($this->_fleet, ''), $MaxPlanets); $this->UpdateFleet('fleet_mess', 1); } else { require_once ROOT_PATH . 'includes/functions/CreateOnePlanetRecord.php'; $NewOwnerPlanet = CreateOnePlanetRecord($this->_fleet['fleet_end_galaxy'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'], $this->_fleet['fleet_universe'], $this->_fleet['fleet_owner'], $LNG['fcp_colony'], false, $Player['authlevel']); if ($NewOwnerPlanet === false) { $TheMessage = sprintf($LNG['sys_colo_badpos'], GetTargetAdressLink($this->_fleet, '')); $this->UpdateFleet('fleet_mess', 1); } else { $this->_fleet['fleet_end_id'] = $NewOwnerPlanet; $TheMessage = sprintf($LNG['sys_colo_allisok'], GetTargetAdressLink($this->_fleet, '')); $this->StoreGoodsToPlanet(); if ($this->_fleet['fleet_amount'] == 1) { $this->KillFleet(); } else { $CurrentFleet = explode(";", $this->_fleet['fleet_array']); $NewFleet = ''; foreach ($CurrentFleet as $Item => $Group) { if (empty($Group)) { continue; } $Class = explode(",", $Group); if ($Class[0] == 208 && $Class[1] > 1) { $NewFleet .= $Class[0] . "," . ($Class[1] - 1) . ";"; } elseif ($Class[0] != 208 && $Class[1] > 0) { $NewFleet .= $Class[0] . "," . $Class[1] . ";"; } } $this->UpdateFleet('fleet_array', $NewFleet); $this->UpdateFleet('fleet_amount', $this->_fleet['fleet_amount'] - 1); $this->UpdateFleet('fleet_resource_metal', 0); $this->UpdateFleet('fleet_resource_crystal', 0); $this->UpdateFleet('fleet_resource_deuterium', 0); $this->UpdateFleet('fleet_resource_norio', 0); $this->UpdateFleet('fleet_mess', 1); } } } SendSimpleMessage($this->_fleet['fleet_owner'], 0, $this->_fleet['fleet_start_time'], 4, $LNG['sys_colo_mess_from'], $LNG['sys_colo_mess_report'], $TheMessage); $this->SaveFleet(); }
function TargetEvent() { global $db, $resource; $iPlanetCount = $db->uniquequery("SELECT count(*) as kolo FROM " . PLANETS . " WHERE `id_owner` = '" . $this->_fleet['fleet_owner'] . "' AND `planet_type` = '1' AND `destruyed` = '0';"); $iGalaxyPlace = $db->uniquequery("SELECT count(*) AS plani FROM " . PLANETS . " WHERE `galaxy` = '" . $this->_fleet['fleet_end_galaxy'] . "' AND `system` = '" . $this->_fleet['fleet_end_system'] . "' AND `planet` = '" . $this->_fleet['fleet_end_planet'] . "';"); $PlayerTech = $db->uniquequery("SELECT `authlevel`, `" . $resource[124] . "` FROM " . USERS . " WHERE `id` = '" . $this->_fleet['fleet_owner'] . "';"); $LNG = $this->GetUserLang($this->_fleet['fleet_owner']); if ($iGalaxyPlace['plani'] != 0) { $TheMessage = sprintf($LNG['sys_colo_notfree'], GetTargetAdressLink($this->_fleet, '')); $this->UpdateFleet('fleet_mess', 1); } elseif ($iPlanetCount['kolo'] >= STANDART_PLAYER_PLANETS + ceil($PlayerTech[$resource[124]] / 2) * PLANETS_PER_TECH) { $TheMessage = sprintf($LNG['sys_colo_maxcolo'], GetTargetAdressLink($this->_fleet, ''), STANDART_PLAYER_PLANETS + ceil($PlayerTech[$resource[124]] / 2)); $this->UpdateFleet('fleet_mess', 1); } else { require_once ROOT_PATH . 'includes/functions/CreateOnePlanetRecord.' . PHP_EXT; $NewOwnerPlanet = CreateOnePlanetRecord($this->_fleet['fleet_end_galaxy'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'], $this->_fleet['fleet_owner'], $LNG['fcp_colony'], false, $PlayerTech['authlevel']); if ($NewOwnerPlanet !== true) { $TheMessage = sprintf($LNG['sys_colo_badpos'], GetTargetAdressLink($this->_fleet, '')); $this->UpdateFleet('fleet_mess', 1); } else { $TheMessage = sprintf($LNG['sys_colo_allisok'], GetTargetAdressLink($this->_fleet, '')); $this->StoreGoodsToPlanet(); if ($this->_fleet['fleet_amount'] == 1) { $db->query("DELETE FROM " . FLEETS . " WHERE fleet_id=" . $this->_fleet["fleet_id"] . ";"); } else { $CurrentFleet = explode(";", $this->_fleet['fleet_array']); $NewFleet = ''; foreach ($CurrentFleet as $Item => $Group) { if (empty($Group)) { continue; } $Class = explode(",", $Group); if ($Class[0] == 208 && $Class[1] > 1) { $NewFleet .= $Class[0] . "," . ($Class[1] - 1) . ";"; } elseif ($Class[0] != 208 && $Class[1] > 0) { $NewFleet .= $Class[0] . "," . $Class[1] . ";"; } } $this->UpdateFleet('fleet_array', $NewFleet); $this->UpdateFleet('fleet_amount', $this->_fleet['fleet_amount'] - 1); $this->UpdateFleet('fleet_resource_metal', 0); $this->UpdateFleet('fleet_resource_crystal', 0); $this->UpdateFleet('fleet_resource_deuterium', 0); $this->UpdateFleet('fleet_mess', 1); } } } SendSimpleMessage($this->_fleet['fleet_owner'], 0, $this->_fleet['fleet_start_time'], 4, $LNG['sys_colo_mess_from'], $LNG['sys_colo_mess_report'], $TheMessage); $this->SaveFleet(); }
/** * ResetThisFuckingCheater.php * * @version $Id$ * @copyright 2008 */ function ResetThisFuckingCheater($UserID) { $TheUser = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $UserID . "';", 'users', true); $UserPlanet = doquery("SELECT `name` FROM {{table}} WHERE `id` = '" . $TheUser['id_planet'] . "';", 'planets', true); DeleteSelectedUser($UserID); if ($UserPlanet['name'] != "") { // Creation de l'utilisateur $QryInsertUser = "******"; $QryInsertUser .= "`id` = '" . $TheUser['id'] . "', "; $QryInsertUser .= "`username` = '" . $TheUser['username'] . "', "; $QryInsertUser .= "`email` = '" . $TheUser['email'] . "', "; $QryInsertUser .= "`email_2` = '" . $TheUser['email_2'] . "', "; $QryInsertUser .= "`sex` = '" . $TheUser['sex'] . "', "; $QryInsertUser .= "`id_planet` = '0', "; $QryInsertUser .= "`authlevel` = '" . $TheUser['authlevel'] . "', "; $QryInsertUser .= "`dpath` = '" . $TheUser['dpath'] . "', "; $QryInsertUser .= "`galaxy` = '" . $TheUser['galaxy'] . "', "; $QryInsertUser .= "`system` = '" . $TheUser['system'] . "', "; $QryInsertUser .= "`planet` = '" . $TheUser['planet'] . "', "; $QryInsertUser .= "`register_time` = '" . $TheUser['register_time'] . "', "; $QryInsertUser .= "`password` = '" . $TheUser['password'] . "';"; doquery($QryInsertUser, 'users'); // On cherche le numero d'enregistrement de l'utilisateur fraichement cr?? $NewUser = doquery("SELECT `id` FROM {{table}} WHERE `username` = '" . $TheUser['username'] . "' LIMIT 1;", 'users', true); CreateOnePlanetRecord($TheUser['galaxy'], $TheUser['system'], $TheUser['planet'], $NewUser['id'], $UserPlanet['name'], true); // Recherche de la reference de la nouvelle planete (qui est unique normalement ! $PlanetID = doquery("SELECT `id` FROM {{table}} WHERE `id_owner` = '" . $NewUser['id'] . "' LIMIT 1;", 'planets', true); // Mise a jour de l'enregistrement utilisateur avec les infos de sa planete mere $QryUpdateUser = "******"; $QryUpdateUser .= "`id_planet` = '" . $PlanetID['id'] . "', "; $QryUpdateUser .= "`current_planet` = '" . $PlanetID['id'] . "' "; $QryUpdateUser .= "WHERE "; $QryUpdateUser .= "`id` = '" . $NewUser['id'] . "';"; doquery($QryUpdateUser, 'users'); } return; }
function MissionCaseColonisation($FleetRow) { global $lang, $resource; $iPlanetCount = mysql_result(doquery("SELECT count(*) FROM {{table}} WHERE `id_owner` = '" . $FleetRow['fleet_owner'] . "' AND `planet_type` = '1'", 'planets'), 0); if ($FleetRow['fleet_mess'] == 0) { // Déjà, sommes nous a l'aller ?? $iGalaxyPlace = mysql_result(doquery("SELECT count(*) FROM {{table}} WHERE `galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND `system` = '" . $FleetRow['fleet_end_system'] . "' AND `planet` = '" . $FleetRow['fleet_end_planet'] . "';", 'galaxy'), 0); $TargetAdress = sprintf($lang['sys_adress_planet'], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']); if ($iGalaxyPlace == 0) { // Y a personne qui s'y est mis avant que je ne debarque ! if ($iPlanetCount >= MAX_PLAYER_PLANETS) { $TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_maxcolo'] . MAX_PLAYER_PLANETS . $lang['sys_colo_planet']; SendSimpleMessage($FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage); doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = " . $FleetRow["fleet_id"], 'fleets'); } else { $NewOwnerPlanet = CreateOnePlanetRecord($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $FleetRow['fleet_owner'], $lang['sys_colo_defaultname'], false); if ($NewOwnerPlanet == true) { $TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_allisok']; SendSimpleMessage($FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage); // Verifier ce que contient fleet_array (et le cas et cheant retirer un element '208' if ($FleetRow['fleet_amount'] == 1) { doquery("DELETE FROM {{table}} WHERE fleet_id=" . $FleetRow["fleet_id"], 'fleets'); } else { $CurrentFleet = explode(";", $FleetRow['fleet_array']); $NewFleet = ""; foreach ($CurrentFleet as $Item => $Group) { if ($Group != '') { $Class = explode(",", $Group); if ($Class[0] == 208) { if ($Class[1] > 1) { $NewFleet .= $Class[0] . "," . ($Class[1] - 1) . ";"; } } else { if ($Class[1] != 0) { $NewFleet .= $Class[0] . "," . $Class[1] . ";"; } } } } $QryUpdateFleet = "UPDATE {{table}} SET "; $QryUpdateFleet .= "`fleet_array` = '" . $NewFleet . "', "; $QryUpdateFleet .= "`fleet_amount` = `fleet_amount` - 1, "; $QryUpdateFleet .= "`fleet_mess` = '1' "; $QryUpdateFleet .= "WHERE `fleet_id` = '" . $FleetRow["fleet_id"] . "';"; doquery($QryUpdateFleet, 'fleets'); } } else { $TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_badpos']; SendSimpleMessage($FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage); doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = " . $FleetRow["fleet_id"], 'fleets'); } } } else { // Pas de bol coiffé sur le poteau ! $TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_notfree']; SendSimpleMessage($FleetRow['fleet_owner'], '', $FleetRow['fleet_end_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage); // Mettre a jour la flotte pour qu'effectivement elle revienne ! doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = " . $FleetRow["fleet_id"], 'fleets'); } } else { // Retour de flotte RestoreFleetToPlanet($FleetRow, true); doquery("DELETE FROM {{table}} WHERE fleet_id=" . $FleetRow["fleet_id"], 'fleets'); } }
$SQL .= "password\t\t= '" . $GLOBALS['DATABASE']->sql_escape($md5Password) . "', "; $SQL .= "email\t\t\t= '" . $GLOBALS['DATABASE']->sql_escape($AdminMail) . "', "; $SQL .= "email_2\t\t= '" . $GLOBALS['DATABASE']->sql_escape($AdminMail) . "', "; $SQL .= "ip_at_reg\t\t= '" . $_SERVER['REMOTE_ADDR'] . "', "; $SQL .= "lang\t\t\t= '" . $LNG->getLanguage() . "', "; $SQL .= "authlevel\t\t= " . AUTH_ADM . ", "; $SQL .= "dpath \t\t\t= '" . DEFAULT_THEME . "', "; $SQL .= "rights\t\t\t= '', "; $SQL .= "id_planet\t\t= 1, "; $SQL .= "universe\t\t= 1, "; $SQL .= "galaxy\t\t\t= 1, "; $SQL .= "system\t\t\t= 1, "; $SQL .= "planet\t\t\t= 2, "; $SQL .= "register_time\t= " . TIMESTAMP . ";"; $GLOBALS['DATABASE']->query($SQL); require_once 'includes/functions/CreateOnePlanetRecord.php'; $PlanetID = CreateOnePlanetRecord(1, 1, 1, 1, 1, '', true, AUTH_ADM); $SESSION = new Session(); $SESSION->DestroySession(); $SESSION->CreateSession(1, $AdminUsername, $PlanetID, 1, 3, DEFAULT_THEME); $_SESSION['admin_login'] = $md5Password; @unlink($enableInstallToolFile); $template->show('ins_step8.tpl'); break; } break; default: $template->assign(array('intro_text' => $LNG['intro_text'], 'intro_welcome' => $LNG['intro_welcome'], 'intro_install' => $LNG['intro_install'])); $template->show('ins_intro.tpl'); break; }
$system = $_POST['system']; $planet = $_POST['planet']; $i = 0; $QueryS = doquery("SELECT * FROM {{table}} WHERE `galaxy` = '" . $galaxy . "' AND `system` = '" . $system . "' AND `planet` = '" . $planet . "'", "galaxy", true); $QueryS2 = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $id . "'", "users", true); if (is_numeric($_POST['id']) && isset($_POST['id']) && !$QueryS && $QueryS2) { if ($galaxy < 1 or $system < 1 or $planet < 1 or !is_numeric($galaxy) or !is_numeric($system) or !is_numeric($planet)) { $Error .= '<tr><th colspan="2"><font color=red>' . $lang['po_complete_all'] . '</font></th></tr>'; $i++; } if ($galaxy > MAX_GALAXY_IN_WORLD or $system > MAX_SYSTEM_IN_GALAXY or $planet > MAX_PLANET_IN_SYSTEM) { $Error .= '<tr><th colspan="2"><font color=red>' . $lang['po_complete_all2'] . '</font></th></tr>'; $i++; } if ($i == 0) { CreateOnePlanetRecord($galaxy, $system, $planet, $id, '', '', false); $QueryS3 = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . $id . "'", "planets", true); doquery("UPDATE {{table}} SET `id_level` = '" . $QueryS3['id_level'] . "' WHERE\r\n\t\t\t`galaxy` = '" . $galaxy . "' AND `system` = '" . $system . "' AND `planet` = '" . $planet . "' AND `planet_type` = '1'", "planets"); $parse['display'] = '<tr><th colspan="2"><font color=lime>' . $lang['po_complete_succes'] . '</font></th></tr>'; } else { $parse['display'] = $Error; } } else { $parse['display'] = '<tr><th colspan="2"><font color=red>' . $lang['po_complete_all'] . '</font></th></tr>'; } } elseif ($mode == 'borrar') { $id = $_POST['id']; if (is_numeric($id) && isset($id)) { $QueryS = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $id . "'", "planets", true); if ($QueryS) { if ($QueryS['planet_type'] == '1') {
function ShowCreateUserAdmin($user) { global $lang, $db, $displays, $users; if ($user['authlevel'] < 2) { die($displays->message($lang['not_enough_permissions'])); } if ($_POST) { $errors = 0; $errorlist = ""; $_POST['email'] = strip_tags($_POST['email']); if (!is_email($_POST['email'])) { $errorlist .= $lang['cu_invalid_mail']; $errors++; } if (!$_POST['character']) { $errorlist .= $lang['cu_empty_user_field']; $errors++; } if (strlen($_POST['passwrd']) < 4) { $errorlist .= $lang['cu_password_lenght_error']; $errors++; } if (preg_match("/[^A-z0-9_\\-]/", $_POST['character']) == 1) { $errorlist .= $lang['cu_user_field_no_alphanumeric']; $errors++; } $ExistUser = $db->query("SELECT `username` FROM {{table}} WHERE `username` = '" . mysql_escape_string($_POST['character']) . "' LIMIT 1;", 'users', true); if ($ExistUser) { $errorlist .= $lang['cu_user_already_exists']; $errors++; } $ExistMail = $db->query("SELECT `email` FROM {{table}} WHERE `email` = '" . mysql_escape_string($_POST['email']) . "' LIMIT 1;", 'users', true); if ($ExistMail) { $errorlist .= $lang['cu_mail_already_exists']; $errors++; } if ($errors != 0) { $displays->message($errorlist, "admin.php?page=createuser", "5", false, false); } else { $newpass = $_POST['passwrd']; $UserName = $_POST['character']; $UserEmail = $_POST['email']; $random = $_POST['random']; $galaxy = $_POST['galaxy']; $system = $_POST['system']; $planet = $_POST['planet']; $md5newpass = md5($newpass); $QryInsertUser = "******"; $QryInsertUser .= "`username` = '" . mysql_escape_string(strip_tags(eregi_replace("'|\"", '', $UserName))) . "', "; $QryInsertUser .= "`email` = '" . mysql_escape_string($UserEmail) . "', "; $QryInsertUser .= "`email_2` = '" . mysql_escape_string($UserEmail) . "', "; $QryInsertUser .= "`ip_at_reg` = '" . $lang['cu_user'] . "', "; $QryInsertUser .= "`id_planet` = '0', "; $QryInsertUser .= "`register_time` = '" . time() . "', "; $QryInsertUser .= "`password`='" . $md5newpass . "';"; $db->query($QryInsertUser, 'users'); $NewUser = $db->query("SELECT `id`,`username`,`email_2` FROM {{table}} WHERE `username` = '" . mysql_escape_string($_POST['character']) . "' LIMIT 1;", 'users', true); if ($random == 'on') { $LastSettedGalaxyPos = $db->game_config['LastSettedGalaxyPos'] != 0 ? $db->game_config['LastSettedGalaxyPos'] : 1; $LastSettedSystemPos = $db->game_config['LastSettedSystemPos'] != 0 ? $db->game_config['LastSettedSystemPos'] : 1; $LastSettedPlanetPos = $db->game_config['LastSettedPlanetPos'] != 0 ? $db->game_config['LastSettedPlanetPos'] : 1; while (!isset($newpos_checked)) { for ($Galaxy = $LastSettedGalaxyPos; $Galaxy <= MAX_GALAXY_IN_WORLD; $Galaxy++) { for ($System = $LastSettedSystemPos; $System <= MAX_SYSTEM_IN_GALAXY; $System++) { for ($Posit = $LastSettedPlanetPos; $Posit <= 4; $Posit++) { $Planet = round(rand(4, 12)); switch ($LastSettedPlanetPos) { case 1: $LastSettedPlanetPos += 1; break; case 2: $LastSettedPlanetPos += 1; break; case 3: if ($LastSettedSystemPos == MAX_SYSTEM_IN_GALAXY) { $LastSettedGalaxyPos += 1; $LastSettedSystemPos = 1; $LastSettedPlanetPos = 1; break; } else { $LastSettedPlanetPos = 1; } $LastSettedSystemPos += 1; break; } break; } break; } break; } $QrySelectGalaxy = "SELECT * "; $QrySelectGalaxy .= "FROM {{table}} "; $QrySelectGalaxy .= "WHERE "; $QrySelectGalaxy .= "`galaxy` = '" . $Galaxy . "' AND "; $QrySelectGalaxy .= "`system` = '" . $System . "' AND "; $QrySelectGalaxy .= "`planet` = '" . $Planet . "' "; $QrySelectGalaxy .= "LIMIT 1;"; $GalaxyRow = $db->query($QrySelectGalaxy, 'galaxy', true); if ($GalaxyRow["id_planet"] == "0") { $newpos_checked = true; } if (!$GalaxyRow) { CreateOnePlanetRecord($Galaxy, $System, $Planet, $NewUser['id'], $UserPlanet, '', '', '', true); $newpos_checked = true; } if ($newpos_checked) { $db->query("UPDATE {{table}} SET `config_value` = '" . $LastSettedGalaxyPos . "' WHERE `config_name` = 'LastSettedGalaxyPos';", 'config'); $db->query("UPDATE {{table}} SET `config_value` = '" . $LastSettedSystemPos . "' WHERE `config_name` = 'LastSettedSystemPos';", 'config'); $db->query("UPDATE {{table}} SET `config_value` = '" . $LastSettedPlanetPos . "' WHERE `config_name` = 'LastSettedPlanetPos';", 'config'); } } $PlanetID = $db->query("SELECT `id` FROM {{table}} WHERE `id_owner` = '" . $NewUser['id'] . "' LIMIT 1;", 'planets', true); $QryUpdateUser = "******"; $QryUpdateUser .= "`id_planet` = '" . $PlanetID['id'] . "', "; $QryUpdateUser .= "`current_planet` = '" . $PlanetID['id'] . "', "; $QryUpdateUser .= "`galaxy` = '" . $Galaxy . "', "; $QryUpdateUser .= "`system` = '" . $System . "', "; $QryUpdateUser .= "`planet` = '" . $Planet . "' "; $QryUpdateUser .= "WHERE "; $QryUpdateUser .= "`id` = '" . $NewUser['id'] . "' "; $QryUpdateUser .= "LIMIT 1;"; $db->query($QryUpdateUser, 'users'); } else { $QrySelectGalaxy = "SELECT * "; $QrySelectGalaxy .= "FROM {{table}} "; $QrySelectGalaxy .= "WHERE "; $QrySelectGalaxy .= "`galaxy` = '" . $galaxy . "' AND "; $QrySelectGalaxy .= "`system` = '" . $system . "' AND "; $QrySelectGalaxy .= "`planet` = '" . $planet . "' "; $QrySelectGalaxy .= "LIMIT 1;"; $GalaxyRow = $db->query($QrySelectGalaxy, 'galaxy', true); if ($GalaxyRow["id_planet"] == "0") { $newpos_checked = true; } if (!$GalaxyRow) { CreateOnePlanetRecord($galaxy, $system, $planet, $NewUser['id'], $UserPlanet, '', '', '', true); $newpos_checked = true; } $PlanetID = $db->query("SELECT `id` FROM {{table}} WHERE `id_owner` = '" . $NewUser['id'] . "' LIMIT 1;", 'planets', true); $QryUpdateUser = "******"; $QryUpdateUser .= "`id_planet` = '" . $PlanetID['id'] . "', "; $QryUpdateUser .= "`current_planet` = '" . $PlanetID['id'] . "', "; $QryUpdateUser .= "`galaxy` = '" . $galaxy . "', "; $QryUpdateUser .= "`system` = '" . $system . "', "; $QryUpdateUser .= "`planet` = '" . $planet . "' "; $QryUpdateUser .= "WHERE "; $QryUpdateUser .= "`id` = '" . $NewUser['id'] . "' "; $QryUpdateUser .= "LIMIT 1;"; $db->query($QryUpdateUser, 'users'); } if ($db->game_config["server_mail"]) { $url = dirname("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) . "/"; $siteurlactivationlink = $url . 'activate.php?hash=' . base64_encode($NewUser['username']) . '&stamp=' . base64_encode($NewUser['id']); $body = "Bienvenido a " . $db->game_config["game_name"] . "<p>\r\n\r\n Te has registrado con el siguiente nombre de usuario: " . $NewUser['username'] . "<br>\r\n Y su contraseña es: " . $_POST['passwrd'] . " (conservala bien no podra recuperarlo)<p>\r\n\r\n Para jugar en " . $db->game_config["game_name"] . " es necesario que actives tu cuenta.<p>\r\n\r\n Has click en el siguiente link para confirmar tu registro.<br>\r\n <a href='" . $siteurlactivationlink . "'>" . $siteurlactivationlink . "</a><p>\r\n\r\n Si no puedes entrar pulsando el enlace superior.<br>\r\n Copia y pega el siguiente enlace en tu navegador y entra para validarte.<p>\r\n\r\n Desde la Administración de " . $db->game_config["game_name"] . " te agradecemos tu confianza<br>\r\n Y esperamos que estes aqui durante mucho tiempo."; include $svn_root . 'includes/functions/classes/class.phpmailer.php'; $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->Host = "mail.gmail.com"; // SMTP server $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = $db->game_config["sec_mail"]; // sets the prefix to the servier $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server $mail->Port = $db->game_config["port_mail"]; // set the SMTP port for the GMAIL server $mail->Username = $db->game_config["server_mail"]; // GMAIL username $mail->Password = $db->game_config["pass_mail"]; // GMAIL password $mail->SetFrom($db->game_config["server_mail"], $db->game_config["game_name"]); $mail->AddAddress($NewUser['email_2'], $NewUser['username']); $mail->Subject = "Registro de la cuenta."; $mail->MsgHTML($body); $mail->Send(); } $from = $lang['cu_welcome_message_from']; $sender = $lang['cu_welcome_message_sender']; $Subject = $lang['cu_welcome_message_subject']; $message = $lang['cu_welcome_message_content']; $users->SendSimpleMessage($NewUser['id'], $sender, $Time, 1, $from, $Subject, $message); $db->query("UPDATE {{table}} SET `config_value` = `config_value` + '1' WHERE `config_name` = 'users_amount' LIMIT 1;", 'config'); /* @include('config.php'); $cookie = $NewUser['id'] . "/%/" . $UserName . "/%/" . md5($md5newpass . "--" . $dbsettings["secretword"]) . "/%/" . 0; setcookie($db->game_config['COOKIE_NAME'], $cookie, 0, "/", "", 0); unset($dbsettings); header("location:game.php?page=overview"); */ $displays->message($lang['cu_userok'], "admin.php?page=createuser", 1); } } else { $displays->assignContent("adm/create_user"); $displays->display(); } }
} if ($i == '0') { $Query1 = "INSERT INTO {{table}} SET "; $Query1 .= "`username` = '" . mysql_escape_string(strip_tags($name)) . "', "; $Query1 .= "`email` = '" . mysql_escape_string($email) . "', "; $Query1 .= "`email_2` = '" . mysql_escape_string($email) . "', "; $Query1 .= "`ip_at_reg` = '" . $_SERVER["REMOTE_ADDR"] . "', "; $Query1 .= "`id_planet` = '0', "; $Query1 .= "`register_time` = '" . $time . "', "; $Query1 .= "`onlinetime` = '" . $time . "', "; $Query1 .= "`authlevel` = '" . $auth . "', "; $Query1 .= "`password`='" . $pass . "';"; doquery($Query1, "users"); doquery("UPDATE {{table}} SET `config_value` = config_value + '1' WHERE `config_name` = 'users_amount';", 'config'); $ID_USER = doquery("SELECT `id` FROM {{table}} WHERE `username` = '" . mysql_escape_string($name) . "' LIMIT 1", "users", true); CreateOnePlanetRecord($galaxy, $system, $planet, $ID_USER['id'], $UserPlanet, true); $ID_PLANET = doquery("SELECT `id` FROM {{table}} WHERE `id_owner` = '" . $ID_USER['id'] . "' LIMIT 1", "planets", true); doquery("UPDATE {{table}} SET `id_level` = '" . $auth . "' WHERE `id` = '" . $ID_PLANET['id'] . "'", "planets"); $QryUpdateUser = "******"; $QryUpdateUser .= "`id_planet` = '" . $ID_PLANET['id'] . "', "; $QryUpdateUser .= "`current_planet` = '" . $ID_PLANET['id'] . "', "; $QryUpdateUser .= "`galaxy` = '" . $galaxy . "', "; $QryUpdateUser .= "`system` = '" . $system . "', "; $QryUpdateUser .= "`planet` = '" . $planet . "' "; $QryUpdateUser .= "WHERE "; $QryUpdateUser .= "`id` = '" . $ID_USER['id'] . "' "; $QryUpdateUser .= "LIMIT 1;"; doquery($QryUpdateUser, "users"); $parse['display'] = '<tr><th colspan="2"><font color=lime>' . $lang['new_user_success'] . '</font></tr></th>'; } }
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; } }
function TargetEvent() { global $resource; $iPlanetCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . PLANETS . " WHERE `id_owner` = '" . $this->_fleet['fleet_owner'] . "' AND `planet_type` = '1' AND `destruyed` = '0';"); $iGalaxyPlace = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . PLANETS . " WHERE `id` = '" . $this->_fleet['fleet_end_id'] . "';"); $senderUser = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . USERS . " WHERE `id` = '" . $this->_fleet['fleet_owner'] . "';"); $senderPlanet = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . PLANETS . " WHERE `id` = '" . $this->_fleet['fleet_start_id'] . "';"); $senderUser['factor'] = getFactors($senderUser, 'basic', $this->_fleet['fleet_start_time']); $LNG = $this->getLanguage($senderUser['lang']); $MaxPlanets = PlayerUtil::maxPlanetCount($senderUser); if ($iGalaxyPlace != 0) { $TheMessage = '<div style="text-align : justify;"> ' . sprintf($LNG['ls_fts_colo_1'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'], $LNG['type_missionbis'][$this->_fleet['fleet_mission']]) . ' </div> <div class="citation"> <div class="guillemet ouvrir">«</div> <div class="guillemet fermer">»</div> ' . $LNG['ls_fts_colo_2'] . ' : <ul style="text-align : left;"> <li>' . $LNG['ls_fts_colo_3'] . '</li> <li>' . $LNG['ls_fts_colo_4'] . '</li> <li>' . $LNG['ls_fts_colo_5'] . '</li> <li>' . $LNG['ls_fts_colo_6'] . '</li> <li>' . $LNG['ls_fts_colo_7'] . '</li> <li>' . $LNG['ls_fts_colo_8'] . '</li> </ul> </div> <div class="explication_utilisateur"> ' . $LNG['ls_fts_colo_9'] . ' </div>'; SendSimpleMessage($this->_fleet['fleet_owner'], 0, $this->_fleet['fleet_start_time'], 7, $LNG['sys_colo_mess_from_text1'], sprintf($LNG['sys_colo_mess_report1'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet']), $TheMessage); $this->setState(FLEET_RETURN); } elseif ($iPlanetCount >= $MaxPlanets) { $TheMessage = '<div style="text-align : justify;"> ' . sprintf($LNG['ls_fts_colo_1'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'], $LNG['type_missionbis'][$this->_fleet['fleet_mission']]) . ' </div> <div class="citation"> <div class="guillemet ouvrir">«</div> <div class="guillemet fermer">»</div> ' . $LNG['ls_fts_colo_2'] . ' : <ul style="text-align : left;"> <li>' . $LNG['ls_fts_colo_3'] . '</li> <li>' . $LNG['ls_fts_colo_4'] . '</li> <li>' . $LNG['ls_fts_colo_5'] . '</li> <li>' . $LNG['ls_fts_colo_6'] . '</li> <li>' . $LNG['ls_fts_colo_7'] . '</li> <li>' . $LNG['ls_fts_colo_8'] . '</li> </ul> </div> <div class="explication_utilisateur"> ' . $LNG['ls_fts_colo_9'] . ' </div>'; SendSimpleMessage($this->_fleet['fleet_owner'], 0, $this->_fleet['fleet_start_time'], 7, $LNG['sys_colo_mess_from_text1'], sprintf($LNG['sys_colo_mess_report1'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet']), $TheMessage); $this->setState(FLEET_RETURN); } else { $bonus_iron = mt_rand(1, 40); $bonus_gold = mt_rand(1, 40); $bonus_crys = mt_rand(1, 40); $bonus_elyr = mt_rand(1, 40); $Color = 'vert'; $Color1 = 'vert'; $Color2 = 'vert'; $Color3 = 'vert'; $bonus_iron_perc = rand(1, 55); $bonus_gold_perc = rand(1, 55); $bonus_crys_perc = rand(1, 55); $bonus_elyr_perc = rand(1, 55); if ($bonus_iron_perc >= $bonus_iron) { $bonus_iron *= -1; $Color = 'rouge'; } if ($bonus_gold_perc >= $bonus_gold) { $bonus_gold *= -1; $Color1 = 'rouge'; } if ($bonus_crys_perc >= $bonus_crys) { $bonus_crys *= -1; $Color2 = 'rouge'; } if ($bonus_elyr_perc >= $bonus_elyr) { $bonus_elyr *= -1; $Color3 = 'rouge'; } require_once 'includes/functions/CreateOnePlanetRecord.php'; $NewOwnerPlanet = CreateOnePlanetRecord($this->_fleet['fleet_end_galaxy'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'], $this->_fleet['fleet_universe'], $this->_fleet['fleet_owner'], $LNG['fcp_colony'], false, $senderUser['authlevel'], $bonus_iron, $bonus_gold, $bonus_crys, $bonus_elyr, $iPlanetCount); if ($NewOwnerPlanet === false) { $TheMessage = '<div style="text-align : justify;"> ' . sprintf($LNG['ls_fts_colo_1'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'], $LNG['type_missionbis'][$this->_fleet['fleet_mission']]) . ' </div> <div class="citation"> <div class="guillemet ouvrir">«</div> <div class="guillemet fermer">»</div> ' . $LNG['ls_fts_colo_2'] . ' : <ul style="text-align : left;"> <li>' . $LNG['ls_fts_colo_3'] . '</li> <li>' . $LNG['ls_fts_colo_4'] . '</li> <li>' . $LNG['ls_fts_colo_5'] . '</li> <li>' . $LNG['ls_fts_colo_6'] . '</li> <li>' . $LNG['ls_fts_colo_7'] . '</li> <li>' . $LNG['ls_fts_colo_8'] . '</li> </ul> </div> <div class="explication_utilisateur"> ' . $LNG['ls_fts_colo_9'] . ' </div>'; SendSimpleMessage($this->_fleet['fleet_owner'], 0, $this->_fleet['fleet_start_time'], 7, $LNG['sys_colo_mess_from_text1'], sprintf($LNG['sys_colo_mess_report1'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet']), $TheMessage); $this->setState(FLEET_RETURN); } else { $this->_fleet['fleet_end_id'] = $NewOwnerPlanet; $TheMessage = '<div style="text-align : justify;"> ' . $LNG['sys_col_1'] . ' [' . $this->_fleet['fleet_end_system'] . ':' . $this->_fleet['fleet_end_planet'] . ']. ' . $LNG['sys_col_2'] . ' : </div> <div class="citation"> <div class="guillemet ouvrir">«</div> <div class="guillemet fermer">»</div> ' . $LNG['sys_col_3'] . ' </div> <h3>' . $LNG['sys_col_4'] . ' : </h3> <div class="conteneur_item" style="margin-top : 5px;"> <div class="element_item"> <img src="/media/ingame/image/metal.jpg"> ' . $LNG['sys_col_5'] . ' « ' . $LNG['tech'][901] . ' » : <span class="' . $Color . '">' . $bonus_iron . '%</span> </div> <div class="element_item"> <img src="/media/ingame/image/oro.jpg"> ' . $LNG['sys_col_5'] . ' « ' . $LNG['tech'][902] . ' » : <span class="' . $Color1 . '">' . $bonus_gold . '%</span> </div> <div class="element_item"> <img src="/media/ingame/image/crystal.jpg"> ' . $LNG['sys_col_5'] . ' « ' . $LNG['tech'][903] . ' » : <span class="' . $Color2 . '">' . $bonus_crys . '%</span> </div> <div class="element_item"> <img src="/media/ingame/image/elyrium.jpg"> ' . $LNG['sys_col_5'] . ' « ' . $LNG['tech'][904] . ' » : <span class="' . $Color3 . '">' . $bonus_elyr . '%</span> </div> </div>'; $this->StoreGoodsToPlanet(); if ($this->_fleet['fleet_amount'] == 1) { $this->KillFleet(); } else { $CurrentFleet = explode(";", $this->_fleet['fleet_array']); $NewFleet = ''; foreach ($CurrentFleet as $Item => $Group) { if (empty($Group)) { continue; } $Class = explode(",", $Group); if ($Class[0] == 208 && $Class[1] > 1) { $NewFleet .= $Class[0] . "," . ($Class[1] - 1) . ";"; } elseif ($Class[0] != 208 && $Class[1] > 0) { $NewFleet .= $Class[0] . "," . $Class[1] . ";"; } } $this->UpdateFleet('fleet_array', $NewFleet); $this->UpdateFleet('fleet_amount', $this->_fleet['fleet_amount'] - 1); $this->UpdateFleet('fleet_resource_metal', 0); $this->UpdateFleet('fleet_resource_crystal', 0); $this->UpdateFleet('fleet_resource_deuterium', 0); $this->UpdateFleet('fleet_resource_elyrium', 0); $this->setState(FLEET_RETURN); } SendSimpleMessage($this->_fleet['fleet_owner'], 0, $this->_fleet['fleet_start_time'], 7, $LNG['sys_colo_mess_from_text'], sprintf($LNG['sys_colo_mess_report2'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet']), $TheMessage); } } $this->SaveFleet(); }
} break; } $QrySelectGalaxy = "SELECT * "; $QrySelectGalaxy .= "FROM {{table}} "; $QrySelectGalaxy .= "WHERE "; $QrySelectGalaxy .= "`galaxy` = '" . $Galaxy . "' AND "; $QrySelectGalaxy .= "`system` = '" . $System . "' AND "; $QrySelectGalaxy .= "`planet` = '" . $Planet . "' "; $QrySelectGalaxy .= "LIMIT 1;"; $GalaxyRow = doquery($QrySelectGalaxy, 'galaxy', true); if ($GalaxyRow["id_planet"] == "0") { $newpos_checked = true; } if (!$GalaxyRow) { CreateOnePlanetRecord($Galaxy, $System, $Planet, $NewUser['id'], $UserPlanet, true); $newpos_checked = true; } if ($newpos_checked) { doquery("UPDATE {{table}} SET `config_value` = '" . $LastSettedGalaxyPos . "' WHERE `config_name` = 'LastSettedGalaxyPos';", 'config'); doquery("UPDATE {{table}} SET `config_value` = '" . $LastSettedSystemPos . "' WHERE `config_name` = 'LastSettedSystemPos';", 'config'); doquery("UPDATE {{table}} SET `config_value` = '" . $LastSettedPlanetPos . "' WHERE `config_name` = 'LastSettedPlanetPos';", 'config'); } } // Recherche de la reference de la nouvelle planete (qui est unique normalement ! $PlanetID = doquery("SELECT `id` FROM {{table}} WHERE `id_owner` = '" . $NewUser['id'] . "' LIMIT 1;", 'planets', true); // Mise a jour de l'enregistrement utilisateur avec les infos de sa planete mere $QryUpdateUser = "******"; $QryUpdateUser .= "`id_planet` = '" . $PlanetID['id'] . "', "; $QryUpdateUser .= "`current_planet` = '" . $PlanetID['id'] . "', "; $QryUpdateUser .= "`galaxy` = '" . $Galaxy . "', ";
function ResetUniverse() { global $db, $USER; $db->query("RENAME TABLE " . PLANETS . " TO " . PLANETS . "_s;"); $db->query("RENAME TABLE " . USERS . " TO " . USERS . "_s;"); $db->query("CREATE TABLE IF NOT EXISTS " . PLANETS . " ( LIKE " . PLANETS . "_s );"); $db->query("CREATE TABLE IF NOT EXISTS " . USERS . " ( LIKE " . USERS . "_s );"); $DelRW = $db->query("SELECT `rid` FROM " . RW . ";"); if (isset($DelRW)) { while ($RID = $db->fetch_array($DelRW)) { @unlink(ROOT_PATH . 'raports/raport_' . $RID['rid'] . '.php'); } } $db->free_result($DelRW); $TKBRW = $db->query("SELECT `rid` FROM " . TOPKB . ";"); if (isset($TKBRW)) { while ($RID = $db->fetch_array($TKBRW)) { @unlink(ROOT_PATH . 'raports/topkb_' . $RID['rid'] . '.php'); } } $db->free_result($TKBRW); $db->query("TRUNCATE TABLE " . AKS . ";"); $db->query("TRUNCATE TABLE " . ALLIANCE . ";"); $db->query("TRUNCATE TABLE " . BANNED . ";"); $db->query("TRUNCATE TABLE " . BUDDY . ";"); $db->query("TRUNCATE TABLE " . ERRORS . ";"); $db->query("TRUNCATE TABLE " . FLEETS . ";"); $db->query("TRUNCATE TABLE " . MESSAGES . ";"); $db->query("TRUNCATE TABLE " . NOTES . ";"); $db->query("TRUNCATE TABLE " . RW . ";"); $db->query("TRUNCATE TABLE " . SUPP . ";"); $db->query("TRUNCATE TABLE " . STATPOINTS . ";"); $db->query("TRUNCATE TABLE " . TOPKB . ";"); $AllUsers = $db->query("SELECT `username`,`password`,`email`, `email_2`,`authlevel`,`rights`,`galaxy`,`system`,`planet`, `dpath`, `onlinetime`, `register_time`, `id_planet` FROM " . USERS . "_s;"); $LimitTime = TIMESTAMP - 30 * (24 * (60 * 60)); $TransUser = 0; require_once ROOT_PATH . 'includes/functions/CreateOnePlanetRecord.' . PHP_EXT; while ($TheUser = $db->fetch_array($AllUsers)) { if ($TheUser['onlinetime'] <= $LimitTime) { continue; } $SQL = "INSERT INTO " . USERS . " SET "; $SQL .= "`username` = '" . $TheUser['username'] . "', "; $SQL .= "`email` = '" . $TheUser['email'] . "', "; $SQL .= "`email_2` = '" . $TheUser['email_2'] . "', "; $SQL .= "`id_planet` = '0', "; $SQL .= "`authlevel` = '" . $TheUser['authlevel'] . "', "; $SQL .= "`rights` = '" . $TheUser['rights'] . "', "; $SQL .= "`dpath` = '" . $TheUser['dpath'] . "', "; $SQL .= "`galaxy` = '" . $TheUser['galaxy'] . "', "; $SQL .= "`system` = '" . $TheUser['system'] . "', "; $SQL .= "`planet` = '" . $TheUser['planet'] . "', "; $SQL .= "`register_time` = '" . $TheUser['register_time'] . "', "; $SQL .= "`onlinetime` = '" . TIMESTAMP . "', "; $SQL .= "`password` = '" . $TheUser['password'] . "';"; $db->query($SQL); $NewUser = $db->uniquequery("SELECT `id` FROM " . USERS . " WHERE `username` = '" . $TheUser['username'] . "' LIMIT 1;"); $UserPlanet = $db->uniquequery("SELECT `name` FROM " . PLANETS . "_s WHERE `id` = '" . $TheUser['id_planet'] . "';"); CreateOnePlanetRecord($TheUser['galaxy'], $TheUser['system'], $TheUser['planet'], $NewUser['id'], $UserPlanet['name'], true, $TheUser['authlevel']); $PlanetID = $db->uniquequery("SELECT `id` FROM " . PLANETS . " WHERE `id_owner` = '" . $NewUser['id'] . "' LIMIT 1;"); $SQL = "UPDATE " . USERS . " SET `id_planet` = '" . $PlanetID['id'] . "' WHERE `id` = '" . $NewUser['id'] . "';"; $db->query($SQL); $TransUser++; } $db->query("UPDATE " . CONFIG . " SET `config_value` = '" . $TransUser . "' WHERE `config_name` = 'users_amount' LIMIT 1;"); $db->query("DROP TABLE " . PLANETS . "_s;"); $db->query("DROP TABLE " . USERS . "_s;"); }
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; } }
} } if (!empty($errors)) { message(implode('<br>', $errors), $lang['Reg_InvalidForm']); } else { $data = array('username' => $formData['character'], 'email' => $formData['email'], 'email_2' => $formData['email'], 'sex' => $formData['sex'], 'ip_at_reg' => $_SERVER['REMOTE_ADDR'], 'register_time' => new Zend_Db_Expr('UNIX_TIMESTAMP()'), 'password' => md5($formData['passwrd'])); $readConnection->insert($readConnection->getDeprecatedTable('users'), $data); $userId = $readConnection->lastInsertId($readConnection->getDeprecatedTable('users')); $galaxy = $game_config['LastSettedSystemPos'] == MAX_SYSTEM_IN_GALAXY ? $game_config['LastSettedGalaxyPos'] + 1 : (int) $game_config['LastSettedGalaxyPos']; if ($galaxy != $game_config['LastSettedGalaxyPos']) { $system = 1; } else { $system = $game_config['LastSettedPlanetPos'] == 12 ? $game_config['LastSettedSystemPos'] + 1 : (int) $game_config['LastSettedSystemPos']; } $planet = $game_config['LastSettedPlanetPos'] == 12 ? 4 : $game_config['LastSettedPlanetPos'] + 4; $planetId = CreateOnePlanetRecord($galaxy, $system, $planet, $userId, $formData['planet'], true); $readConnection->update($readConnection->getDeprecatedTable('config'), array('config_value' => $galaxy), array('config_name =?' => 'LastSettedGalaxyPos')); $readConnection->update($readConnection->getDeprecatedTable('config'), array('config_value' => $system), array('config_name =?' => 'LastSettedSystemPos')); $readConnection->update($readConnection->getDeprecatedTable('config'), array('config_value' => $planet), array('config_name =?' => 'LastSettedPlanetPos')); $planetData = array('id_planet' => $planetId, 'current_planet' => $planetId, 'galaxy' => $galaxy, 'system' => $system, 'planet' => $planet); $readConnection->update($readConnection->getDeprecatedTable('users'), $planetData, array('id =?' => $userId)); SendSimpleMessage($userId, 'Admin', time(), 1, $lang['Reg_SenderMessageIg'], $lang['Reg_SubjectMessageIg'], $lang['Reg_TextMessageIg']); $readConnection->update($readConnection->getDeprecatedTable('config'), array('config_value' => 'users_amount + 1'), array('config_name =?' => 'users_amount')); if (($x = sendPassMail($formData['email'], $formData['passwrd'])) == true) { $message = $lang['Reg_ThanksForRegistry'] . " ({$formData['email']})"; } else { $message = $lang['Reg_ThanksForRegistry'] . " ({$formData['email']})"; $message .= "<br><br>{$lang['error_mailsend']}<b>{$formData['passwrd']}</b>"; } message($message, $lang['Reg_WellDone']); }
} break; } $QrySelectGalaxy = "SELECT * "; $QrySelectGalaxy .= "FROM {{table}} "; $QrySelectGalaxy .= "WHERE "; $QrySelectGalaxy .= "`galaxy` = '" . $Galaxy . "' AND "; $QrySelectGalaxy .= "`system` = '" . $System . "' AND "; $QrySelectGalaxy .= "`planet` = '" . $Planet . "' "; $QrySelectGalaxy .= "LIMIT 1;"; $GalaxyRow = doquery($QrySelectGalaxy, 'galaxy', true); if ($GalaxyRow["id_planet"] == "0") { $newpos_checked = true; } if (!$GalaxyRow) { CreateOnePlanetRecord($Galaxy, $System, $Planet, $NewUser['id'], $lang['sys_pp_defaultname'], true); $newpos_checked = true; } if ($newpos_checked) { doquery("UPDATE {{table}} SET `config_value` = '" . $LastSettedGalaxyPos . "' WHERE `config_name` = 'LastSettedGalaxyPos';", 'config'); doquery("UPDATE {{table}} SET `config_value` = '" . $LastSettedSystemPos . "' WHERE `config_name` = 'LastSettedSystemPos';", 'config'); doquery("UPDATE {{table}} SET `config_value` = '" . $LastSettedPlanetPos . "' WHERE `config_name` = 'LastSettedPlanetPos';", 'config'); } } $PlanetID = doquery("SELECT `id` FROM {{table}} WHERE `id_owner` = '" . $NewUser['id'] . "' LIMIT 1;", 'planets', true); $QryUpdateUser = "******"; $QryUpdateUser .= "`id_planet` = '" . $PlanetID['id'] . "', "; $QryUpdateUser .= "`current_planet` = '" . $PlanetID['id'] . "', "; $QryUpdateUser .= "`galaxy` = '" . $Galaxy . "', "; $QryUpdateUser .= "`system` = '" . $System . "', "; $QryUpdateUser .= "`planet` = '" . $Planet . "' ";
if ($LastSettedPlanetPos < 3) { $LastSettedPlanetPos += 1; } else { if ($LastSettedSystemPos > $CONF['max_system']) { $LastSettedGalaxyPos += 1; $LastSettedSystemPos = 1; $LastSettedPlanetPos = 1; } else { $LastSettedSystemPos += 1; $LastSettedPlanetPos = 1; } if ($LastSettedGalaxyPos > $CONF['max_system']) { $LastSettedGalaxyPos = 1; } } $PlanetID = CreateOnePlanetRecord($LastSettedGalaxyPos, $LastSettedSystemPos, $Planet, $UNI, $NewUser, $UserPlanet, true); } $SQL = "UPDATE " . USERS . " SET "; $SQL .= "`id_planet` = '" . $PlanetID . "', "; $SQL .= "`universe` = '" . $UNI . "', "; $SQL .= "`galaxy` = '" . $LastSettedGalaxyPos . "', "; $SQL .= "`system` = '" . $LastSettedSystemPos . "', "; $SQL .= "`planet` = '" . $Planet . "' "; $SQL .= "WHERE "; $SQL .= "`id` = '" . $NewUser . "' "; $SQL .= "LIMIT 1;"; $GLOBALS['DATABASE']->query($SQL); $SQL = "INSERT INTO " . BOTS . " (`id`, `player`, `last_time`, `every_time`, `last_planet`, `type`) VALUES (NULL, " . $NewUser . ", 0, 2, " . $PlanetID . ", 0);"; $GLOBALS['DATABASE']->query($SQL); echo "OK - " . $Num . " - " . $NewUser . "<br>\r\n"; }
function XNovaResetUnivers($CurrentUser) { global $lang, $Adminerlaubt, $user; if ($user['username'] == Metusalem and in_array($user['id'], $Adminerlaubt)) { doquery("RENAME TABLE {{table}} TO {{table}}_s", 'planets'); doquery("RENAME TABLE {{table}} TO {{table}}_s", 'users'); doquery("CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'planets'); doquery("CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'users'); doquery("TRUNCATE TABLE {{table}}", 'aks'); doquery("TRUNCATE TABLE {{table}}", 'alliance'); doquery("TRUNCATE TABLE {{table}}", 'annonce'); doquery("TRUNCATE TABLE {{table}}", 'banned'); doquery("TRUNCATE TABLE {{table}}", 'buddy'); doquery("TRUNCATE TABLE {{table}}", 'chat'); doquery("TRUNCATE TABLE {{table}}", 'galaxy'); doquery("TRUNCATE TABLE {{table}}", 'errors'); doquery("TRUNCATE TABLE {{table}}", 'fleets'); doquery("TRUNCATE TABLE {{table}}", 'iraks'); doquery("TRUNCATE TABLE {{table}}", 'lunas'); doquery("TRUNCATE TABLE {{table}}", 'messages'); doquery("TRUNCATE TABLE {{table}}", 'notes'); doquery("TRUNCATE TABLE {{table}}", 'rw'); doquery("TRUNCATE TABLE {{table}}", 'statpoints'); $AllUsers = doquery("SELECT `username`,`password`,`email`, `email_2`,`authlevel`,`galaxy`,`system`,`planet`, `volk`, `sex`, `avatar`, `dpath`, `onlinetime`, `register_time`, `id_planet` FROM {{table}} WHERE 1;", 'users_s'); $LimitTime = time() - 15 * (24 * (60 * 60)); $TransUser = 0; while ($TheUser = mysql_fetch_assoc($AllUsers)) { if ($TheUser['onlinetime'] > $LimitTime) { $UserPlanet = doquery("SELECT `name` FROM {{table}} WHERE `id` = '" . $TheUser['id_planet'] . "';", 'planets_s', true); if ($UserPlanet['name'] != "") { $QryInsertUser = "******"; $QryInsertUser .= "`username` = '" . $TheUser['username'] . "', "; $QryInsertUser .= "`email` = '" . $TheUser['email'] . "', "; $QryInsertUser .= "`email_2` = '" . $TheUser['email_2'] . "', "; $QryInsertUser .= "`volk` = '" . $TheUser['volk'] . "', "; $QryInsertUser .= "`sex` = '" . $TheUser['sex'] . "', "; $QryInsertUser .= "`avatar` = '" . $TheUser['avatar'] . "', "; $QryInsertUser .= "`id_planet` = '1', "; $QryInsertUser .= "`authlevel` = '" . $TheUser['authlevel'] . "', "; $QryInsertUser .= "`dpath` = '" . $TheUser['dpath'] . "', "; $QryInsertUser .= "`galaxy` = '" . $TheUser['galaxy'] . "', "; $QryInsertUser .= "`system` = '" . $TheUser['system'] . "', "; $QryInsertUser .= "`planet` = '" . $TheUser['planet'] . "', "; $QryInsertUser .= "`register_time` = '" . $TheUser['register_time'] . "', "; $QryInsertUser .= "`password` = '" . $TheUser['password'] . "';"; doquery($QryInsertUser, 'users'); $NewUser = doquery("SELECT `id` FROM {{table}} WHERE `username` = '" . $TheUser['username'] . "' LIMIT 1;", 'users', true); CreateOnePlanetRecord($TheUser['galaxy'], $TheUser['system'], $TheUser['planet'], $NewUser['id'], $UserPlanet['name'], true); $PlanetID = doquery("SELECT `id` FROM {{table}} WHERE `id_owner` = '" . $NewUser['id'] . "' LIMIT 1;", 'planets', true); $QryUpdateUser = "******"; $QryUpdateUser .= "`id_planet` = '" . $PlanetID['id'] . "', "; $QryUpdateUser .= "`current_planet` = '" . $PlanetID['id'] . "' "; $QryUpdateUser .= "WHERE "; $QryUpdateUser .= "`id` = '" . $NewUser['id'] . "';"; doquery($QryUpdateUser, 'users'); $TransUser++; } } } doquery("UPDATE {{table}} SET `config_value` = '" . $TransUser . "' WHERE `config_name` = 'users_amount' LIMIT 1;", 'config'); //Piraten einfügen in Galaxy $QryTableGalaxypirat = "INSERT INTO `{{table}}` (`galaxy`, `system`, `planet`, `id_planet`, `metal`, `crystal`, `deuterium`, `appolonium`,`id_luna`, `luna`) VALUES"; $QryTableGalaxypirat .= "(1, 22, 7, 2, 0, 0, 0, 0, 0, 0),"; $QryTableGalaxypirat .= "(1, 27, 12, 3, 0, 0, 0, 0, 0, 0),"; $QryTableGalaxypirat .= "(1, 40, 6, 4, 0, 0, 0, 0, 0, 0);"; doquery($QryTableGalaxypirat, 'galaxy'); //Ende //Pirat einfügen in Planets $QryTablePlanetspirat = "INSERT INTO `{{table}}` (`id`, `name`, `id_owner`, `id_level`, `galaxy`, `system`, `planet`, `last_update`, `planet_type`, `destruyed`, `b_building`, `b_building_id`, `b_tech`, `b_tech_id`, `b_hangar`, `b_hangar_id`, `b_hangar_plus`, `image`, `diameter`, `points`, `ranks`, `field_current`, `field_max`, `temp_min`, `temp_max`, `metal`, `metal_perhour`, `metal_max`, `crystal`, `crystal_perhour`, `crystal_max`, `deuterium`, `deuterium_perhour`, `deuterium_max`, `appolonium`, `appolonium_perhour`, `appolonium_max`, `energy_used`, `energy_max`, `metal_mine`, `crystal_mine`, `deuterium_sintetizer`, `appolonium_mine`,`solar_plant`, `fusion_plant`, `robot_factory`, `nano_factory`, `hangar`, `defence_factory`, `metal_store`, `crystal_store`, `deuterium_store`, `appolonium_store`, `laboratory`, `technodrom`, `ressgate`, `mondtransformer`, `terraformer`, `ally_deposit`, `silo`, `small_ship_cargo`, `big_ship_cargo`, `light_hunter`, `heavy_hunter`, `crusher`, `battle_ship`, `colonizer`, `recycler`, `spy_sonde`, `bomber_ship`, `solar_satelit`, `destructor`, `dearth_star`, `battleship`, `lune_noir`, `ev_transporter`, `star_crasher`, `giga_recykler`, `misil_launcher`, `small_laser`, `big_laser`, `gauss_canyon`, `ionic_canyon`, `buster_canyon`, `Gravitonka`, `small_protection_shield`, `big_protection_shield`, `gig_protection_shield`, `interceptor_misil`, `interplanetary_misil`, `metal_mine_porcent`, `crystal_mine_porcent`, `deuterium_sintetizer_porcent`, `appolonium_mine_porcent`, `solar_plant_porcent`, `fusion_plant_porcent`, `solar_satelit_porcent`, `mondbasis`, `phalanx`, `sprungtor`, `last_jump_time`, `last_beam_time`, `deuterium_used`) VALUES"; $QryTablePlanetspirat .= "(2, 'Piratentraum', 2, 0, 1, 22, 7, 1269344553, 1, 0, 0, '0', 0, 0, 0, '', 0, 'piratenplanet', 74475, 844901055, 0, 292, 1000, -11, 29, 1373487083, 222862, 60455000000, 1093524482, 148574, 60455000000, 756888034, 90557, 60455000000, 0, 0, 15000000, -314091, 1643471, 30, 30, 30, 0, 50, 0, 16, 12, 22, 1, 20, 20, 20, 0, 20, 0, 0, 1, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 0, 10000, 0, 5000, 5000, 10000, 1000, 0, 1893, 19367, 0, 1851, 1537, 5726, 5700, '', '', '', 0, 0, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, '0'),"; $QryTablePlanetspirat .= "(3, 'Piratenbay', 3, 0, 1, 27, 12, 1268088532, 1, 0, 0, '0', 0, 0, 0, '', 0, 'piratenplanet', 74475, 79382496920, 0, 126, 1000, -68, -28, 7625585342, 0, 15000000, 3786419255, 0, 15000000, 209142083, 0, 15000000, 15428405293, 0, 15000000, 0, 0, 0, 0, 0, 0, 0, 0, 11, 25, 20, 18, 0, 0, 0, 0, 22, 0, 0, 0, 30, 23898, 95964, 10000, 10000, 20000, 21996, 0, 0, 0, 12000, 0, 25000, 30300, 53003, 23000, 30000, 54000, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', '0', 0, 0, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, '0'),"; $QryTablePlanetspirat .= "(4, 'Pirateninsel', 4, 0, 1, 40, 6, 1268088673, 1, 0, 0, '0', 0, 0, 0, '', 0, 'piratenplanet', 74475, 25536577446, 0, 319, 1000, 65, 105, 19814353549, 7820799, 154750000000, 2399046214, 4093531, 154750000000, 2935250625, 1714689, 154750000000, 12384079222, 0, 15000000, -7991672, 16904282, 40, 38, 0, 36, 50, 0, 18, 20, 22, 0, 22, 22, 22, 0, 16, 0, 0, 1, 12, 1832, 0, 0, 0, 0, 0, 0, 0, 0, 4113, 0, 5545, 24254, 0, 12276, 0, 50150, 0, 0, 0, 0, 0, 0, 0, 0, '', '', '', 0, 0, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, '0');"; doquery($QryTablePlanetspirat, 'planets'); //Ende //Pirat einfügen in Users $QryTableUserspirat = "INSERT INTO `{{table}}` (`id`, `username`, `password`, `email`, `email_2`, `lang`, `authlevel`, `volk`, `sex`, `avatar`, `sign`, `id_planet`, `galaxy`, `system`, `planet`, `current_planet`, `user_lastip`, `ip_at_reg`, `user_agent`, `current_page`, `register_time`, `onlinetime`, `dpath`, `design`, `noipcheck`, `planet_sort`, `planet_sort_order`, `spio_anz`, `settings_tooltiptime`, `settings_fleetactions`, `settings_allylogo`, `settings_esp`, `settings_wri`, `settings_bud`, `settings_mis`, `settings_rep`, `urlaubs_modus`, `urlaubs_modus_time`, `urlaubs_until`, `db_deaktjava`, `new_message`, `fleet_shortcut`, `b_tech_planet`, `spy_tech`, `prod_op`, `computer_tech`, `military_tech`, `defence_tech`, `shield_tech`, `energy_tech`, `hyperspace_tech`, `combustion_tech`, `impulse_motor_tech`, `hyperspace_motor_tech`, `laser_tech`, `ionic_tech`, `buster_tech`, `intergalactic_tech`, `expedition_tech`, `graviton_tech`, `ally_id`, `ally_name`, `ally_request`, `ally_request_text`, `ally_register_time`, `ally_rank_id`, `current_luna`, `kolorminus`, `kolorplus`, `kolorpoziom`, `rpg_geologue`, `rpg_amiral`, `rpg_ingenieur`, `rpg_technocrate`, `rpg_espion`, `rpg_constructeur`, `rpg_scientifique`, `rpg_commandant`, `rpg_points`, `rpg_stockeur`, `rpg_defenseur`, `rpg_destructeur`, `rpg_general`, `rpg_bunker`, `rpg_raideur`, `rpg_empereur`, `lvl_minier`, `lvl_raid`, `xpraid`, `xpminier`, `raids`, `p_infligees`, `mnl_alliance`, `mnl_joueur`, `mnl_attaque`, `mnl_spy`, `mnl_exploit`, `mnl_transport`, `mnl_expedition`, `mnl_general`, `mnl_buildlist`, `bana`, `multi_validated`, `banaday`, `raids1`, `raidswin`, `raidsloose`, `wons`, `loos`, `draws`, `kbmetal`, `kbcrystal`, `kbappolonium`, `lostunits`, `desunits`, `inaktivitaet`, `deltime`, `NoteOp`, `angriffszone`) VALUES"; $QryTableUserspirat .= "(2, 'Sorry', 'd3e9a99a09a8c6d7fb8c78cf4e5a9a2c', '*****@*****.**', '*****@*****.**', 'de', 0, 'A', 'M', 'A', NULL, 2, 1, 22, 7, 2, '101.96.157.19', '', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)', '/V4/galaxy.php?mode=0', 1262876845, 1269344553, '', 1, 1, 0, 0, 1, 5, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, NULL, 0, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 9, 0, ' ', 0, NULL, 0, 0, 0, 'red', '#00FF00', 'yellow', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 22, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0, NULL, 10, 12, 16, 11, 1, 826982958900, 404100470600, 0, 1663651468000, 528635861544, 1, 0, NULL, 15),"; $QryTableUserspirat .= "(3, 'Piratenbraut', 'd3e9a99a09a8c6d7fb8c78cf4e5a9a2c', '*****@*****.**', '*****@*****.**', 'de', 0, 'B', 'F', 'http://metusalem.spacequadrat.de/XNovav3/images/Piratenbraut.gif', NULL, 3, 1, 27, 12, 3, '102.130.71.234', '', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)', '/V4/logout.php', 1264720663, 1268088537, '', 1, 1, 0, 0, 1, 5, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, NULL, 0, 40, 22, 20, 30, 30, 30, 20, 20, 30, 28, 26, 25, 20, 20, 14, 20, 9, 0, ' ', 0, NULL, 0, 0, 0, '', '', '', 13, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 1, 18, 357, 0, 357, 0, 0, 5, 436, 13, 0, 2, 0, 0, 2, 0, NULL, 0, NULL, 59, 298, 60, 303, 6, 78538938741600, 39038059820800, 0, 181926332209000, 5103990687710, 1, 0, NULL, 15),"; $QryTableUserspirat .= "(4, 'Rotzloeffel', 'd3e9a99a09a8c6d7fb8c78cf4e5a9a2c', '*****@*****.**', '*****@*****.**', 'de', 0, 'C', 'M', 'C', NULL, 4, 1, 40, 6, 4, '103.130.71.234', '', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)', '/V4/overview.php', 1266780179, 1268088673, '', 1, 1, 0, 0, 1, 5, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, NULL, 0, 30, 22, 20, 33, 33, 33, 22, 20, 22, 21, 20, 25, 20, 20, 14, 15, 9, 0, ' ', 0, NULL, 0, 0, 0, 'red', '#00FF00', 'yellow', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 28, 0, 28, 0, 0, 1, 44, 2, 0, 0, 0, 0, 0, 0, NULL, 0, NULL, 11, 17, 20, 13, 0, 2937103255370, 1754575698710, 0, 7528558047000, 1484141972300, 0, 0, NULL, 15);"; doquery($QryTableUserspirat, 'users'); //Ende doquery("DROP TABLE {{table}}", 'planets_s'); doquery("DROP TABLE {{table}}", 'users_s'); AdminMessage($TransUser . $lang['adm_rz_done'], $lang['adm_rz_ttle']); } else { AdminMessage($lang['sys_noalloaw'], $lang['sys_noaccess']); } return $Page; }
function ResetThisFuckingCheater($UserID) { global $lang, $user; includeLang('error/cheat'); $page = $lang; $TheUser = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $UserID . "';", 'users', true); $UserPlanet = doquery("SELECT `name` FROM {{table}} WHERE `id` = '" . $TheUser['id_planet'] . "';", 'planets', true); DeleteSelectedUser($UserID); if ($UserPlanet['name'] != "") { $Now = time(); // Aktuelles Datum $BanTime = 259200; // Sperrzeit 60(Sekunden) mal 60(Minuten) mal 24(Stunden) mal 3(Tage) = 259200 $BannedUntil = $Now + $BanTime; // Aktuelles Datum mal Sperrzeit $QryInsertUser = "******"; $QryInsertUser .= "`id` = '" . $TheUser['id'] . "', "; $QryInsertUser .= "`username` = '" . $TheUser['username'] . "', "; $QryInsertUser .= "`email` = '" . $TheUser['email'] . "', "; $QryInsertUser .= "`email_2` = '" . $TheUser['email_2'] . "', "; $QryInsertUser .= "`sex` = '" . $TheUser['sex'] . "', "; $QryInsertUser .= "`volk` = '" . $TheUser['volk'] . "', "; $QryInsertUser .= "`avatar` = '" . $TheUser['avatar'] . "', "; $QryInsertUser .= "`id_planet` = '" . $TheUser['id_planet'] . "', "; $QryInsertUser .= "`authlevel` = '" . $TheUser['authlevel'] . "', "; $QryInsertUser .= "`dpath` = '" . $TheUser['dpath'] . "', "; $QryInsertUser .= "`galaxy` = '" . $TheUser['galaxy'] . "', "; $QryInsertUser .= "`system` = '" . $TheUser['system'] . "', "; $QryInsertUser .= "`planet` = '" . $TheUser['planet'] . "', "; $QryInsertUser .= "`register_time` = '" . $TheUser['register_time'] . "', "; $QryInsertUser .= "`password` = '" . $TheUser['password'] . "'; "; doquery($QryInsertUser, 'users'); $QryInsertBan = "INSERT INTO {{table}} SET "; $QryInsertBan .= "`id` = '" . $TheUser['id'] . "', "; $QryInsertBan .= "`who` = '" . $TheUser['username'] . "', "; $QryInsertBan .= "`theme` = '" . $lang['cheat_001'] . "',"; $QryInsertBan .= "`who2` = '',"; $QryInsertBan .= "`time` = '" . $Now . "',"; $QryInsertBan .= "`longer` = '" . $BannedUntil . "',"; $QryInsertBan .= "`author` = '" . $lang['cheat_002'] . "',"; $QryInsertBan .= "`email` = '';"; doquery($QryInsertBan, 'banned'); $NewUser = doquery("SELECT `id` FROM {{table}} WHERE `username` = '" . $TheUser['username'] . "' LIMIT 1;", 'users', true); CreateOnePlanetRecord($TheUser['galaxy'], $TheUser['system'], $TheUser['planet'], $NewUser['id'], $UserPlanet['name'], true); $PlanetID = doquery("SELECT `id` FROM {{table}} WHERE `id_owner` = '" . $NewUser['id'] . "' LIMIT 1;", 'planets', true); $QryUpdateUser = "******"; $QryUpdateUser .= "`id_planet` = '" . $PlanetID['id'] . "', "; $QryUpdateUser .= "`current_planet` = '" . $PlanetID['id'] . "' "; $QryUpdateUser .= "WHERE "; $QryUpdateUser .= "`id` = '" . $NewUser['id'] . "';"; doquery($QryUpdateUser, 'users'); } $QryUpdateUser = "******"; $QryUpdateUser .= "`bana` = '1', "; $QryUpdateUser .= "`banaday` = '" . $BannedUntil . "' "; $QryUpdateUser .= "WHERE "; $QryUpdateUser .= "`username` = \"" . $TheUser['username'] . "\";"; doquery($QryUpdateUser, 'users'); if ($TheUser) { $sq = doquery("SELECT * FROM {{table}}", "users"); $Time = time(); $From = "<font color='#FF0000'><b>" . $lang['cheat_002'] . "</b></font>"; $Subject = "<font color='#FF0000'><b>" . $lang['cheat_001'] . "</b></font>"; $Message = "<font color='#FF0000'><b>" . $lang['cheat_003'] . "" . $TheUser['username'] . "" . $lang['cheat_004'] . "" . $lang['cheat_005'] . "" . $lang['cheat_006'] . "" . $lang['cheat_007'] . "" . $lang['cheat_008'] . "" . $lang['cheat_009'] . "" . $lang['cheat_010'] . "" . $lang['cheat_011'] . "" . $lang['cheat_012'] . "" . $lang['cheat_013'] . "</b></font>"; $summery = 0; while ($u = mysql_fetch_array($sq)) { SendSimpleMessage($u['id'], $user['id'], $Time, 1, $From, $Subject, $Message); } } echo $page; }
function XNovaResetUnivers($CurrentUser) { global $lang, $Adminerlaubt, $user; if ($user['id'] == 1 and in_array($user['id'], $Adminerlaubt)) { doquery("RENAME TABLE {{table}} TO {{table}}_s", 'planets'); doquery("RENAME TABLE {{table}} TO {{table}}_s", 'users'); doquery("CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'planets'); doquery("CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'users'); doquery("TRUNCATE TABLE {{table}}", 'aks'); doquery("TRUNCATE TABLE {{table}}", 'alliance'); doquery("TRUNCATE TABLE {{table}}", 'annonce'); doquery("TRUNCATE TABLE {{table}}", 'banned'); doquery("TRUNCATE TABLE {{table}}", 'buddy'); doquery("TRUNCATE TABLE {{table}}", 'chat'); doquery("TRUNCATE TABLE {{table}}", 'galaxy'); doquery("TRUNCATE TABLE {{table}}", 'errors'); doquery("TRUNCATE TABLE {{table}}", 'fleets'); doquery("TRUNCATE TABLE {{table}}", 'iraks'); doquery("TRUNCATE TABLE {{table}}", 'lunas'); doquery("TRUNCATE TABLE {{table}}", 'messages'); doquery("TRUNCATE TABLE {{table}}", 'notes'); doquery("TRUNCATE TABLE {{table}}", 'rw'); doquery("TRUNCATE TABLE {{table}}", 'statpoints'); $AllUsers = doquery("SELECT `username`,`password`,`email`, `email_2`,`authlevel`,`galaxy`,`system`,`planet`, `sex`, `dpath`, `onlinetime`, `register_time`, `id_planet` FROM {{table}} WHERE 1;", 'users_s'); $LimitTime = time() - 15 * (24 * (60 * 60)); $TransUser = 0; while ($TheUser = mysql_fetch_assoc($AllUsers)) { if ($TheUser['onlinetime'] > $LimitTime) { $UserPlanet = doquery("SELECT `name` FROM {{table}} WHERE `id` = '" . $TheUser['id_planet'] . "';", 'planets_s', true); if ($UserPlanet['name'] != "") { $QryInsertUser = "******"; $QryInsertUser .= "`username` = '" . $TheUser['username'] . "', "; $QryInsertUser .= "`email` = '" . $TheUser['email'] . "', "; $QryInsertUser .= "`email_2` = '" . $TheUser['email_2'] . "', "; $QryInsertUser .= "`sex` = '" . $TheUser['sex'] . "', "; $QryInsertUser .= "`id_planet` = '0', "; $QryInsertUser .= "`authlevel` = '" . $TheUser['authlevel'] . "', "; $QryInsertUser .= "`dpath` = '" . $TheUser['dpath'] . "', "; $QryInsertUser .= "`galaxy` = '" . $TheUser['galaxy'] . "', "; $QryInsertUser .= "`system` = '" . $TheUser['system'] . "', "; $QryInsertUser .= "`planet` = '" . $TheUser['planet'] . "', "; $QryInsertUser .= "`register_time` = '" . $TheUser['register_time'] . "', "; $QryInsertUser .= "`password` = '" . $TheUser['password'] . "';"; doquery($QryInsertUser, 'users'); $NewUser = doquery("SELECT `id` FROM {{table}} WHERE `username` = '" . $TheUser['username'] . "' LIMIT 1;", 'users', true); CreateOnePlanetRecord($TheUser['galaxy'], $TheUser['system'], $TheUser['planet'], $NewUser['id'], $UserPlanet['name'], true); $PlanetID = doquery("SELECT `id` FROM {{table}} WHERE `id_owner` = '" . $NewUser['id'] . "' LIMIT 1;", 'planets', true); $QryUpdateUser = "******"; $QryUpdateUser .= "`id_planet` = '" . $PlanetID['id'] . "', "; $QryUpdateUser .= "`current_planet` = '" . $PlanetID['id'] . "' "; $QryUpdateUser .= "WHERE "; $QryUpdateUser .= "`id` = '" . $NewUser['id'] . "';"; doquery($QryUpdateUser, 'users'); $TransUser++; } } } doquery("UPDATE {{table}} SET `config_value` = '" . $TransUser . "' WHERE `config_name` = 'users_amount' LIMIT 1;", 'config'); doquery("DROP TABLE {{table}}", 'planets_s'); doquery("DROP TABLE {{table}}", 'users_s'); AdminMessage($TransUser . $lang['adm_rz_done'], $lang['adm_rz_ttle']); } else { AdminMessage($lang['sys_noalloaw'], $lang['sys_noaccess']); } return $Page; }
function XNovaResetUnivers($CurrentUser) { global $lang; if ($CurrentUser['authlevel'] == 4) { // Copier la table users et planets vers des tables de replis ! doquery("RENAME TABLE {{table}} TO {{table}}_s", 'planets'); doquery("RENAME TABLE {{table}} TO {{table}}_s", 'users'); // Recreer la structure des tables renommées doquery("CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'planets'); doquery("CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'users'); // Vider toutes les tables ! doquery("TRUNCATE TABLE {{table}}", 'aks'); doquery("TRUNCATE TABLE {{table}}", 'alliance'); doquery("TRUNCATE TABLE {{table}}", 'annonce'); doquery("TRUNCATE TABLE {{table}}", 'banned'); doquery("TRUNCATE TABLE {{table}}", 'buddy'); doquery("TRUNCATE TABLE {{table}}", 'chat'); doquery("TRUNCATE TABLE {{table}}", 'galaxy'); doquery("TRUNCATE TABLE {{table}}", 'errors'); doquery("TRUNCATE TABLE {{table}}", 'fleets'); doquery("TRUNCATE TABLE {{table}}", 'iraks'); doquery("TRUNCATE TABLE {{table}}", 'lunas'); doquery("TRUNCATE TABLE {{table}}", 'messages'); doquery("TRUNCATE TABLE {{table}}", 'notes'); doquery("TRUNCATE TABLE {{table}}", 'rw'); doquery("TRUNCATE TABLE {{table}}", 'statpoints'); $AllUsers = doquery("SELECT `username`,`password`,`email`, `email_2`,`authlevel`,`galaxy`,`system`,`planet`, `sex`, `dpath`, `onlinetime`, `register_time`, `id_planet` FROM {{table}} WHERE 1;", 'users_s'); $LimitTime = time() - 15 * (24 * (60 * 60)); $TransUser = 0; while ($TheUser = mysql_fetch_assoc($AllUsers)) { if ($TheUser['onlinetime'] > $LimitTime) { $UserPlanet = doquery("SELECT `name` FROM {{table}} WHERE `id` = '" . $TheUser['id_planet'] . "';", 'planets_s', true); if ($UserPlanet['name'] != "") { // Creation de l'utilisateur $QryInsertUser = "******"; $QryInsertUser .= "`username` = '" . $TheUser['username'] . "', "; $QryInsertUser .= "`email` = '" . $TheUser['email'] . "', "; $QryInsertUser .= "`email_2` = '" . $TheUser['email_2'] . "', "; $QryInsertUser .= "`sex` = '" . $TheUser['sex'] . "', "; $QryInsertUser .= "`id_planet` = '0', "; $QryInsertUser .= "`authlevel` = '" . $TheUser['authlevel'] . "', "; $QryInsertUser .= "`dpath` = '" . $TheUser['dpath'] . "', "; $QryInsertUser .= "`galaxy` = '" . $TheUser['galaxy'] . "', "; $QryInsertUser .= "`system` = '" . $TheUser['system'] . "', "; $QryInsertUser .= "`planet` = '" . $TheUser['planet'] . "', "; $QryInsertUser .= "`register_time` = '" . $TheUser['register_time'] . "', "; $QryInsertUser .= "`password` = '" . $TheUser['password'] . "';"; doquery($QryInsertUser, 'users'); // On cherche le numero d'enregistrement de l'utilisateur fraichement cr�� $NewUser = doquery("SELECT `id` FROM {{table}} WHERE `username` = '" . $TheUser['username'] . "' LIMIT 1;", 'users', true); CreateOnePlanetRecord($TheUser['galaxy'], $TheUser['system'], $TheUser['planet'], $NewUser['id'], $UserPlanet['name'], true); // Recherche de la reference de la nouvelle planete (qui est unique normalement ! $PlanetID = doquery("SELECT `id` FROM {{table}} WHERE `id_owner` = '" . $NewUser['id'] . "' LIMIT 1;", 'planets', true); // Mise a jour de l'enregistrement utilisateur avec les infos de sa planete mere $QryUpdateUser = "******"; $QryUpdateUser .= "`id_planet` = '" . $PlanetID['id'] . "', "; $QryUpdateUser .= "`current_planet` = '" . $PlanetID['id'] . "' "; $QryUpdateUser .= "WHERE "; $QryUpdateUser .= "`id` = '" . $NewUser['id'] . "';"; doquery($QryUpdateUser, 'users'); $TransUser++; } } } // while // Mise a jour du nombre de joueurs inscripts doquery("UPDATE {{table}} SET `config_value` = '" . $TransUser . "' WHERE `config_name` = 'users_amount' LIMIT 1;", 'config'); // Menage on vire les tables transitoires doquery("DROP TABLE {{table}}", 'planets_s'); doquery("DROP TABLE {{table}}", 'users_s'); AdminMessage($TransUser . $lang['adm_rz_done'], $lang['adm_rz_ttle']); } else { AdminMessage($lang['sys_noalloaw'], $lang['sys_noaccess']); } return $Page; }
function MissionCaseColonisation($FleetRow) { global $lang, $resource, $formulas; //Get the current user (note it must be $currentUser for the $formulas eval'd code to work, see includes/formulas.php $CurrentUser = doquery("SELECT * FROM {{table}} WHERE `id` = '" . idstring($FleetRow['owner_userid']) . "' LIMIT 1 ;", 'users', true); //How many planets do we have? $userplanets = mysql_num_rows(doquery("SELECT `id` FROM {{table}} WHERE `id_owner` = '" . $CurrentUser['id'] . "' AND `planet_type` = '1'", 'planets')); //How many planets are allowed? $maxplanets = eval($formulas['max_planets_c']); //If we have less than (but not equal to) the max planets count. if ($userplanets < $maxplanets) { //Now the slightly trickbit, as we were not messing around with gal sys and planet in the database we now had to have a numeric id for the gsp. $g = strlen(MAX_GALAXY_IN_WORLD); $s = strlen(MAX_SYSTEM_IN_GALAXY); $p = strlen(MAX_PLANET_IN_SYSTEM); $galaxy = substr($FleetRow['target_id'], 0, $g) * 1; $system = substr($FleetRow['target_id'], $g, $s) * 1; $planet = substr($FleetRow['target_id'], $g + $s, $p) * 1; unset($g, $s, $p); //Check that these planets are within the allowed range if ($CurrentUser[$resource[124]] < 4) { $minpos = 4; } elseif ($CurrentUser[$resource[124]] < 6) { $minpos = 3; } elseif ($CurrentUser[$resource[124]] < 8) { $minpos = 2; } else { $minpos = 1; } $maxpos = MAX_PLANET_IN_SYSTEM + 1 - $minpos; if ($planet >= $minpos && $planet <= $maxpos) { //Now get the target position $TargetAdress = sprintf($lang['sys_adress_planet'], $galaxy, $system, $planet); //See if we have a planet here already? $cur = doquery("SELECT `id` FROM {{table}} WHERE `galaxy` = '" . $galaxy . "' AND `system` = '" . $system . "' AND `planet` = '" . $planet . "';", 'planets', true); if ($cur['id'] > 0) { $message = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_notfree']; PM($CurrentUser['id'], 0, $message, $lang['sys_colo_mess_report'], $lang['sys_colo_mess_from'], 2); } else { //No planet lets carry on. if (CreateOnePlanetRecord($galaxy, $system, $planet, $CurrentUser['id'], $lang['sys_colo_defaultname'], false)) { //Message them that the planet has been made. $message = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_allisok']; PM($CurrentUser['id'], 0, $message, $lang['sys_colo_mess_report'], $lang['sys_colo_mess_from'], 2); //If there is more than just a colony ship then we should put that fleet on the planet. if ($FleetRow['shipcount'] > 0) { $fleet = explode(";", $FleetRow['array']); $sql = ""; $upd = 0; foreach ($fleet as $info) { if (strlen($info) > 0) { $ship = explode(",", $info); if ($ship[0] == 208) { $ship[1]--; } if ($ship[1] > 0) { $sql .= "`" . $resource[$ship[0]] . "` = '" . idstring($ship[1]) . "' , "; $upd += $ship[1]; } } } if ($upd > 0 && strlen(substr_replace($sql, '', -2)) > 3) { doquery("UPDATE {{table}} SET " . substr_replace($sql, '', -2) . " WHERE `galaxy` = '" . $galaxy . "' AND `system` = '" . $system . "' AND `planet` = '" . $planet . "' ;", 'planets'); } } //And put resources on the planet. doquery("UPDATE {{table}} SET `metal` = '" . $FleetRow['metal'] . "' , `crystal` = '" . $FleetRow['crystal'] . "' , `deuterium` = '" . $FleetRow['deuterium'] . "' WHERE `galaxy` = '" . $galaxy . "' AND `system` = '" . $system . "' AND `planet` = '" . $planet . "' LIMIT 1 ;", 'planets'); } else { //We could not make the colony $message = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_badpos']; PM($CurrentUser['id'], 0, $message, $lang['sys_colo_mess_report'], $lang['sys_colo_mess_from'], 2); } } } else { //We don't have astro-physics high enough $message = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_outside_range'] . $lang['sys_colo_slots'] . "[" . $minpos . "-" . $maxpos . "]!"; PM($CurrentUser['id'], 0, $message, $lang['sys_colo_mess_report'], $lang['sys_colo_mess_from'], 2); } } else { //We don't have astro-physics high enough $message = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_maxcolo'] . $maxplanets . $lang['sys_colo_planet']; PM($CurrentUser['id'], 0, $message, $lang['sys_colo_mess_report'], $lang['sys_colo_mess_from'], 2); } }