mirror of
https://e.coding.net/circlecloud/McAccount.git
synced 2024-11-24 02:08:53 +00:00
允许退出10秒内免登陆...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
8f27adba84
commit
68e7fe8c2e
@ -5,7 +5,7 @@ class authme extends AmysqlModel {
|
|||||||
"username" => $username,
|
"username" => $username,
|
||||||
"password" => $password,
|
"password" => $password,
|
||||||
"ip" => $ip,
|
"ip" => $ip,
|
||||||
"lastlogin" => '',
|
"lastlogin" => time (),
|
||||||
"x" => '0',
|
"x" => '0',
|
||||||
"y" => '0',
|
"y" => '0',
|
||||||
"z" => '0',
|
"z" => '0',
|
||||||
@ -38,11 +38,17 @@ class authme extends AmysqlModel {
|
|||||||
$num = $this->_sum ( "SELECT * FROM `authme` WHERE `username`='$username' AND `isLogged`='1'" );
|
$num = $this->_sum ( "SELECT * FROM `authme` WHERE `username`='$username' AND `isLogged`='1'" );
|
||||||
if ($num != 0)
|
if ($num != 0)
|
||||||
return true;
|
return true;
|
||||||
else
|
else {
|
||||||
|
$last = $this->_sum ( "SELECT * FROM `authme` WHERE `username`='$username' AND `lastlogin`>" . (time () - 10) );
|
||||||
|
if ($last != 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
public function clientlogout($username) {
|
public function clientlogout($username) {
|
||||||
$key = array ("isLogged" => 0 );
|
$key = array ("isLogged" => 0,"lastlogin" => time () );
|
||||||
$num = $this->_update ( 'authme', $key, "WHERE `username`='$username'" );
|
$num = $this->_update ( 'authme', $key, "WHERE `username`='$username'" );
|
||||||
if ($num != 0)
|
if ($num != 0)
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user