示例#1
0
 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;");
 }
 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
0
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="******"\" 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
0
 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;");
 }
/**
 * 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;
}
示例#6
0
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 = "&amp;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");
            $ArrayOSec = array("id", "who", "time", "longer", "theme", "author");
            $Array0SecCount = count($ArrayOSec);
            for ($OrderNum = 0; $OrderNum < $Array0SecCount; $OrderNum++) {
                $OrderBYParse[$ArrayOSec[$OrderNum]] = $LNG['se_search_banned'][$OrderNum];
            }
        } elseif (in_array($SearchFile, $ArrayAlliance)) {
            $Table = "alliance";
            $NameLang = $LNG['se_search_alliance'];
            $SpecifyItems = "id,ally_name,ally_tag,ally_owner,ally_register_time,ally_members";
            $SName = $LNG['se_input_allyy'];
            $SearchFor == "name" ? $WhereItem = "WHERE ally_name" : ($WhereItem = "WHERE id");
            $ArrayOSec = array("id", "ally_name", "ally_tag", "ally_owner", "ally_register_time", "ally_members");
            $Array0SecCount = count($ArrayOSec);
            for ($OrderNum = 0; $OrderNum < $Array0SecCount; $OrderNum++) {
                $OrderBYParse[$ArrayOSec[$OrderNum]] = $LNG['se_search_alliance'][$OrderNum];
            }
        }
        $RESULT = MyCrazyLittleSearch($SpecifyItems, $WhereItem, $SpecifyWhere, $SpecialSpecify, $Order, $OrderBY, $limit, $Table, $Page, $NameLang, $ArrayOSec, $Minimize, $SName, $SearchFile);
    }
    $template->assign_vars(array('Selector' => $Selector, 'limit' => $limit, 'search' => $SearchKey, 'SearchFile' => $SearchFile, 'SearchFor' => $SearchFor, 'SearchMethod' => $SearchMethod, 'Order' => $Order, 'OrderBY' => $OrderBY, 'OrderBYParse' => $OrderBYParse, 'se_search' => $LNG['se_search'], 'se_limit' => $LNG['se_limit'], 'se_asc_desc' => $LNG['se_asc_desc'], 'se_filter_title' => $LNG['se_filter_title'], 'se_search_in' => $LNG['se_search_in'], 'se_type_typee' => $LNG['se_type_typee'], 'se_intro' => $LNG['se_intro'], 'se_search_title' => $LNG['se_search_title'], 'se_contrac' => $LNG['se_contrac'], 'se_search_order' => $LNG['se_search_order'], 'ac_minimize_maximize' => $LNG['ac_minimize_maximize'], 'LIST' => $RESULT['LIST'], 'PAGES' => $RESULT['PAGES']));
    $template->show('adm/SearchPage.tpl');
}
示例#7
0
        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
0
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 = "******";
    //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) {
            $sql_flying_fleets = 'SELECT fleet_array, fleet_owner, fleet_id FROM {{table}} WHERE fleet_owner <= ' . $minmax['max'] . ' AND fleet_owner >= ' . $minmax['min'] . ';';
            $flying_fleets = doquery($sql_flying_fleets, 'fleets');
            while ($CurFleets = mysql_fetch_assoc($flying_fleets)) {
                $flying_fleets_array[$CurFleets['fleet_owner']][$CurFleets['fleet_id']] = $CurFleets['fleet_array'];
            }
            unset($CurFleets, $flying_fleets);
        }
        //This query will have a LOT of data...
        $sql = 'SELECT  ' . $select_planet . $select_defenses . $selected_tech . $select_fleets . $select_user . 'FROM {{table}}planets as p
					INNER JOIN {{table}}users as u ON u.id = p.id_owner
					WHERE p.id_owner <= ' . $minmax['max'] . ' AND p.id_owner >=  ' . $minmax['min'] . '
					GROUP BY p.id_owner, u.id, u.authlevel;';
        $total_data = doquery($sql, '');
        unset($sql, $sql_old_stats, $sql_parcial);
        doquery("DELETE FROM {{table}} WHERE stat_type = 1 AND stat_code = 1 AND id_owner <= " . $minmax['max'] . " AND id_owner >= " . $minmax['min'] . ";", 'statpoints');
        $insert_user_query = "INSERT INTO {{table}}\r\n\t\t\t\t\t\t\t\t(`id_owner`, `id_ally`, `stat_type`, `stat_code`,\r\n\t\t\t\t\t\t\t\t`tech_old_rank`, `tech_points`, `tech_count`,\r\n\t\t\t\t\t\t\t\t`build_old_rank`, `build_points`, `build_count`,\r\n\t\t\t\t\t\t\t\t`defs_old_rank`, `defs_points`, `defs_count`,\r\n\t\t\t\t\t\t\t\t`fleet_old_rank`, `fleet_points`, `fleet_count`,\r\n\t\t\t\t\t\t\t\t`total_old_rank`, `total_points`, `total_count`, `stat_date`) VALUES ";
        //Here we start the update...
        while ($CurUser = mysql_fetch_assoc($total_data)) {
            $u_OldTotalRank = $old_stats_array[$CurUser['id']]['old_total_rank'] ? $old_stats_array[$CurUser['id']]['old_total_rank'] : 0;
            $u_OldTechRank = $old_stats_array[$CurUser['id']]['old_tech_rank'] ? $old_stats_array[$CurUser['id']]['old_tech_rank'] : 0;
            $u_OldBuildRank = $old_stats_array[$CurUser['id']]['old_build_rank'] ? $old_stats_array[$CurUser['id']]['old_build_rank'] : 0;
            $u_OldDefsRank = $old_stats_array[$CurUser['id']]['old_defs_rank'] ? $old_stats_array[$CurUser['id']]['old_defs_rank'] : 0;
            $u_OldFleetRank = $old_stats_array[$CurUser['id']]['old_fleet_rank'] ? $old_stats_array[$CurUser['id']]['old_fleet_rank'] : 0;
            //We dont need this anymore...
            unset($old_stats_array[$CurUser['id']]);
            //1 point=  $game_config['stat_settings'] ressources
            //Make the tech points XD
            $u_points = GetTechnoPoints($CurUser);
            $u_TTechCount = $u_points['TechCount'];
            $u_TTechPoints = $u_points['TechPoint'] / $game_config['stat_settings'];
            //Make the defense points
            $u_points = GetDefensePoints($CurUser);
            $u_TDefsCount = $u_points['DefenseCount'];
            $u_TDefsPoints = $u_points['DefensePoint'] / $game_config['stat_settings'];
            //Make the fleets points (without the flying fleets...
            $u_points = GetFleetPoints($CurUser);
            $u_TFleetCount = $u_points['FleetCount'];
            $u_TFleetPoints = $u_points['FleetPoint'] / $game_config['stat_settings'];
            //Now we add the flying fleets points
            //This is used if($game_config['stat_flying'] == 1)
            if ($game_config['stat_flying'] == 1) {
                if ($flying_fleets_array[$CurUser['id']]) {
                    foreach ($flying_fleets_array[$CurUser['id']] as $fleet_id => $fleet_array) {
                        $u_points = GetFlyingFleetPoints($fleet_array);
                        $u_TFleetCount += $u_points['FleetCount'];
                        $u_TFleetPoints += $u_points['FleetPoint'] / $game_config['stat_settings'];
                    }
                }
                //We dont need this anymore...
                unset($flying_fleets_array[$CurUser['id']], $fleet_array, $fleet_id);
            } else {
                //We take one query per fleet in flying, with this we increase the time and the querys, but we decrease the cpu load...
                $OwnFleets = doquery("SELECT fleet_array, fleet_id FROM {{table}} WHERE `fleet_owner` = '" . $CurUser['id'] . "';", 'fleets');
                while ($FleetRow = mysql_fetch_array($OwnFleets)) {
                    $u_points = GetFlyingFleetPoints($FleetRow['fleet_array']);
                    $u_TFleetCount += $u_points['FleetCount'];
                    $u_TFleetPoints += $u_points['FleetPoint'] / $game_config['stat_settings'];
                }
                //We dont need this anymore...
                unset($OwnFleets, $FleetRow);
            }
            $u_TBuildCount = 0;
            $u_TBuildPoints = 0;
            if ($Buildings_array[$CurUser['id']]) {
                foreach ($Buildings_array[$CurUser['id']] as $planet_id => $building) {
                    $u_points = GetBuildPoints($building);
                    $u_TBuildCount += $u_points['BuildCount'];
                    $u_TBuildPoints += $u_points['BuildPoint'] / $game_config['stat_settings'];
                    //We add the shields points (this way is a temporary way...)
                    $u_points = GetDefensePoints($building);
                    $u_TDefsCount += $u_points['DefenseCount'];
                    $u_TDefsPoints += $u_points['DefensePoint'] / $game_config['stat_settings'];
                }
                //We dont need this anymore...
                unset($Buildings_array[$CurUser['id']], $planet_id, $building);
            } else {
                //Here we will send a error message....print_r("<br>usuario sin planeta: ". $CurUser['id']);
            }
            $u_GCount = $u_TDefsCount + $u_TTechCount + $u_TFleetCount + $u_TBuildCount;
            $u_GPoints = $u_TTechPoints + $u_TDefsPoints + $u_TFleetPoints + $u_TBuildPoints;
            if ($CurUser['authlevel'] >= $game_config['stat_level'] && $game_config['stat'] == 1 || $CurUser['bana'] == 1) {
                $insert_user_query .= '(' . $CurUser['id'] . ',' . $CurUser['ally_id'] . ',1,1,' . $u_OldTechRank . ',
										0,0,' . $u_OldBuildRank . ',0,0,' . $u_OldDefsRank . ',0,0,' . $u_OldFleetRank . ',
										0,0,' . $u_OldTotalRank . ',0,0,' . $stats_time . '),';
            } else {
                $insert_user_query .= '(' . $CurUser['id'] . ',' . $CurUser['ally_id'] . ',1,1,' . $u_OldTechRank . ',
										' . $u_TTechPoints . ',' . $u_TTechCount . ',' . $u_OldBuildRank . ',' . $u_TBuildPoints . ',
										' . $u_TBuildCount . ',' . $u_OldDefsRank . ',' . $u_TDefsPoints . ',' . $u_TDefsCount . ',
										' . $u_OldFleetRank . ',' . $u_TFleetPoints . ',' . $u_TFleetCount . ',' . $u_OldTotalRank . ',
										' . $u_GPoints . ',' . $u_GCount . ',' . $stats_time . '),';
            }
            unset_vars('u_');
            $CheckUserQuery = true;
        }
        //TODO, make a end string check in case that insert_user_query end in VALUE...
        //Here we change the end of the query for ;
        if ($CheckUserQuery == true) {
            $insert_user_query = substr_replace($insert_user_query, ';', -1);
            doquery($insert_user_query, 'statpoints');
        }
        unset($insert_user_query, $total_data, $CurUser, $old_stats_array, $Buildings_array, $flying_fleets_array);
    }
    //STATS FOR ALLYS
    //Delet invalid allys
    doquery("DELETE FROM {{table}} WHERE ally_members='0'", "alliance");
    //We create this just for make a check of the ally
    $ally_check = doquery("SELECT * FROM {{table}}", 'alliance');
    $total_ally = 0;
    while ($CurAlly = mysql_fetch_assoc($ally_check)) {
        ++$total_ally;
        $ally_check_value[$CurAlly['id']] = 1;
    }
    unset($ally_check);
    unset($start, $QueryValue, $Query, $LastQuery);
    if ($total_ally > 0) {
        //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_ally > $amount_per_block) {
            $LastQuery = roundUp($total_ally / $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}}alliance ORDER BY id ASC LIMIT
						' . $start . ',' . $amount_per_block . ') AS A';
            $minmax = doquery($minmax_sql, '', true);
            $select_old_a_ranks = "s.id_owner , s.stat_type,\ts.tech_rank AS old_tech_rank,\r\n\t\t\t\t\t\t\t\ts.build_rank AS old_build_rank, s.defs_rank AS old_defs_rank, s.fleet_rank AS old_fleet_rank,\r\n\t\t\t\t\t\t\t\ts.total_rank AS old_total_rank";
            $select_ally = " a.id ";
            $sql_ally = 'SELECT  ' . $select_ally . ', ' . $select_old_a_ranks . '
							FROM {{table}}alliance AS a
							INNER JOIN {{table}}statpoints AS s ON a.id = s.id_owner  AND s.stat_type = 2
							WHERE a.id <= ' . $minmax['max'] . ' AND a.id >=  ' . $minmax['min'] . '
							ORDER BY a.id;';
            $ally_data = doquery($sql_ally, '');
            $ally_sql_points = 'SELECT
							s.stat_type, s.id_ally, Sum(s.tech_points) AS TechPoint,
								Sum(s.tech_count) AS TechCount, Sum(s.build_points) AS BuildPoint,
								Sum(s.build_count) AS BuildCount, Sum(s.defs_points) AS DefsPoint,
								Sum(s.defs_count) AS DefsCount, Sum(s.fleet_points) AS FleetPoint,
								Sum(s.fleet_count) AS FleetCount, Sum(s.total_points) AS TotalPoint,
								Sum(s.total_count) AS TotalCount
								FROM
								{{table}}statpoints AS s
								WHERE	s.stat_type =  1 AND s.id_ally > 0
								AND s.id_ally <= ' . $minmax['max'] . ' AND s.id_ally >=  ' . $minmax['min'] . '
								GROUP BY	s.id_ally;';
            $ally_points = doquery($ally_sql_points, '');
            //We delete now the old stats of the allys
            doquery('DELETE FROM {{table}} WHERE `stat_type` = 2 AND id_owner <= ' . $minmax['max'] . ' AND id_owner >=  ' . $minmax['min'] . ';', 'statpoints');
            while ($CurAlly = mysql_fetch_assoc($ally_data)) {
                $ally_old_data[$CurAlly['id']] = $CurAlly;
            }
            unset($CurAlly, $ally_data);
            $insert_ally_query = "INSERT INTO {{table}}\r\n\t\t\t\t\t\t\t\t\t(`id_owner`, `id_ally`, `stat_type`, `stat_code`,\r\n\t\t\t\t\t\t\t\t\t`tech_old_rank`, `tech_points`, `tech_count`,\r\n\t\t\t\t\t\t\t\t\t`build_old_rank`, `build_points`, `build_count`,\r\n\t\t\t\t\t\t\t\t\t`defs_old_rank`, `defs_points`, `defs_count`,\r\n\t\t\t\t\t\t\t\t\t`fleet_old_rank`, `fleet_points`, `fleet_count`,\r\n\t\t\t\t\t\t\t\t\t`total_old_rank`, `total_points`, `total_count`, `stat_date`) VALUES ";
            while ($CurAlly = mysql_fetch_assoc($ally_points)) {
                if ($ally_check_value[$CurAlly['id_ally']] == 1) {
                    $u_OldTotalRank = $ally_old_data[$CurAlly['id_ally']]['old_total_rank'] ? $ally_old_data[$CurAlly['id_ally']]['old_total_rank'] : 0;
                    $u_OldTechRank = $ally_old_data[$CurAlly['id_ally']]['old_tech_rank'] ? $ally_old_data[$CurAlly['id_ally']]['old_tech_rank'] : 0;
                    $u_OldBuildRank = $ally_old_data[$CurAlly['id_ally']]['old_build_rank'] ? $ally_old_data[$CurAlly['id_ally']]['old_build_rank'] : 0;
                    $u_OldDefsRank = $ally_old_data[$CurAlly['id_ally']]['old_defs_rank'] ? $ally_old_data[$CurAlly['id_ally']]['old_defs_rank'] : 0;
                    $u_OldFleetRank = $ally_old_data[$CurAlly['id_ally']]['old_fleet_rank'] ? $ally_old_data[$CurAlly['id_ally']]['old_fleet_rank'] : 0;
                    $u_TTechCount = $CurAlly['TechCount'];
                    $u_TTechPoints = $CurAlly['TechPoint'];
                    $u_TBuildCount = $CurAlly['BuildCount'];
                    $u_TBuildPoints = $CurAlly['BuildPoint'];
                    $u_TDefsCount = $CurAlly['DefsCount'];
                    $u_TDefsPoints = $CurAlly['DefsPoint'];
                    $u_TFleetCount = $CurAlly['FleetCount'];
                    $u_TFleetPoints = $CurAlly['FleetPoint'];
                    $u_GCount = $CurAlly['TotalCount'];
                    $u_GPoints = $CurAlly['TotalPoint'];
                    $insert_ally_query .= '(' . $CurAlly['id_ally'] . ',0,2,1,' . $u_OldTechRank . ',
											' . $u_TTechPoints . ',' . $u_TTechCount . ',' . $u_OldBuildRank . ',' . $u_TBuildPoints . ',
											' . $u_TBuildCount . ',' . $u_OldDefsRank . ',' . $u_TDefsPoints . ',' . $u_TDefsCount . ',
											' . $u_OldFleetRank . ',' . $u_TFleetPoints . ',' . $u_TFleetCount . ',' . $u_OldTotalRank . ',
											' . $u_GPoints . ',' . $u_GCount . ',' . $stats_time . '),';
                    unset($CurAlly);
                    unset_vars('u_');
                } else {
                    doquery("UPDATE {{table}}\tSET `ally_id`=0, `ally_name` = '', \t`ally_register_time`= 0, `ally_rank_id`= 0 \tWHERE `ally_id`='{$CurAlly['id_ally']}'", "users");
                }
                $CheckAllyQuery = true;
            }
            //Here we change the end of the query for ;
            if ($CheckAllyQuery == true) {
                $insert_ally_query = substr_replace($insert_ally_query, ';', -1);
                doquery($insert_ally_query, 'statpoints');
            }
            unset($insert_ally_query, $ally_old_data, $CurAlly, $ally_points);
        }
        unset($ally_check_value);
        //We update the ranks of the allys
        MakeNewRanks(2);
    }
    //We update the ranks of the users
    MakeNewRanks(1);
    // Calcul de la duree de traitement (calcul)
    $mtime = microtime();
    $mtime = explode(" ", $mtime);
    $mtime = $mtime[1] + $mtime[0];
    $endtime = $mtime;
    $result['stats_time'] = $stats_time;
    $result['totaltime'] = $endtime - $starttime;
    $result['memory_peak'] = array(round(memory_get_peak_usage() / 1024, 1), round(memory_get_peak_usage(1) / 1024, 1));
    $result['end_memory'] = array(round(memory_get_usage() / 1024, 1), round(memory_get_usage(1) / 1024, 1));
    $result['amount_per_block'] = $amount_per_block;
    return $result;
}
示例#9
0
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&uuml;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
0
<?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
0
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;
}
示例#12
0
 //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
0
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
0
 * @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 != "") {