本文整理汇总了PHP中CreateOnePlanetRecord函数的典型用法代码示例。如果您正苦于以下问题:PHP CreateOnePlanetRecord函数的具体用法?PHP CreateOnePlanetRecord怎么用?PHP CreateOnePlanetRecord使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CreateOnePlanetRecord函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowResetAdmin
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 = "INSERT INTO {{table}} SET ";
$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 = "UPDATE {{table}} SET ";
$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");
}
示例2: MissionCaseColonisation
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');
}
}
示例3: ResetUniverse
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 = "INSERT INTO {{table}} SET ";
$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 = "UPDATE {{table}} SET ";
$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');
}
示例4: TargetEvent
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();
}
示例5: TargetEvent
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();
}
示例6: TargetEvent
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();
}
示例7: ResetThisFuckingCheater
/**
* 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 = "INSERT INTO {{table}} SET ";
$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 = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`id_planet` = '" . $PlanetID['id'] . "', ";
$QryUpdateUser .= "`current_planet` = '" . $PlanetID['id'] . "' ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`id` = '" . $NewUser['id'] . "';";
doquery($QryUpdateUser, 'users');
}
return;
}
示例8: CreateOnePlanetRecord
$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;
}
示例9: doquery
$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') {
示例10: ShowCreateUserAdmin
//.........这里部分代码省略.........
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 = "UPDATE {{table}} SET ";
$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) {
示例11: mysql_escape_string
}
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 = "UPDATE {{table}} SET ";
$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>';
}
}
示例12: ShowCreatorPage
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 = '" . $db->sql_escape($UserName) . "' OR email = '" . $db->sql_escape($UserEmail) . "';");
$Exist['vaild'] = $db->uniquequery("SELECT username, email FROM " . USERS_VALID . " WHERE username = '" . $db->sql_escape($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];
}
//.........这里部分代码省略.........
示例13: TargetEvent
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>
//.........这里部分代码省略.........
示例14: doquery
}
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 = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`id_planet` = '" . $PlanetID['id'] . "', ";
$QryUpdateUser .= "`current_planet` = '" . $PlanetID['id'] . "', ";
$QryUpdateUser .= "`galaxy` = '" . $Galaxy . "', ";
示例15: ResetUniverse
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;");
}