我如何在下面编辑这个PHP函数,因此它将使用GetDate()
并将检查如下:
(nTime < DATEADD(DAY,-7,GETDATE()) OR nTime IS NULL)
而不是
if ((intval ($row['nTime']) + 604800) <= time() || !$count)
基本上我想做同样的事情,但要使用GetDate()
代替time()
代码:
$count = $db->doQuery('SELECT * FROM PANEL_NT WHERE strAccountID = ?', $_SESSION['strAccountID']);
$row = $db->doRead();
if ((intval ($row['nTime']) + 604800) <= time() || !$count)
{
$db->doQuery('SELECT * FROM ACCOUNT_CHAR WHERE strAccountID = ?', $_SESSION['strAccountID']);
$row = $db->doRead();
$db->doQuery('EXEC NT ?', $_SESSION['strAccountID']);
$db->doQuery('DELETE FROM PANEL_NT WHERE strAccountID = ?', $_SESSION['strAccountID']);
$db->doQuery('INSERT INTO PANEL_NT VALUES (?, ?)', $_SESSION['strAccountID'], time());
$this->content = Template::Load('error', array('errmsg' => Template::GetLangVar('NATION_TRANSFER_SUCCESS')));
}
else
{
$this->content = Template::Load('error',
array('errmsg' => Template::GetLangVar('NATION_TRANSFER_ERROR'))
);