当前位置: 首页>>代码示例>>PHP>>正文


PHP PlayerUtil::deletePlayer方法代码示例

本文整理汇总了PHP中PlayerUtil::deletePlayer方法的典型用法代码示例。如果您正苦于以下问题:PHP PlayerUtil::deletePlayer方法的具体用法?PHP PlayerUtil::deletePlayer怎么用?PHP PlayerUtil::deletePlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlayerUtil的用法示例。


在下文中一共展示了PlayerUtil::deletePlayer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

    function run()
    {
        $config = Config::get(ROOT_UNI);
        $unis = Universe::availableUniverses();
        //Delete old messages
        $del_before = TIMESTAMP - $config->del_oldstuff * 86400;
        $del_inactive = TIMESTAMP - $config->del_user_automatic * 86400;
        $del_deleted = TIMESTAMP - $config->del_user_manually * 86400;
        if ($del_inactive === TIMESTAMP) {
            $del_inactive = 2147483647;
        }
        $sql = 'DELETE FROM %%MESSAGES%% WHERE `message_time` < :time;';
        Database::get()->delete($sql, array(':time' => $del_before));
        $sql = 'DELETE FROM %%ALLIANCE%% WHERE `ally_members` = 0;';
        Database::get()->delete($sql);
        $sql = 'DELETE FROM %%PLANETS%% WHERE `destruyed` < :time AND `destruyed` != 0;';
        Database::get()->delete($sql, array(':time' => TIMESTAMP));
        $sql = 'DELETE FROM %%SESSION%% WHERE `lastonline` < :time;';
        Database::get()->delete($sql, array(':time' => TIMESTAMP - SESSION_LIFETIME));
        $sql = 'DELETE FROM %%FLEETS_EVENT%% WHERE fleetID NOT IN (SELECT fleet_id FROM %%FLEETS%%);';
        Database::get()->delete($sql);
        $sql = 'UPDATE %%USERS%% SET `email_2` = `email` WHERE `setmail` < :time;';
        Database::get()->update($sql, array(':time' => TIMESTAMP));
        $sql = 'SELECT `id` FROM %%USERS%% WHERE `authlevel` = :authlevel
		AND ((`db_deaktjava` != 0 AND `db_deaktjava` < :timeDeleted) OR `onlinetime` < :timeInactive);';
        $deleteUserIds = Database::get()->select($sql, array(':authlevel' => AUTH_USR, ':timeDeleted' => $del_deleted, ':timeInactive' => $del_inactive));
        if (empty($deleteUserIds)) {
            foreach ($deleteUserIds as $dataRow) {
                PlayerUtil::deletePlayer($dataRow['id']);
            }
        }
        foreach ($unis as $uni) {
            $sql = 'SELECT units FROM %%TOPKB%% WHERE `universe` = :universe ORDER BY units DESC LIMIT 99,1;';
            $battleHallLowest = Database::get()->selectSingle($sql, array(':universe' => $uni), 'units');
            if (!is_null($battleHallLowest)) {
                $sql = 'DELETE %%TOPKB%%, %%TOPKB_USERS%%
				FROM %%TOPKB%%
				INNER JOIN %%TOPKB_USERS%% USING (rid)
				WHERE `universe` = :universe AND `units` < :battleHallLowest;';
                Database::get()->delete($sql, array(':universe' => $uni, ':battleHallLowest' => $battleHallLowest));
            }
        }
        $sql = 'DELETE FROM %%RW%% WHERE `time` < :time AND `rid` NOT IN (SELECT `rid` FROM %%TOPKB%%);';
        Database::get()->delete($sql, array(':time' => $del_before));
    }
开发者ID:bergi9,项目名称:2Moons,代码行数:45,代码来源:CleanerCronjob.class.php

示例2: ShowSearchPage

function ShowSearchPage()
{
    global $LNG, $USER;
    if ($_GET['delete'] == 'user') {
        PlayerUtil::deletePlayer((int) $_GET['user']);
        message($LNG['se_delete_succes_p'], '?page=search&search=users&minimize=on', 2);
    } elseif ($_GET['delete'] == 'planet') {
        PlayerUtil::deletePlanet((int) $_GET['planet']);
        message($LNG['se_delete_succes_p'], '?page=search&search=planet&minimize=on', 2);
    }
    $SearchFile = HTTP::_GP('search', '');
    $SearchFor = HTTP::_GP('search_in', '');
    $SearchMethod = HTTP::_GP('fuki', '');
    $SearchKey = HTTP::_GP('key_user', '', UTF8_SUPPORT);
    $Page = HTTP::_GP('side', 0);
    $Order = HTTP::_GP('key_order', '');
    $OrderBY = HTTP::_GP('key_acc', '');
    $limit = HTTP::_GP('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();
    if (HTTP::_GP('minimize', '') == 'on') {
        $Minimize = "&amp;minimize=on";
        $template->assign_vars(array('minimize' => 'checked = "checked"', 'diisplaay' => 'style="display:none;"'));
    }
    switch ($SearchMethod) {
        case 'exacto':
            $SpecifyWhere = "= '" . $GLOBALS['DATABASE']->sql_escape($SearchKey) . "'";
            break;
        case 'last':
            $SpecifyWhere = "LIKE '" . $GLOBALS['DATABASE']->sql_escape($SearchKey, true) . "%'";
            break;
        case 'first':
            $SpecifyWhere = "LIKE '%" . $GLOBALS['DATABASE']->sql_escape($SearchKey, true) . "'";
            break;
        default:
            $SpecifyWhere = "LIKE '%" . $GLOBALS['DATABASE']->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'];
            $SpecialSpecify = "";
            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'];
            }
            $SpecialSpecify .= " AND universe = '" . Universe::getEmulated() . "'";
            $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 p";
            $TableUsers = "2";
            $NameLang = $LNG['se_search_planets'];
            $SpecifyItems = "p.id,p.name,CONCAT(u.username, ' (ID:&nbsp;', p.id_owner, ')'),p.last_update,p.galaxy,p.system,p.planet,p.id_luna";
            if ($SearchFile == "planet") {
                $SpecialSpecify = "AND planet_type = '1'";
                $SName = $LNG['se_input_planett'];
            } elseif ($SearchFile == "moon") {
                $SpecialSpecify = "AND planet_type = '3'";
                $SName = $LNG['se_input_moonn'];
            } elseif ($SearchFile == "p_connect") {
                $SpecialSpecify = "AND last_update >= " . (TIMESTAMP - 60 * 60) . "";
                $SName = $LNG['se_input_act_pla'];
            }
            $SpecialSpecify .= " AND p.universe = " . Universe::getEmulated();
            $WhereItem = "LEFT JOIN " . USERS . " u ON u.id = p.id_owner ";
            if ($SearchFor == "name") {
                $WhereItem .= "WHERE p.name";
            } else {
                $WhereItem .= "WHERE p.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)) {
//.........这里部分代码省略.........
开发者ID:bergi9,项目名称:2Moons,代码行数:101,代码来源:ShowSearchPage.php


注:本文中的PlayerUtil::deletePlayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。