mirror of
https://e.coding.net/circlecloud/McAccount.git
synced 2024-11-22 01:48:55 +00:00
添加用户检测 和用户登录 登出...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
eaef526fd3
commit
da6ef10111
@ -13,9 +13,23 @@ class user_public extends AmysqlController {
|
||||
function login() {
|
||||
if ($this->_model ( "authme" )->login ( @$_REQUEST ['user'], md5 ( @$_REQUEST ['pass'] ) )) {
|
||||
$_SESSION ['username'] = @$_REQUEST ['user'];
|
||||
JsonSuccess ( '登陆成功' );
|
||||
JsonSuccess ( '登陆成功!' );
|
||||
} else {
|
||||
JsonError ( '登陆失败' );
|
||||
JsonError ( '登陆失败!' );
|
||||
}
|
||||
}
|
||||
function clientcheck() {
|
||||
if ($this->_model ( "authme" )->clientcheck ( @$_REQUEST ['user'] )) {
|
||||
JsonSuccess ( '通过验证 允许登录服务器!' );
|
||||
} else {
|
||||
JsonError ( '未通过验证 请T出服务器!' );
|
||||
}
|
||||
}
|
||||
function clientlogout() {
|
||||
if ($this->_model ( "authme" )->clientlogout ( @$_REQUEST ['user'] )) {
|
||||
JsonSuccess ( '离线成功!' );
|
||||
} else {
|
||||
JsonError ( '离线失败!' );
|
||||
}
|
||||
}
|
||||
function pass() {
|
||||
|
@ -10,15 +10,8 @@ class authme extends AmysqlModel {
|
||||
"y" => '0',
|
||||
"z" => '0',
|
||||
"world" => 'world',
|
||||
"email" => $mail
|
||||
);
|
||||
$data = array (
|
||||
"address" => $mail,
|
||||
'verify' => '',
|
||||
'statu' => '0',
|
||||
'time' => date ( 'Y-m-d' ),
|
||||
"user" => $username
|
||||
);
|
||||
"email" => $mail );
|
||||
$data = array ("address" => $mail,'verify' => '','statu' => '0','time' => date ( 'Y-m-d' ),"user" => $username );
|
||||
$this->_insert ( 'mail', $data );
|
||||
if ($this->_insert ( 'authme', $value ) != 0)
|
||||
return true;
|
||||
@ -26,26 +19,38 @@ class authme extends AmysqlModel {
|
||||
return false;
|
||||
}
|
||||
public function login($username, $password) {
|
||||
if ($this->_sum ( "SELECT * FROM `authme` WHERE `username` = '$username' AND `password` = '$password'" ) == 0)
|
||||
$sum = $this->_sum ( "SELECT * FROM `authme` WHERE `username` = '$username' AND `password` = '$password'" );
|
||||
if ($sum != 0) {
|
||||
$key = array ("isLogged" => 1 );
|
||||
$this->_update ( 'authme', $key, "WHERE `username`='$username'" );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public function clientcheck($username) {
|
||||
$num = $this->_sum ( "SELECT * FROM `authme` WHERE `username`='$username' AND `isLogged`='1'" );
|
||||
if ($num != 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
public function clientlogout($username) {
|
||||
$key = array ("isLogged" => 0 );
|
||||
$num = $this->_update ( 'authme', $key, "WHERE `username`='" . $username . "'" );
|
||||
if ($num == 0)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
public function pass($username, $newpass) {
|
||||
$key = array (
|
||||
"password" => $newpass
|
||||
);
|
||||
$num = $this->_update ( 'authme', $key, "WHERE username='" . $username . "'" );
|
||||
$key = array ("password" => $newpass );
|
||||
$num = $this->_update ( 'authme', $key, "WHERE `username`='" . $username . "'" );
|
||||
if ($num == 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
public function pass_forge($value, $username) {
|
||||
$key = array (
|
||||
"password" => $value
|
||||
);
|
||||
$num = $this->_update ( 'authme', $key, "WHERE username='" . $username . "'" );
|
||||
// print_r($key);
|
||||
$key = array ("password" => $value );
|
||||
$num = $this->_update ( 'authme', $key, "WHERE `username`='" . $username . "'" );
|
||||
if ($num == 0)
|
||||
return false;
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user