1
0
mirror of https://e.coding.net/circlecloud/McAccount.git synced 2025-09-05 07:27:21 +00:00

添加用户检测 和用户登录 登出...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092
2015-11-09 20:54:43 +08:00
parent eaef526fd3
commit da6ef10111
2 changed files with 40 additions and 21 deletions

View File

@ -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;