本文整理汇总了PHP中Neuron_Core_Tools::timestampToMysqlDatetime方法的典型用法代码示例。如果您正苦于以下问题:PHP Neuron_Core_Tools::timestampToMysqlDatetime方法的具体用法?PHP Neuron_Core_Tools::timestampToMysqlDatetime怎么用?PHP Neuron_Core_Tools::timestampToMysqlDatetime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Neuron_Core_Tools
的用法示例。
在下文中一共展示了Neuron_Core_Tools::timestampToMysqlDatetime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: moveUnit
public function moveUnit($target)
{
// Calculate distance
$distance = Dolumar_Map_Map::getDistanceBetweenVillages($this->getLocation(), $target);
$duration = $this->getTravelDuration($distance);
// Update
$db = Neuron_Core_Database::__getInstance();
$db->update('villages_specialunits', array('vsu_moveStart' => Neuron_Core_Tools::timestampToMysqlDatetime(time()), 'vsu_moveEnd' => Neuron_Core_Tools::timestampToMysqlDatetime(time() + $duration), 'vsu_location' => $target->getId()), "vsu_id = " . $this->getId());
}
示例2: cleanServer
public static function cleanServer()
{
$db = Neuron_Core_Database::__getInstance();
$log = array();
// Kill players
$last = Neuron_Core_Tools::timestampToMysqlDatetime(time() - 60 * 60 * 24 * 45);
$l = $db->select('n_players', array('plid', 'killCounter'), "lastRefresh < '" . $last . "' AND isPlaying = 1");
foreach ($l as $v) {
if ($v['killCounter'] < 5) {
$db->update('n_players', array('killCounter' => '++'), "plid = '" . $v['plid'] . "'");
} else {
// Kill!
$player = Neuron_GameServer::getPlayer($v['plid']);
if (!$player->isModerator()) {
$player->doResetAccount();
/*
$log[] = array
(
'action' => 'reset',
'subject' => 'account',
'name' => $player->getNickname ()
);
*/
$player->__destruct();
}
}
}
// Kill villages
$last = Neuron_Core_Tools::timestampToMysqlDatetime(time() - 60 * 60 * 24 * 5);
//$last = Neuron_Core_Tools::timestampToMysqlDatetime (time ());
$l = $db->select('villages', array('vid'), "isActive = '0' AND (removalDate < '{$last}' OR removalDate IS NULL)");
foreach ($l as $v) {
$village = Dolumar_Players_Village::getVillage($v['vid'], false, true, true);
$village->destroyVillage();
$village->__destruct();
}
// Remove old login data (2 weeks old)
$rem = $db->remove('n_login_log', "l_datetime < '" . date('Y-m-d H:i:s', time() - 60 * 60 * 24 * 7 * 2) . "'");
$log[] = "Removed " . $rem . " login logs.\n";
// Remove old game log data (2 months old)
//$db->remove ('game_log', "l_date < '".date ('Y-m-d H:i:s', time () - 60*60*31*2)."'");
// Remove old battle reports (2 months old)
$rem = $db->remove('battle_report', "fightDate < '" . (time() - 60 * 60 * 24 * 31 * 2) . "'");
$log[] = "Removed " . $rem . " battle reports.\n";
return $log;
}
示例3: setTemporaryKey
public static function setTemporaryKey(Neuron_GameServer_Player $player, $key, $timeout)
{
$db->update('n_players', array('tmp_key' => $key, 'tmp_key_end' => Neuron_Core_Tools::timestampToMysqlDatetime($timeout)), "plid = " . $player->getId());
}
示例4: sendLostPassword
public function sendLostPassword($email)
{
// Check the database for this user
$db = Neuron_Core_Database::__getInstance();
$user = $db->select('n_players', array('plid', 'email', 'nickname'), "email = '" . $db->escape($email) . "' AND email_cert = 1 AND isRemoved = 0");
if (count($user) != 1) {
$this->warning = 'user_not_found';
return false;
}
// User is found: let's continue the process.
$password = substr($this->getRandomPassword(), 0, 6);
// Remove all other temporary password from this user
$db->remove('n_temp_passwords', "p_plid = " . $user[0]['plid'] . " OR p_expire < NOW()");
// Add this new one
$db->insert('n_temp_passwords', array('p_plid' => $user[0]['plid'], 'p_pass' => $password, 'p_expire' => Neuron_Core_Tools::timestampToMysqlDatetime(time() + 60 * 60 * 24 * 2)));
// Send this temporary password to the user.
$this->sendLostPasswordMail($user[0]['email'], $user[0]['nickname'], $password);
return true;
}