本文整理汇总了PHP中DeleteSelectedUser函数的典型用法代码示例。如果您正苦于以下问题:PHP DeleteSelectedUser函数的具体用法?PHP DeleteSelectedUser怎么用?PHP DeleteSelectedUser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DeleteSelectedUser函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
$CONF = Config::getAll(NULL, ROOT_UNI);
$unis = array_keys(Config::getAll(NULL));
$GLOBALS['DATABASE']->query("LOCK TABLES " . ALLIANCE . " WRITE, " . ALLIANCE_REQUEST . " WRITE,\n\t\t\t\t\t\t\t\t\t" . BUDDY . " WRITE, " . CONFIG . " WRITE, " . FLEETS . " WRITE, " . FLEETS_EVENT . " WRITE, \n\t\t\t\t\t\t\t\t\t" . NOTES . " WRITE, " . MESSAGES . " WRITE, " . PLANETS . " WRITE, \n\t\t\t\t\t\t\t\t\t" . RW . " WRITE, " . SESSION . " WRITE, " . STATPOINTS . " WRITE, \n\t\t\t\t\t\t\t\t\t" . TOPKB . " WRITE, " . TOPKB_USERS . " WRITE, " . USERS . " WRITE;");
//Delete old messages
$del_before = TIMESTAMP - $CONF['del_oldstuff'] * 86400;
$del_inactive = TIMESTAMP - $CONF['del_user_automatic'] * 86400;
$del_deleted = TIMESTAMP - $CONF['del_user_manually'] * 86400;
$GLOBALS['DATABASE']->multi_query("DELETE FROM " . MESSAGES . " WHERE `message_time` < '" . $del_before . "';\n\t\t\t\t\t\t DELETE FROM " . ALLIANCE . " WHERE `ally_members` = '0';\n\t\t\t\t\t\t DELETE FROM " . PLANETS . " WHERE `destruyed` < " . TIMESTAMP . " AND `destruyed` != 0;\n\t\t\t\t\t\t DELETE FROM " . SESSION . " WHERE `lastonline` < '" . (TIMESTAMP - SESSION_LIFETIME) . "';\n\t\t\t\t\t\t DELETE FROM " . FLEETS_EVENT . " WHERE fleetID NOT IN (SELECT fleet_id FROM " . FLEETS . ");\n\t\t\t\t\t\t UPDATE " . USERS . " SET `email_2` = `email` WHERE `setmail` < '" . TIMESTAMP . "';");
$ChooseToDelete = $GLOBALS['DATABASE']->query("SELECT `id` FROM `" . USERS . "` WHERE `authlevel` = '" . AUTH_USR . "' AND ((`db_deaktjava` != 0 AND `db_deaktjava` < '" . $del_deleted . "')" . ($del_inactive == TIMESTAMP ? "" : " OR `onlinetime` < '" . $del_inactive . "'") . ");");
if (isset($ChooseToDelete)) {
include_once 'includes/functions/DeleteSelectedUser.php';
while ($delete = $GLOBALS['DATABASE']->fetch_array($ChooseToDelete)) {
DeleteSelectedUser($delete['id']);
}
}
$GLOBALS['DATABASE']->free_result($ChooseToDelete);
foreach ($unis as $uni) {
$battleHallLowest = $GLOBALS['DATABASE']->getFirstCell("SELECT units FROM " . TOPKB . " WHERE `universe` = " . $uni . " ORDER BY units DESC LIMIT 99,1;");
if (isset($battleHallLowest)) {
$GLOBALS['DATABASE']->query("DELETE " . TOPKB . ", " . TOPKB_USERS . " FROM " . TOPKB . " INNER JOIN " . TOPKB_USERS . " USING (rid) WHERE `universe` = " . $uni . " AND `units` < " . $battleHallLowest . ";");
}
}
$GLOBALS['DATABASE']->query("DELETE FROM " . RW . " WHERE `time` < " . $del_before . " AND `rid` NOT IN (SELECT `rid` FROM " . TOPKB . ");");
$GLOBALS['DATABASE']->query("UNLOCK TABLES;");
}
示例2: run
function run()
{
require_once 'includes/functions/DeleteSelectedUser.php';
$stats_sql = 'SELECT DISTINCT * FROM uni1_users WHERE `register_time` < ' . (TIMESTAMP - 48 * 60 * 60) . ' AND `experience_peace_level` < 1;';
$query = $GLOBALS['DATABASE']->query($stats_sql);
while ($x = $GLOBALS['DATABASE']->fetch_array($query)) {
DeleteSelectedUser($x['id']);
}
}
示例3: ShowUserlistAdmin
function ShowUserlistAdmin($user)
{
global $lang, $svn_root, $db, $displays;
if ($user['authlevel'] < 2) {
die($displays->message($lang['not_enough_permissions']));
}
// $parse = $lang;
if ($_GET['cmd'] == 'dele') {
DeleteSelectedUser($_GET['user']);
}
if ($_GET['cmd'] == 'sort') {
$TypeSort = $_GET['type'];
} else {
$TypeSort = "id";
}
$query = $db->query("SELECT `id`,`username`,`email`,`ip_at_reg`,`user_lastip`,`register_time`,`onlinetime`,`bana`,`banaday`, `activate_status` FROM {{table}} ORDER BY `" . $TypeSort . "` ASC", 'users');
$lang['adm_ul_table'] = "";
$i = 0;
$Color = "green ";
$displays->assignContent("adm/userlist_body");
while ($u = mysql_fetch_assoc($query)) {
$displays->newblock("lista_jugadores");
$i++;
if ($PrevIP != "") {
if ($PrevIP == $u['user_lastip']) {
$Color = "red";
} else {
$Color = "green";
}
}
$Bloc['adm_ul_data_id'] = $u['id'];
$Bloc['adm_ul_data_name'] = $u['username'];
$Bloc['adm_ul_data_mail'] = $u['email'];
$Bloc['ip_adress_at_register'] = $u['ip_at_reg'];
$Bloc['adm_ul_data_adip'] = "<font color=\"" . $Color . "\">" . $u['user_lastip'] . "</font>";
$Bloc['adm_ul_data_regd'] = gmdate("d/m/Y G:i:s", $u['register_time']);
$Bloc['adm_ul_data_lconn'] = gmdate("d/m/Y G:i:s", $u['onlinetime']);
$Bloc['adm_ul_data_banna'] = $u['bana'] == 1 ? "<a href=# title=\"" . gmdate("d/m/Y G:i:s", $u['banaday']) . "\">" . $lang['ul_yes'] . "</a>" : $lang['ul_no'];
$Bloc['adm_ul_data_actio'] = $u['id'] != $user['id'] && $user['authlevel'] >= 3 ? "<a href=\"?page=userlist&cmd=dele&user=" . $u['id'] . "\" border=\"0\" onclick=\"return confirm('" . $lang['ul_sure_you_want_dlte'] . " {$u['username']}?');\"><img border=\"0\" src=\"" . $svn_root . "styles/images/r1.png\"></a>" : "-";
$PrevIP = $u['user_lastip'];
//$Bloc['actived'] = $u['activate_status']==1 ? "Si" : "No";
$Bloc['actived'] = gmdate("d/m/Y G:i:s", $u['activate_status']);
foreach ($Bloc as $key => $value) {
$displays->assign($key, $value);
}
}
$lang['adm_ul_count'] = $i;
$displays->display();
}
示例4: DeleteSome
private function DeleteSome()
{
global $db;
$db->query("LOCK TABLES " . ALLIANCE . " WRITE, " . BUDDY . " WRITE, " . CONFIG . " WRITE, " . FLEETS . " WRITE, " . NOTES . " WRITE, " . MESSAGES . " WRITE, " . PLANETS . " WRITE, " . RW . " WRITE, " . SESSION . " WRITE, " . SUPP . " WRITE, " . STATPOINTS . " WRITE, " . TOPKB . " WRITE, " . USERS . " WRITE;");
//Delete old messages
$del_before = strtotime("-3 day");
$del_inactive = strtotime("-30 day");
$del_deleted = strtotime("-7 day");
$db->multi_query("DELETE FROM `" . MESSAGES . "` WHERE `message_time` < '" . $del_before . "';DELETE FROM " . SUPP . " WHERE `time` < '" . $del_before . "' AND `status` = 0;DELETE FROM " . ALLIANCE . " WHERE `ally_members` = '0';DELETE FROM " . PLANETS . " WHERE `destruyed` < " . TIMESTAMP . " AND `destruyed` != 0;UPDATE " . USERS . " SET `email_2` = `email` WHERE `setmail` < '" . TIMESTAMP . "';DELETE FROM " . SESSION . " WHERE `user_lastactivity` < '" . (TIMESTAMP - SESSION_LIFETIME) . "';UPDATE " . USERS . " SET `banaday` = '0', `bana` = '0' WHERE `banaday` <= '" . TIMESTAMP . "';");
$ChooseToDelete = $db->query("SELECT `id` FROM `" . USERS . "` WHERE `authlevel` = '0' AND ((`db_deaktjava` != 0 AND `db_deaktjava` < '" . $del_deleted . "') OR `onlinetime` < '" . $del_inactive . "');");
if (isset($ChooseToDelete)) {
include_once ROOT_PATH . 'includes/functions/DeleteSelectedUser.php';
while ($delete = $db->fetch_array($ChooseToDelete)) {
DeleteSelectedUser($delete['id']);
}
}
$db->free_result($ChooseToDelete);
$DelRW = $db->query("SELECT `rid` FROM " . RW . " WHERE `time` < '" . $del_before . "';");
if (isset($DelRW)) {
while ($RID = $db->fetch_array($DelRW)) {
if (file_exists(ROOT_PATH . 'raports/topkb_' . $RID['rid'] . '.php')) {
unlink(ROOT_PATH . 'raports/raport_' . $RID['rid'] . '.php');
}
}
$db->query("DELETE FROM " . RW . " WHERE `time` < '" . $del_before . "';");
}
$db->free_result($DelRW);
$TopKBLow = $db->uniquequery("SELECT gesamtunits FROM " . TOPKB . " ORDER BY gesamtunits DESC LIMIT 99,1;");
if (isset($TopKBLow)) {
$TKBRW = $db->query("SELECT `rid` FROM " . TOPKB . " WHERE `gesamtunits` < '" . (isset($TopKBLow) ? $TopKBLow['gesamtunits'] : 0) . "';");
if (isset($TKBRW)) {
while ($RID = $db->fetch_array($TKBRW)) {
if (file_exists(ROOT_PATH . 'raports/topkb_' . $RID['rid'] . '.php')) {
unlink(ROOT_PATH . 'raports/topkb_' . $RID['rid'] . '.php');
}
}
$db->query("DELETE FROM " . TOPKB . " WHERE `gesamtunits` < '" . (isset($TopKBLow) ? $TopKBLow['gesamtunits'] : 0) . "';");
}
$db->free_result($TKBRW);
}
$db->query("UNLOCK TABLES;");
}
示例5: 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;
}
示例6: ShowSearchPage
function ShowSearchPage()
{
global $LNG, $db;
if ($_GET['delete'] == 'user') {
DeleteSelectedUser((int) $_GET['user']);
message($LNG['se_delete_succes_p'], '?page=search&search=users&minimize=on', 2);
} elseif ($_GET['delete'] == 'planet') {
DeleteSelectedPlanet((int) $_GET['planet']);
message($LNG['se_delete_succes_p'], '?page=search&search=planet&minimize=on', 2);
}
$SearchFile = request_var('search', '');
$SearchFor = request_var('search_in', '');
$SearchMethod = request_var('fuki', '');
$SearchKey = request_var('key_user', '');
$Page = request_var('side', 0);
$Order = request_var('key_order', '');
$OrderBY = request_var('key_acc', '');
$limit = request_var('limit', 25);
$Selector = array('list' => array('users' => $LNG['se_users'], 'planet' => $LNG['se_planets'], 'moon' => $LNG['se_moons'], 'alliance' => $LNG['se_allys'], 'vacation' => $LNG['se_vacations'], 'banned' => $LNG['se_suspended'], 'admin' => $LNG['se_authlevels'], 'inactives' => $LNG['se_inactives'], 'online' => $LNG['online_users'], 'p_connect' => $LNG['se_planets_act']), 'search' => array('name' => $LNG['se_input_name'], 'id' => $LNG['input_id']), 'filter' => array('normal' => $LNG['se_type_all'], 'exacto' => $LNG['se_type_exact'], 'last' => $LNG['se_type_last'], 'first' => $LNG['se_type_first']), 'order' => array('ASC' => $LNG['se_input_asc'], 'DESC' => $LNG['se_input_desc']), 'limit' => array('1' => '1', '5' => '5', '10' => '10', '15' => '15', '20' => '20', '25' => '25', '50' => '50', '100' => '100', '200' => '200', '500' => '500'));
$template = new template();
$template->page_header();
if (request_var('minimize', '') == 'on') {
$Minimize = "&minimize=on";
$template->assign_vars(array('minimize' => 'checked = "checked"', 'diisplaay' => 'style="display:none;"'));
}
switch ($SearchMethod) {
case 'exacto':
$SpecifyWhere = "= '" . $db->sql_escape($SearchKey) . "'";
break;
case 'last':
$SpecifyWhere = "LIKE '" . $db->sql_escape($SearchKey, true) . "%'";
break;
case 'first':
$SpecifyWhere = "LIKE '%" . $db->sql_escape($SearchKey, true) . "'";
break;
default:
$SpecifyWhere = "LIKE '%" . $db->sql_escape($SearchKey, true) . "%'";
break;
}
if (!empty($SearchFile)) {
$ArrayUsers = array("users", "vacation", "admin", "inactives", "online");
$ArrayPlanets = array("planet", "moon", "p_connect");
$ArrayBanned = array("banned");
$ArrayAlliance = array("alliance");
if (in_array($SearchFile, $ArrayUsers)) {
$Table = "users";
$NameLang = $LNG['se_search_users'];
$SpecifyItems = "id,username,email_2,onlinetime,register_time,user_lastip,authlevel,bana,urlaubs_modus";
$SName = $LNG['se_input_userss'];
if ($SearchFile == "vacation") {
$SpecialSpecify = "AND urlaubs_modus = '1'";
$SName = $LNG['se_input_vacatii'];
}
if ($SearchFile == "online") {
$SpecialSpecify = "AND onlinetime >= '" . (TIMESTAMP - 15 * 60) . "'";
$SName = $LNG['se_input_connect'];
}
if ($SearchFile == "inactives") {
$SpecialSpecify = "AND onlinetime < '" . (TIMESTAMP - 60 * 60 * 24 * 7) . "'";
$SName = $LNG['se_input_inact'];
}
if ($SearchFile == "admin") {
$SpecialSpecify = "AND authlevel <= '" . $USER['authlevel'] . "' AND authlevel > '0'";
$SName = $LNG['se_input_admm'];
}
$SearchFor == "name" ? $WhereItem = "WHERE username" : ($WhereItem = "WHERE id");
$ArrayOSec = array("id", "username", "email_2", "onlinetime", "register_time", "user_lastip", "authlevel", "bana", "urlaubs_modus");
$Array0SecCount = count($ArrayOSec);
for ($OrderNum = 0; $OrderNum < $Array0SecCount; $OrderNum++) {
$OrderBYParse[$ArrayOSec[$OrderNum]] = $LNG['se_search_users'][$OrderNum];
}
} elseif (in_array($SearchFile, $ArrayPlanets)) {
$Table = "planets";
$TableUsers = "2";
$NameLang = $LNG['se_search_planets'];
$SpecifyItems = "id,name,id_owner,last_update,galaxy,system,planet,id_luna";
if ($SearchFile == "planet") {
$SpecialSpecify = "AND planet_type = '1'";
$SName = $LNG['se_input_planett'];
}
if ($SearchFile == "moon") {
$SpecialSpecify = "AND planet_type = '3'";
$SName = $LNG['se_input_moonn'];
}
if ($SearchFile == "p_connect") {
$SpecialSpecify = "AND last_update >= '" . (TIMESTAMP - 60 * 60) . "'";
$SName = $LNG['se_input_act_pla'];
}
$SearchFor == "name" ? $WhereItem = "WHERE name" : ($WhereItem = "WHERE id");
$ArrayOSec = array("id", "name", "id_owner", "id_luna", "last_update", "galaxy", "system", "planet");
$Array0SecCount = count($ArrayOSec);
for ($OrderNum = 0; $OrderNum < $Array0SecCount; $OrderNum++) {
$OrderBYParse[$ArrayOSec[$OrderNum]] = $LNG['se_search_planets'][$OrderNum];
}
} elseif (in_array($SearchFile, $ArrayBanned)) {
$Table = "banned";
$NameLang = $LNG['se_search_banned'];
$SpecifyItems = "id,who,time,longer,theme,author";
$SName = $LNG['se_input_susss'];
$SearchFor == "name" ? $WhereItem = "WHERE who" : ($WhereItem = "WHERE id");
//.........这里部分代码省略.........
示例7: doquery
doquery("DELETE FROM {{table}} WHERE `id` = '" . $OnePlanet['id'] . "';", 'planets');
}
doquery("DELETE FROM {{table}} WHERE `message_sender` = '" . $UserID . "';", 'messages');
doquery("DELETE FROM {{table}} WHERE `message_owner` = '" . $UserID . "';", 'messages');
doquery("DELETE FROM {{table}} WHERE `owner` = '" . $UserID . "';", 'notes');
doquery("DELETE FROM {{table}} WHERE `fleet_owner` = '" . $UserID . "';", 'fleets');
//doquery ( "DELETE FROM {{table}} WHERE `id_owner1` = '" . $UserID . "';", 'rw' );
//doquery ( "DELETE FROM {{table}} WHERE `id_owner2` = '" . $UserID . "';", 'rw' );
doquery("DELETE FROM {{table}} WHERE `sender` = '" . $UserID . "';", 'buddy');
doquery("DELETE FROM {{table}} WHERE `owner` = '" . $UserID . "';", 'buddy');
doquery("DELETE FROM {{table}} WHERE `id` = '" . $UserID . "';", 'users');
doquery("UPDATE `{{table}}` SET `config_value` = `config_value` - '1' WHERE `config_name` = 'users_amount' LIMIT 1 ;", "config");
}
$parse = $lang;
if ($_GET['cmd'] == 'dele') {
DeleteSelectedUser($_GET['user']);
}
if ($_GET['cmd'] == 'sort') {
$TypeSort = $_GET['type'];
} else {
$TypeSort = "id";
}
$query = doquery("SELECT `id`,`id_planet`,`username`,`email`,`ip_at_reg`,`user_lastip`,`register_time`,`onlinetime`,`bana`,`banaday`,`urlaubs_modus`,`galaxy`,`system`,`planet`,`urlaubs_until` FROM {{table}} ORDER BY `" . $TypeSort . "` ASC", 'users');
$parse['adm_ul_table'] = "";
$i = 0;
$Color = "green ";
while ($u = mysql_fetch_assoc($query)) {
if ($PrevIP != "") {
if ($PrevIP == $u['user_lastip']) {
$Color = "red";
} else {
示例8: MakeStats
function MakeStats()
{
global $resource, $pricelist, $reslist, $game_config, $xgp_root, $phpEx;
$CheckUserQuery = false;
$CheckAllyQuery = false;
// Initial Time
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
//Initial Memory
$result['initial_memory'] = array(round(memory_get_usage() / 1024, 1), round(memory_get_usage(1) / 1024, 1));
//Change the last stats time
$stats_time = time();
//Delete old messages
$del_before = time() - 24 * 60 * 60;
// 1 DAY
$del_inactive = time() - 60 * 60 * 24 * 30;
// 1 MONTH
$del_deleted = time() - 60 * 60 * 24 * 7;
// 1 WEEK
$ChooseToDelete = doquery("SELECT `id` FROM `{{table}}` WHERE (`db_deaktjava` < '" . $del_deleted . "' AND `db_deaktjava` <> 0) OR `onlinetime` < '" . $del_inactive . "'", 'users');
if ($ChooseToDelete) {
include_once $xgp_root . 'includes/functions/DeleteSelectedUser.' . $phpEx;
while ($delete = mysql_fetch_array($ChooseToDelete)) {
DeleteSelectedUser($delete[id]);
}
}
doquery("DELETE FROM {{table}} WHERE `message_time` < '" . $del_before . "' ;", 'messages');
doquery("DELETE FROM {{table}} WHERE `time` < '" . $del_before . "' ;", 'rw');
//STATS FOR USERS....
//Here we make the select query, with this all the custom stuff with be included
$select_defenses = '';
foreach ($reslist['defense'] as $n => $Defense) {
if ($resource[$Defense] != 'small_protection_shield' && $resource[$Defense] != 'big_protection_shield') {
$select_defenses .= " SUM(p." . $resource[$Defense] . ") AS " . $resource[$Defense] . ",";
}
}
$select_buildings = '';
foreach ($reslist['build'] as $n => $Building) {
$select_buildings .= " p." . $resource[$Building] . ",";
}
$selected_tech = '';
foreach ($reslist['tech'] as $n => $Techno) {
$selected_tech .= " u." . $resource[$Techno] . ",";
}
$select_fleets = '';
foreach ($reslist['fleet'] as $n => $Fleet) {
$select_fleets .= " SUM(p." . $resource[$Fleet] . ") AS " . $resource[$Fleet] . ",";
}
//If you have some data type enmu is better if you put it here, because that data give a error in the SUM function.
$selected_enum = "p.small_protection_shield, p.big_protection_shield";
//For now...
$select_planet = "p.id_owner,";
//For Stats table..
$select_old_ranks = "id_owner, stat_type,tech_rank AS old_tech_rank, build_rank AS old_build_rank, defs_rank AS old_defs_rank, fleet_rank AS old_fleet_rank, total_rank AS old_total_rank";
//For users table
$select_user = " u.id, u.ally_id, u.authlevel ";
//We check how many users are for not overload the server...
$total_users = doquery("SELECT COUNT(*) AS `count` FROM {{table}} WHERE 1;", 'users', true);
//We will make query every $game_config['stat_amount'] users
//Min amount = 10, if it is less than 10, it is not a good system
$game_config['stat_amount'] = $game_config['stat_amount'] >= 10 ? $game_config['stat_amount'] : 10;
$amount_per_block = $game_config['stat_amount'] < $game_config['users_amount'] ? $game_config['users_amount'] : $game_config['stat_amount'];
if ($total_users['count'] > $amount_per_block) {
$LastQuery = roundUp($total_users['count'] / $amount_per_block);
} else {
$LastQuery = 1;
}
for ($Query = 1; $Query <= $LastQuery; $Query++) {
if ($Query == 1) {
//based on:http://www.desarrolloweb.com/articulos/1035.php
$start = 0;
} else {
$start = ($Query - 1) * $amount_per_block;
}
$minmax_sql = 'SELECT Max(id) AS `max`, Min(id) AS `min` FROM
(SELECT id FROM {{table}}users ORDER BY id ASC LIMIT
' . $start . ',' . $amount_per_block . ') AS A';
$minmax = doquery($minmax_sql, '', true);
$sql_parcial = 'SELECT ' . $select_buildings . $select_planet . $selected_enum . ', p.id FROM {{table}}planets as p WHERE p.id_owner <=' . $minmax['max'] . ' AND p.id_owner >= ' . $minmax['min'] . ';';
//We delete now the old stats of the users
$sql_old_stats = 'SELECT ' . $select_old_ranks . ' FROM {{table}} WHERE stat_type = 1 AND stat_code = 1 AND id_owner <= ' . $minmax['max'] . ' AND id_owner >= ' . $minmax['min'] . ';';
//Here we make the array with the planets buildings array and the user id and planet id for use in the next step...
//Here we excecute all the querys
$parcial_data = doquery($sql_parcial, '');
//Here we obtained the stuff that can not be SUM
while ($CurPlanet = mysql_fetch_assoc($parcial_data)) {
$Buildings_array[$CurPlanet['id_owner']][$CurPlanet['id']] = $CurPlanet;
//We made a array with the content of the query
}
unset($CurPlanet, $parcial_data);
$old_stats = doquery($sql_old_stats, 'statpoints');
while ($CurStats = mysql_fetch_assoc($old_stats)) {
$old_stats_array[$CurStats['id_owner']] = $CurStats;
}
unset($CurStats, $old_stats);
//We take the data of flying fleets if stat_flying is =1 in game config
//If you have trouble with the RAM and CPU usage, please set stat_flying = 0 and a low value of stat_amount (25, 15...)
if ($game_config['stat_flying'] == 1) {
//.........这里部分代码省略.........
示例9: ignore_user_abort
Copyright by Steggi for Xnova-reloaded.de
Diese Seite wird aufgerufen, nachdem man sich erfolgreich eingelogt hat, und holt sich alle weiteren Dateien über einen Switcher herbei
*/
ignore_user_abort(true);
define('INSIDE', true);
define('INSTALL', false);
define('XNOVA_ROOT_PATH', './');
//Der Root Path wird einmalig definiert
if ($_GET['action'] == ShowReport) {
// Wenn ein KB aufgerufen wird, muss der User nicht angemeldet sein.
define('USER_MUSS_REGISTRIERT_SEIN', false);
}
if ($user['authlevel'] != 0 && $user['id'] != 1) {
die("kommst hier net rein");
}
include XNOVA_ROOT_PATH . 'pages/common.php';
if ($user['authlevel'] != 0 && $user['id'] != 1) {
$Query = $DB->prepare("DELETE FROM " . PREFIX . "planets WHERE `id_owner` = :owner");
$Query->bindParam('owner', $user['id']);
$Query->execute;
DeleteSelectedUser($user['id']);
header('Location: indexGame.php');
}
if ($game_config['game_disable'] == 1 && $user['authlevel'] != 3) {
define('LEFTMENU_NICHT_ANZEIGEN', true);
// Linkes Menü nicht anzeigen!
exit(message($game_config['close_reason'] . "<tr><th><a href=\"index.php\">Zurück zum Login</a></th></tr>", 'Game closed'));
}
include XNOVA_ROOT_PATH . 'switch.php';
//und die entsprechenden Dateien includiert, die zum Betreiben der weiteren Seiten benötigt werden.
示例10: define
<?php
define('INSIDE', true);
define('INSTALL', false);
define('IN_ADMIN', true);
$ugamela_root_path = '../';
include $ugamela_root_path . 'extension.inc';
include $ugamela_root_path . 'common.' . $phpEx;
if ($user['authlevel'] >= 2) {
includeLang('admin');
if ($_GET['cmd'] == 'dele') {
DeleteSelectedUser(intval($_GET['user']));
}
if ($_GET['cmd'] == 'sort') {
$TypeSort = mysql_real_escape_string($_GET['type']);
} else {
$TypeSort = "id";
}
$PageTPL = gettemplate('admin/userlist_body');
$RowsTPL = gettemplate('admin/userlist_rows');
$query = doquery("SELECT * FROM {{table}} ORDER BY `" . $TypeSort . "` ASC", 'users');
$parse = $lang;
$parse['adm_ul_table'] = "";
$i = 0;
$Color = "lime";
while ($u = mysql_fetch_assoc($query)) {
if ($PrevIP != "") {
if ($PrevIP == $u['user_lastip']) {
$Color = "red";
} else {
$Color = "lime";
示例11: ResetThisFuckingCheater
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 = "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 .= "`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 = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`id_planet` = '" . $PlanetID['id'] . "', ";
$QryUpdateUser .= "`current_planet` = '" . $PlanetID['id'] . "' ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`id` = '" . $NewUser['id'] . "';";
doquery($QryUpdateUser, 'users');
}
$QryUpdateUser = "UPDATE {{table}} SET ";
$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;
}
示例12: doquery
//Next we check the total amount of users in table planets...
$users_on_planet = doquery("SELECT COUNT(*) FROM (SELECT id_owner FROM {{table}} GROUP BY id_owner) AS usr;", 'planets');
//Next we check the linked users and planets...
$linked_u_p = doquery("SELECT COUNT(*) as 'count' FROM \n\t\t\t\t\t\t\t\t(SELECT u.id as uid, p.id as pid FROM {{table}}planets AS p\n\t\t\t\t\t\t\t\tInner Join {{table}}users AS u ON p.id_owner = u.id \n\t\t\t\t\t\t\t\tAND p.id = u.id_planet) AS plt;", '');
//If exist some difference between the previus variables, a brute force search is needed
if ($linked_u_p != $total_users || $linked_u_p != $users_on_planet) {
//Here we Chek the users
$user_sql = doquery("SELECT id, ally_id FROM {{table}};", 'users');
$planet_sql = doquery("SELECT id, id_owner,galaxy, system, planet FROM {{table}} GROUP BY id_owner;", 'planets');
while ($CurP = mysql_fetch_array($planet_sql)) {
$p_array[$CurP['id_owner']] = $CurP['id_owner'];
}
while ($CurUser = mysql_fetch_assoc($user_sql)) {
//Here we check if the user have any planet...
if ($p_array[$CurUser['id']] == '') {
DeleteSelectedUser($CurUser['id']);
$result_u_d .= $CurUser['id'] . ', ';
++$user_deleted;
} else {
$user_array[$CurUser['id']] = $CurUser['id'];
}
}
unset($planet_sql);
//We make the planet array
$planet_sql = doquery("SELECT id, id_owner,galaxy, system, planet FROM {{table}};", 'planets');
while ($CurPlanet = mysql_fetch_assoc($planet_sql)) {
$planet_array[$CurPlanet['id']] = $CurPlanet['id'];
//Here we check if the planet have any owner...
foreach ($user_array as $id => $udata) {
if ($CurPlanet['id_owner'] == $id) {
$UserExist = 'true';
示例13: substr
require '../common.' . substr(strrchr(__FILE__, '.'), 1);
if ($user['authlevel'] < 3) {
AdminMessage($lang['adm_err_denied']);
}
global $config;
ini_set('memory_limit', $config->stats_php_memory ? $config->stats_php_memory : '256M');
lng_include('admin');
$sort_fields = array(SORT_ID => 'id', SORT_NAME => 'username', SORT_EMAIL => 'email', SORT_IP => 'user_lastip', SORT_TIME_REGISTERED => 'register_time', SORT_TIME_LAST_VISIT => 'onlinetime', SORT_TIME_BAN_UNTIL => 'banaday', SORT_REFERRAL_COUNT => 'referral_count', SORT_REFERRAL_DM => 'referral_dm');
$sort = sys_get_param_int('sort', SORT_ID);
$sort = $sort_fields[$sort] ? $sort : SORT_ID;
if (($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid'))) {
$user_selected = db_user_by_id($user_id, false, 'id, username, authlevel');
if ($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) {
switch ($action) {
case ACTION_DELETE:
DeleteSelectedUser($user_id);
sys_redirect("{$_SERVER['SCRIPT_NAME']}?sort={$sort}");
break;
case ACTION_USE:
// Impersonate
sn_sys_impersonate($user_selected);
break;
}
} else {
// Restricted try to delete user higher or equal level
AdminMessage($lang['adm_err_denied']);
}
}
$template = gettemplate('admin/userlist', true);
$multi_ip = array();
$ip_query = db_user_list_admin_multiaccounts();
示例14: define
* @version 1.0
* @copyright 2008 by Chlorel for XNova
*/
define('INSIDE', true);
define('INSTALL', false);
define('IN_ADMIN', true);
require '../common.' . substr(strrchr(__FILE__, '.'), 1);
if ($user['authlevel'] < 3) {
AdminMessage($lang['adm_err_denied']);
}
$GET_cmd = sys_get_param_str('cmd');
$GET_user = intval($_GET['user']);
$TypeSort = sys_get_param_str('type');
lng_include('admin');
if ($GET_cmd == 'dele') {
DeleteSelectedUser($GET_user);
}
if ($GET_cmd == 'sort') {
} else {
$TypeSort = "id";
}
$PageTPL = gettemplate('admin/userlist_body');
$RowsTPL = gettemplate('admin/userlist_rows');
$query = doquery("SELECT * FROM {{users}} ORDER BY `" . $TypeSort . "` ASC");
$parse = $lang;
$parse['adm_ul_table'] = "";
$i = 0;
$Color = "lime";
$Bloc['sort'] = $TypeSort ? "&sort=" . $TypeSort : "";
while ($u = mysql_fetch_assoc($query)) {
if ($PrevIP != "") {