本文整理汇总了PHP中PlayerUtil类的典型用法代码示例。如果您正苦于以下问题:PHP PlayerUtil类的具体用法?PHP PlayerUtil怎么用?PHP PlayerUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PlayerUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
if (Config::get(ROOT_UNI)->ref_active != 1) {
return null;
}
/** @var $langObjects Language[] */
$langObjects = array();
$db = Database::get();
$sql = 'SELECT `username`, `ref_id`, `id`, `lang`, user.`universe`
FROM %%USERS%% user
INNER JOIN %%STATPOINTS%% as stats
ON stats.`id_owner` = user.`id` AND stats.`stat_type` = :type AND stats.`total_points` >= :points
WHERE user.`ref_bonus` = 1;';
$userArray = $db->select($sql, array(':type' => 1, ':points' => Config::get(ROOT_UNI)->ref_minpoints));
foreach ($userArray as $user) {
if (!isset($langObjects[$user['lang']])) {
$langObjects[$user['lang']] = new Language($user['lang']);
$langObjects[$user['lang']]->includeData(array('L18N', 'INGAME', 'TECH', 'CUSTOM'));
}
$userConfig = Config::get($user['universe']);
$LNG = $langObjects[$user['lang']];
$sql = 'UPDATE %%USERS%% SET `darkmatter` = `darkmatter` + :bonus WHERE `id` = :userId;';
$db->update($sql, array(':bonus' => $userConfig->ref_bonus, ':userId' => $user['ref_id']));
$sql = 'UPDATE %%USERS%% SET `ref_bonus` = 0 WHERE `id` = :userId;';
$db->update($sql, array(':userId' => $user['id']));
$Message = sprintf($LNG['sys_refferal_text'], $user['username'], pretty_number($userConfig->ref_minpoints), pretty_number($userConfig->ref_bonus), $LNG['tech'][921]);
PlayerUtil::sendMessage($user['ref_id'], '', $LNG['sys_refferal_from'], 4, sprintf($LNG['sys_refferal_title'], $user['username']), $Message, TIMESTAMP);
}
return true;
}
开发者ID:tatarysh,项目名称:2Moons,代码行数:30,代码来源:ReferralCronjob.class.php
示例2: send
function send()
{
$username = HTTP::_GP('username', '', UTF8_SUPPORT);
$prenom = HTTP::_GP('prenom', '', UTF8_SUPPORT);
$email = HTTP::_GP('email', '');
$sujet = HTTP::_GP('sujet', 0);
$message = HTTP::_GP('message', '');
$errors = array();
if (!PlayerUtil::isMailValid($email)) {
$errors[] = t('registerErrorMailInvalid');
}
if (empty($email)) {
$errors[] = t('registerErrorMailEmpty');
}
if (empty($username)) {
$errors[] = t('registerErrorMailEmpty');
}
if (empty($message)) {
$errors[] = t('registerErrorMailEmpty');
}
if (!empty($errors)) {
$this->printMessage(implode("<br>\r\n", $errors), NULL, array(array('label' => t('registerBack'), 'url' => 'javascript:window.history.back()')));
}
require 'includes/classes/Mail.class.php';
$MailRAW = $GLOBALS['LNG']->getTemplate('email_vaild_contact');
$MailContent = str_replace(array('{NAME}', '{FIRSTNAME}', '{EMAIL}', '{SUBJECT}', '{MESSAGE}', '{IP}'), array($username, $prenom, $email, $sujet, $message, $_SERVER['REMOTE_ADDR']), $MailRAW);
$to = '(EMAIL)';
$headers = 'From: ' . $email . '' . "\r\n";
$headers .= 'Reply-To: ' . $email . '' . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
//Mail::send($to, $username, Config::get('game_name'), $MailContent);
mail('(EMAIL)', Config::get('game_name'), $MailContent, $headers);
$this->redirectTo('index.php?page=disclamer');
}
开发者ID:fuding,项目名称:Antaris,代码行数:35,代码来源:ShowDisclamerPage.class.php
示例3: ReturnEvent
function ReturnEvent()
{
$LNG = $this->getLanguage(NULL, $this->_fleet['fleet_owner']);
$Message = sprintf($LNG['sys_stat_mess'], GetStartAddressLink($this->_fleet, ''), pretty_number($this->_fleet['fleet_resource_metal']), $LNG['tech'][901], pretty_number($this->_fleet['fleet_resource_crystal']), $LNG['tech'][902], pretty_number($this->_fleet['fleet_resource_deuterium']), $LNG['tech'][903]);
PlayerUtil::sendMessage($this->_fleet['fleet_owner'], 0, $LNG['sys_mess_tower'], 4, $LNG['sys_mess_fleetback'], $Message, $this->_fleet['fleet_end_time'], NULL, 1, $this->_fleet['fleet_universe']);
$this->RestoreFleet();
}
开发者ID:tatarysh,项目名称:2Moons,代码行数:7,代码来源:MissionCaseStay.class.php
示例4: send
function send()
{
global $USER, $LNG;
$ticketID = HTTP::_GP('id', 0);
$message = HTTP::_GP('message', '', true);
$change = HTTP::_GP('change_status', 0);
$ticketDetail = $GLOBALS['DATABASE']->getFirstRow("SELECT ownerID, subject, status FROM " . TICKETS . " WHERE ticketID = " . $ticketID . ";");
$status = $change ? $ticketDetail['status'] <= 1 ? 2 : 1 : 1;
if (!$change && empty($message)) {
HTTP::redirectTo('admin.php?page=support&mode=view&id=' . $ticketID);
}
$subject = "RE: " . $ticketDetail['subject'];
if ($change && $status == 1) {
$this->ticketObj->createAnswer($ticketID, $USER['id'], $USER['username'], $subject, $LNG['ti_admin_open'], $status);
}
if (!empty($message)) {
$this->ticketObj->createAnswer($ticketID, $USER['id'], $USER['username'], $subject, $message, $status);
}
if ($change && $status == 2) {
$this->ticketObj->createAnswer($ticketID, $USER['id'], $USER['username'], $subject, $LNG['ti_admin_close'], $status);
}
$subject = sprintf($LNG['sp_answer_message_title'], $ticketID);
$text = sprintf($LNG['sp_answer_message'], $ticketID);
PlayerUtil::sendMessage($ticketDetail['ownerID'], $USER['id'], $USER['username'], 4, $subject, $text, TIMESTAMP, NULL, 1, Universe::getEmulated());
HTTP::redirectTo('admin.php?page=support');
}
开发者ID:bergi9,项目名称:2Moons,代码行数:26,代码来源:ShowSupportPage.php
示例5: newPassword
function newPassword()
{
global $LNG;
$userID = HTTP::_GP('u', 0);
$validationKey = HTTP::_GP('k', '');
$db = Database::get();
$sql = "SELECT COUNT(*) as state FROM %%LOSTPASSWORD%% WHERE userID = :userID AND `key` = :validationKey AND `time` > :time AND hasChanged = 0;";
$isValid = $db->selectSingle($sql, array(':userID' => $userID, ':validationKey' => $validationKey, ':time' => TIMESTAMP - 1800), 'state');
if (empty($isValid)) {
$this->printMessage($LNG['passwordValidInValid'], array(array('label' => $LNG['passwordBack'], 'url' => 'index.php')));
}
$newPassword = uniqid();
$sql = "SELECT username, email_2 as mail, universe FROM %%USERS%% WHERE id = :userID;";
$userData = $db->selectSingle($sql, array(':userID' => $userID));
$config = Config::get($userData['universe']);
$MailRAW = $LNG->getTemplate('email_lost_password_changed');
$MailContent = str_replace(array('{USERNAME}', '{GAMENAME}', '{GAMEMAIL}', '{PASSWORD}'), array($userData['username'], $config->game_name . ' - ' . $config->uni_name, $config->smtp_sendmail, $newPassword), $MailRAW);
$sql = "UPDATE %%USERS%% SET password = :newPassword WHERE id = :userID;";
$db->update($sql, array(':userID' => $userID, ':newPassword' => PlayerUtil::cryptPassword($newPassword)));
require 'includes/classes/Mail.class.php';
$subject = sprintf($LNG['passwordChangedMailTitle'], $config->game_name);
Mail::send($userData['mail'], $userData['username'], $subject, $MailContent);
$sql = "UPDATE %%LOSTPASSWORD%% SET hasChanged = 1 WHERE userID = :userID AND `key` = :validationKey;";
$db->update($sql, array(':userID' => $userID, ':validationKey' => $validationKey));
$this->printMessage($LNG['passwordChangedMailSend'], array(array('label' => $LNG['passwordNext'], 'url' => 'index.php')));
}
开发者ID:sincilite,项目名称:Evermoon,代码行数:26,代码来源:ShowLostPasswordPage.class.php
示例6: show
function show()
{
if (empty($_POST)) {
HTTP::redirectTo('index.php');
}
$db = Database::get();
$username = HTTP::_GP('username', '', UTF8_SUPPORT);
$password = HTTP::_GP('password', '', true);
$sql = "SELECT id, password FROM %%USERS%% WHERE universe = :universe AND username = :username;";
$loginData = $db->selectSingle($sql, array(':universe' => Universe::current(), ':username' => $username));
if (isset($loginData)) {
$hashedPassword = PlayerUtil::cryptPassword($password);
if ($loginData['password'] != $hashedPassword) {
// Fallback pre 1.7
if ($loginData['password'] == md5($password)) {
$sql = "UPDATE %%USERS%% SET password = :hashedPassword WHERE id = :loginID;";
$db->update($sql, array(':hashedPassword' => $hashedPassword, ':loginID' => $loginData['id']));
} else {
HTTP::redirectTo('index.php?code=1');
}
}
$session = Session::create();
$session->userId = (int) $loginData['id'];
$session->adminAccess = 0;
$session->save();
HTTP::redirectTo('game.php');
} else {
HTTP::redirectTo('index.php?code=1');
}
}
开发者ID:tatarysh,项目名称:2Moons,代码行数:30,代码来源:ShowLoginPage.class.php
示例7: _activeUser
private function _activeUser()
{
$validationID = HTTP::_GP('i', 0);
$validationKey = HTTP::_GP('k', '');
$userData = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . USERS_VALID . " WHERE validationID = " . $validationID . " AND validationKey = '" . $GLOBALS['DATABASE']->escape($validationKey) . "';");
if (!isset($userData)) {
$this->printMessage(t('vertifyNoUserFound'));
}
$GLOBALS['DATABASE']->query("DELETE FROM " . USERS_VALID . " WHERE validationID = " . $validationID . ";");
list($userID, $planetID) = PlayerUtil::createPlayer($userData['universe'], $userData['userName'], $userData['password'], $userData['email'], $userData['race'], $userData['language']);
if (Config::get('mail_active', $userData['universe']) == 1) {
require 'includes/classes/Mail.class.php';
$MailSubject = t('registerMailCompleteTitle', Config::get('game_name', $userData['universe']));
$MailRAW = $GLOBALS['LNG']->getTemplate('email_reg_done');
$MailContent = str_replace(array('{USERNAME}', '{GAMENAME}', '{GAMEMAIL}'), array($userData['email'], Config::get('game_name') . ' - ' . Config::get('uni_name'), Config::get('smtp_sendmail')), $MailRAW);
try {
Mail::send($userData['email'], $userData['userName'], $MailSubject, $MailContent);
} catch (Exception $e) {
// This mail is wayne.
}
}
if (!empty($userData['referralID'])) {
$GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET\n\t\t\t`ref_id`\t= " . $userData['referralID'] . ",\n\t\t\t`ref_bonus`\t= 1\n\t\t\tWHERE\n\t\t\t`id`\t\t= " . $userID . ";");
}
if (!empty($userData['externalAuthUID'])) {
$GLOBALS['DATABASE']->query("INSERT INTO " . USERS_AUTH . " SET\n\t\t\t`id`\t\t= " . $userID . ",\n\t\t\t`account`\t= '" . $GLOBALS['DATABASE']->escape($userData['externalAuthUID']) . "',\n\t\t\t`mode`\t\t= '" . $GLOBALS['DATABASE']->escape($userData['externalAuthMethod']) . "';");
}
$nameSender = t('registerWelcomePMSenderName');
$subject = t('registerWelcomePMSubject');
$message = t('registerWelcomePMText', Config::get('game_name', $userData['universe']));
SendSimpleMessage($userID, 1, TIMESTAMP, 1, $nameSender, $subject, $message);
return array('userID' => $userID, 'userName' => $userData['userName'], 'planetID' => $planetID);
}
开发者ID:joancefet,项目名称:Beta7,代码行数:33,代码来源:ShowVertifyPage.class.php
示例8: ShowPassEncripterPage
function ShowPassEncripterPage()
{
global $LNG;
$Password = HTTP::_GP('md5q', '', true);
$template = new template();
$template->assign_vars(array('md5_md5' => $Password, 'md5_enc' => PlayerUtil::cryptPassword($Password), 'et_md5_encripter' => $LNG['et_md5_encripter'], 'et_encript' => $LNG['et_encript'], 'et_result' => $LNG['et_result'], 'et_pass' => $LNG['et_pass']));
$template->show('PassEncripterPage.tpl');
}
开发者ID:tatarysh,项目名称:2Moons,代码行数:8,代码来源:ShowPassEncripterPage.php
示例9: ShowSendMessagesPage
function ShowSendMessagesPage()
{
global $USER, $LNG;
$ACTION = HTTP::_GP('action', '');
if ($ACTION == 'send') {
switch ($USER['authlevel']) {
case AUTH_MOD:
$class = 'mod';
break;
case AUTH_OPS:
$class = 'ops';
break;
case AUTH_ADM:
$class = 'admin';
break;
default:
$class = '';
break;
}
$Subject = HTTP::_GP('subject', '', true);
$Message = HTTP::_GP('text', '', true);
$Mode = HTTP::_GP('mode', 0);
$Lang = HTTP::_GP('lang', '');
if (!empty($Message) && !empty($Subject)) {
require 'includes/classes/BBCode.class.php';
if ($Mode == 0 || $Mode == 2) {
$From = '<span class="' . $class . '">' . $LNG['user_level'][$USER['authlevel']] . ' ' . $USER['username'] . '</span>';
$pmSubject = '<span class="' . $class . '">' . $Subject . '</span>';
$pmMessage = '<span class="' . $class . '">' . BBCode::parse($Message) . '</span>';
$USERS = $GLOBALS['DATABASE']->query("SELECT `id`, `username` FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "'" . (!empty($Lang) ? " AND `lang` = '" . $GLOBALS['DATABASE']->sql_escape($Lang) . "'" : "") . ";");
while ($UserData = $GLOBALS['DATABASE']->fetch_array($USERS)) {
$sendMessage = str_replace('{USERNAME}', $UserData['username'], $pmMessage);
PlayerUtil::sendMessage($UserData['id'], $USER['id'], $From, 50, $pmSubject, $sendMessage, TIMESTAMP, NULL, 1, Universe::getEmulated());
}
}
if ($Mode == 1 || $Mode == 2) {
require 'includes/classes/Mail.class.php';
$userList = array();
$USERS = $GLOBALS['DATABASE']->query("SELECT `email`, `username` FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "'" . (!empty($Lang) ? " AND `lang` = '" . $GLOBALS['DATABASE']->sql_escape($Lang) . "'" : "") . ";");
while ($UserData = $GLOBALS['DATABASE']->fetch_array($USERS)) {
$userList[$UserData['email']] = array('username' => $UserData['username'], 'body' => BBCode::parse(str_replace('{USERNAME}', $UserData['username'], $Message)));
}
Mail::multiSend($userList, strip_tags($Subject));
}
exit($LNG['ma_message_sended']);
} else {
exit($LNG['ma_subject_needed']);
}
}
$sendModes = $LNG['ma_modes'];
if (Config::get()->mail_active == 0) {
unset($sendModes[1]);
unset($sendModes[2]);
}
$template = new template();
$template->assign_vars(array('langSelector' => array_merge(array('' => $LNG['ma_all']), $LNG->getAllowedLangs(false)), 'modes' => $sendModes));
$template->show('SendMessagesPage.tpl');
}
开发者ID:Reapertonio,项目名称:2Moons,代码行数:58,代码来源:ShowSendMessagesPage.php
示例10: ReturnEvent
function ReturnEvent()
{
$LNG = $this->getLanguage(NULL, $this->_fleet['fleet_owner']);
$sql = 'SELECT name FROM %%PLANETS%% WHERE id = :planetId;';
$planetName = Database::get()->selectSingle($sql, array(':planetId' => $this->_fleet['fleet_start_id']), 'name');
$Message = sprintf($LNG['sys_tran_mess_back'], $planetName, GetStartAddressLink($this->_fleet, ''));
PlayerUtil::sendMessage($this->_fleet['fleet_owner'], 0, $LNG['sys_mess_tower'], 4, $LNG['sys_mess_fleetback'], $Message, $this->_fleet['fleet_end_time'], NULL, 1, $this->_fleet['fleet_universe']);
$this->RestoreFleet();
}
开发者ID:tatarysh,项目名称:2Moons,代码行数:9,代码来源:MissionCaseStayAlly.class.php
示例11: 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();
}
开发者ID:Decoder1978,项目名称:Xterium,代码行数:57,代码来源:MissionCaseColonisation.php
示例12: ReturnEvent
function ReturnEvent()
{
$LNG = $this->getLanguage(NULL, $this->_fleet['fleet_owner']);
$sql = 'SELECT name FROM %%PLANETS%% WHERE id = :planetId;';
$planetName = Database::get()->selectSingle($sql, array(':planetId' => $this->_fleet['fleet_start_id']), 'name');
$Message = sprintf($LNG['sys_fleet_won'], $planetName, GetTargetAdressLink($this->_fleet, ''), pretty_number($this->_fleet['fleet_resource_metal']), $LNG['tech'][901], pretty_number($this->_fleet['fleet_resource_crystal']), $LNG['tech'][902], pretty_number($this->_fleet['fleet_resource_deuterium']), $LNG['tech'][903]);
PlayerUtil::sendMessage($this->_fleet['fleet_owner'], 0, $LNG['sys_mess_tower'], 4, $LNG['sys_mess_fleetback'], $Message, $this->_fleet['fleet_end_time'], NULL, 1, $this->_fleet['fleet_universe']);
$this->RestoreFleet();
}
开发者ID:sincilite,项目名称:Evermoon,代码行数:9,代码来源:MissionCaseACS.class.php
示例13: ReturnEvent
function ReturnEvent()
{
$LNG = $this->getLanguage(NULL, $this->_fleet['fleet_owner']);
if ($this->_fleet['fleet_resource_darkmatter'] > 0) {
$message = sprintf($LNG['sys_expe_back_home_with_dm'], $LNG['tech'][921], pretty_number($this->_fleet['fleet_resource_darkmatter']), $LNG['tech'][921]);
$this->UpdateFleet('fleet_array', '220,0;');
} else {
$message = $LNG['sys_expe_back_home_without_dm'];
}
PlayerUtil::sendMessage($this->_fleet['fleet_owner'], 0, $LNG['sys_mess_tower'], 4, $LNG['sys_mess_fleetback'], $message, $this->_fleet['fleet_end_time'], NULL, 1, $this->_fleet['fleet_universe']);
$this->RestoreFleet();
}
开发者ID:bergi9,项目名称:2Moons,代码行数:12,代码来源:MissionCaseFoundDM.class.php
示例14: 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
示例15: ShowLoginPage
function ShowLoginPage()
{
global $USER;
$session = Session::create();
if ($session->adminAccess == 1) {
HTTP::redirectTo('admin.php');
}
if (isset($_REQUEST['admin_pw'])) {
$password = PlayerUtil::cryptPassword($_REQUEST['admin_pw']);
if ($password == $USER['password']) {
$session->adminAccess = 1;
HTTP::redirectTo('admin.php');
}
}
$template = new template();
$template->assign_vars(array('bodyclass' => 'standalone', 'username' => $USER['username']));
$template->show('LoginPage.tpl');
}
开发者ID:tatarysh,项目名称:2Moons,代码行数:18,代码来源:ShowLoginPage.php
示例16: lotinfo
function lotinfo()
{
global $USER, $PLANET, $LNG, $UNI, $CONF, $resource, $pricelist;
$lotID = HTTP::_GP('lotID', 0);
$info = $GLOBALS['DATABASE']->query("SELECT DISTINCT ps.*, p.field_current, p.field_max, p.id_luna FROM uni1_planetauction as ps \n\tINNER JOIN " . PLANETS . " as p ON p.id = ps.planetID WHERE auctionID = " . $lotID . ";");
$info = $GLOBALS['DATABASE']->fetch_array($info);
$iPlanetCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . PLANETS . " WHERE `id_owner` = '" . $USER['id'] . "' AND `planet_type` = '1' AND `destruyed` = '0' AND universe = " . $UNI . ";");
$MaxPlanets = PlayerUtil::maxPlanetCount($USER);
if ($iPlanetCount >= $MaxPlanets) {
$this->printMessage("you can not buy additional planets as you have reached the max allowed planets / user!", true, array('game.php?page=Planeta', 2));
die;
} elseif ($USER['id'] == $info['selledID']) {
$this->printMessage("you can not rebuy your old planets!", true, array('game.php?page=Planeta', 2));
die;
} else {
$this->tplObj->loadscript("jquery.countdown.js");
$this->tplObj->assign_vars(array('lotID' => $lotID, 'type' => $info['type'], 'field_max' => $info['field_max'], 'id_luna' => $info['id_luna'], 'planetID' => $info['planetID'], 'time' => !empty($info['time']) && $info['time'] > TIMESTAMP ? $info['time'] - TIMESTAMP : 0, 'current_price' => round($info['price'] + $info['price'] / 100 * 1)));
$this->display("page.planetauctions.lot.tpl");
}
}
开发者ID:Decoder1978,项目名称:Xterium,代码行数:20,代码来源:class.ShowPlanetaPage.php
示例17: _activeUser
private function _activeUser()
{
$validationID = HTTP::_GP('i', 0);
$validationKey = HTTP::_GP('k', '');
$userData = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . USERS_VALID . " WHERE validationID = " . $validationID . " AND validationKey = '" . $GLOBALS['DATABASE']->escape($validationKey) . "';");
if (!isset($userData)) {
$this->printMessage(t('vertifyNoUserFound'));
}
$GLOBALS['DATABASE']->query("DELETE FROM " . USERS_VALID . " WHERE validationID = " . $validationID . ";");
list($userID, $planetID) = PlayerUtil::createPlayer($userData['universe'], $userData['userName'], $userData['password'], $userData['email'], $userData['language'], $userData['planetName']);
if (!empty($userData['referralID'])) {
$GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET\n\t\t\t`ref_id`\t= " . $userData['referralID'] . ",\n\t\t\t`ref_bonus`\t= 1\n\t\t\tWHERE\n\t\t\t`id`\t\t= " . $userID . ";");
}
if (!empty($userData['externalAuthUID'])) {
$GLOBALS['DATABASE']->query("INSERT INTO " . USERS_AUTH . " SET\n\t\t\t`id`\t\t= " . $userID . ",\n\t\t\t`account`\t= '" . $GLOBALS['DATABASE']->escape($userData['externalAuthUID']) . "',\n\t\t\t`mode`\t\t= '" . $GLOBALS['DATABASE']->escape($userData['externalAuthMethod']) . "';");
}
$nameSender = t('registerWelcomePMSenderName');
$subject = t('registerWelcomePMSubject');
$message = t('registerWelcomePMText', Config::get('game_name', $userData['universe']));
return array('userID' => $userID, 'userName' => $userData['userName'], 'planetID' => $planetID);
}
开发者ID:fuding,项目名称:Antaris,代码行数:21,代码来源:ShowVertifyPage.class.php
示例18: _activeUser
private function _activeUser()
{
global $LNG;
$validationID = HTTP::_GP('i', 0);
$validationKey = HTTP::_GP('k', '');
$db = Database::get();
$sql = "SELECT * FROM %%USERS_VALID%%\n\t\tWHERE validationID\t= :validationID\n\t\tAND validationKey\t= :validationKey\n\t\tAND universe\t\t= :universe;";
$userData = $db->selectSingle($sql, array(':validationKey' => $validationKey, ':validationID' => $validationID, ':universe' => Universe::current()));
if (empty($userData)) {
$this->printMessage($LNG['vertifyNoUserFound']);
}
$config = Config::get();
$sql = "DELETE FROM %%USERS_VALID%% WHERE validationID = :validationID;";
$db->delete($sql, array(':validationID' => $validationID));
list($userID, $planetID) = PlayerUtil::createPlayer($userData['universe'], $userData['userName'], $userData['password'], $userData['email'], $userData['language']);
if ($config->mail_active == 1) {
require 'includes/classes/Mail.class.php';
$MailSubject = sprintf($LNG['registerMailCompleteTitle'], $config->game_name, Universe::current());
$MailRAW = $LNG->getTemplate('email_reg_done');
$MailContent = str_replace(array('{USERNAME}', '{GAMENAME}', '{GAMEMAIL}'), array($userData['userName'], $config->game_name . ' - ' . $config->uni_name, $config->smtp_sendmail), $MailRAW);
try {
Mail::send($userData['email'], $userData['userName'], $MailSubject, $MailContent);
} catch (Exception $e) {
// This mail is wayne.
}
}
if (!empty($userData['referralID'])) {
$sql = "UPDATE %%USERS%% SET\n\t\t\t`ref_id`\t= :referralId,\n\t\t\t`ref_bonus`\t= 1\n\t\t\tWHERE\n\t\t\t`id`\t\t= :userID;";
$db->update($sql, array(':referralId' => $userData['referralID'], ':userID' => $userID));
}
if (!empty($userData['externalAuthUID'])) {
$sql = "INSERT INTO %%USERS_AUTH%% SET\n\t\t\t`id`\t\t= :userID,\n\t\t\t`account`\t= :externalAuthUID,\n\t\t\t`mode`\t\t= :externalAuthMethod;";
$db->insert($sql, array(':userID' => $userID, ':externalAuthUID' => $userData['externalAuthUID'], ':externalAuthMethod' => $userData['externalAuthMethod']));
}
$senderName = $LNG['registerWelcomePMSenderName'];
$subject = $LNG['registerWelcomePMSubject'];
$message = sprintf($LNG['registerWelcomePMText'], $config->game_name, $userData['universe']);
PlayerUtil::sendMessage($userID, 1, $senderName, 1, $subject, $message, TIMESTAMP);
return array('userID' => $userID, 'userName' => $userData['userName'], 'planetID' => $planetID);
}
开发者ID:tatarysh,项目名称:2Moons,代码行数:40,代码来源:ShowVertifyPage.class.php
示例19: newPassword
function newPassword()
{
$userID = HTTP::_GP('u', 0);
$validationKey = HTTP::_GP('k', '');
$isValid = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . LOSTPASSWORD . " WHERE userID = " . $userID . " AND `key` = '" . $GLOBALS['DATABASE']->escape($validationKey) . "' AND time > " . (TIMESTAMP - 1800) . " AND hasChanged = 0;");
if (empty($isValid)) {
$this->printMessage(t('passwordValidInValid'), NULL, array(array('label' => t('passwordBack'), 'url' => 'index.php')));
}
$newPassword = uniqid();
$userData = $GLOBALS['DATABASE']->getFirstRow("SELECT username, email_2 as mail FROM " . USERS . " WHERE id = " . $userID . ";");
$MailRAW = $GLOBALS['LNG']->getTemplate('email_lost_password_changed');
$MailContent = str_replace(array('{USERNAME}', '{GAMENAME}', '{GAMEMAIL}', '{PASSWORD}', '{EMAIL}', '{IP}', '{DATE}'), array($userData['username'], Config::get('game_name') . ' - ' . Config::get('uni_name'), Config::get('smtp_sendmail'), $newPassword, $email_2, $_SERVER['REMOTE_ADDR'], date("m.d.y")), $MailRAW);
$GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET password = '" . PlayerUtil::cryptPassword($newPassword) . "' WHERE id = " . $userID . ";");
require 'includes/classes/Mail.class.php';
$headers = "From: [email protected]\r\n";
$headers .= "Reply-To: [email protected]\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($userData['mail'], t('passwordChangedMailTitle', Config::get('game_name')), $MailContent, $headers);
$GLOBALS['DATABASE']->query("UPDATE " . LOSTPASSWORD . " SET hasChanged = 1 WHERE userID = " . $userID . " AND `key` = '" . $GLOBALS['DATABASE']->escape($validationKey) . "';");
$this->printMessage(t('passwordChangedMailSend'), NULL, array(array('label' => t('passwordNext'), 'url' => 'index.php')));
}
开发者ID:fuding,项目名称:Antaris,代码行数:22,代码来源:ShowLostPasswordPage.class.php
示例20: SetNextQueueTechOnTop
public function SetNextQueueTechOnTop()
{
global $resource, $LNG;
if (empty($this->USER['b_tech_queue'])) {
$this->USER['b_tech'] = 0;
$this->USER['b_tech_id'] = 0;
$this->USER['b_tech_planet'] = 0;
$this->USER['b_tech_queue'] = '';
return false;
}
$CurrentQueue = unserialize($this->USER['b_tech_queue']);
$Loop = true;
while ($Loop == true) {
$ListIDArray = $CurrentQueue[0];
$isAnotherPlanet = $ListIDArray[4] != $this->PLANET['id'];
if ($isAnotherPlanet) {
$sql = 'SELECT * FROM %%PLANETS%% WHERE id = :planetId;';
$PLANET = Database::get()->selectSingle($sql, array(':planetId' => $ListIDArray[4]));
$RPLANET = new ResourceUpdate(true, false);
list(, $PLANET) = $RPLANET->CalcResource($this->USER, $PLANET, false, $this->USER['b_tech']);
} else {
$PLANET = $this->PLANET;
}
$PLANET[$resource[31] . '_inter'] = self::getNetworkLevel($this->USER, $PLANET);
$Element = $ListIDArray[0];
$Level = $ListIDArray[1];
$costResources = BuildFunctions::getElementPrice($this->USER, $PLANET, $Element);
$BuildTime = BuildFunctions::getBuildingTime($this->USER, $PLANET, $Element, $costResources);
$HaveResources = BuildFunctions::isElementBuyable($this->USER, $PLANET, $Element, $costResources);
$BuildEndTime = $this->USER['b_tech'] + $BuildTime;
$CurrentQueue[0] = array($Element, $Level, $BuildTime, $BuildEndTime, $PLANET['id']);
if ($HaveResources == true) {
if (isset($costResources[901])) {
$PLANET[$resource[901]] -= $costResources[901];
}
if (isset($costResources[902])) {
$PLANET[$resource[902]] -= $costResources[902];
}
if (isset($costResources[903])) {
$PLANET[$resource[903]] -= $costResources[903];
}
if (isset($costResources[921])) {
$this->USER[$resource[921]] -= $costResources[921];
}
$this->USER['b_tech_id'] = $Element;
$this->USER['b_tech'] = $BuildEndTime;
$this->USER['b_tech_planet'] = $PLANET['id'];
$this->USER['b_tech_queue'] = serialize($CurrentQueue);
$Loop = false;
} else {
if ($this->USER['hof'] == 1) {
if (!isset($costResources[901])) {
$costResources[901] = 0;
}
if (!isset($costResources[902])) {
$costResources[902] = 0;
}
if (!isset($costResources[903])) {
$costResources[903] = 0;
}
$Message = sprintf($LNG['sys_notenough_money'], $PLANET['name'], $PLANET['id'], $PLANET['galaxy'], $PLANET['system'], $PLANET['planet'], $LNG['tech'][$Element], pretty_number($PLANET['metal']), $LNG['tech'][901], pretty_number($PLANET['crystal']), $LNG['tech'][902], pretty_number($PLANET['deuterium']), $LNG['tech'][903], pretty_number($costResources[901]), $LNG['tech'][901], pretty_number($costResources[902]), $LNG['tech'][902], pretty_number($costResources[903]), $LNG['tech'][903]);
PlayerUtil::sendMessage($this->USER['id'], 0, $this->USER['b_tech'], 99, $LNG['sys_techlist'], $LNG['sys_buildlist_fail'], $Message);
}
array_shift($CurrentQueue);
if (count($CurrentQueue) ==
|
请发表评论