Ejemplo n.º 1
0
 /**
  * 验证管理员登陆 SESSION 
  * @author 致远<*****@*****.**>
  */
 protected function checkSessionLogin()
 {
     if (session('hash') && session('login') === true) {
         $check = D('AdminUser')->getAdmininfo(session('admin_id'), array('pkid'));
         if (md5(Sha1($check['pkid'], true)) != session('hash')) {
             self::logout();
         } else {
             return true;
         }
     } else {
         self::logout();
     }
 }
Ejemplo n.º 2
0
 /**
  * 验证管理员登陆账户密码
  * @author 致远<*****@*****.**>
  */
 public function checkLogin()
 {
     if (IS_POST) {
         $data['username'] = I('post.username');
         $data['passwd'] = I('post.passwd');
         $result = D('AdminUser')->checkAdminLogin($data);
         if ($result['status'] == 'true') {
             session('admin_id', $result['data']['pkid']);
             session('admin_name', $result['data']['truename']);
             session('admin_headpic', $result['data']['avatar']);
             session('login', true);
             session('hash', md5(Sha1($result['data']['pkid'], true)));
         }
         exit(json_encode($result));
     }
 }
Ejemplo n.º 3
0
 public function encode($plainText)
 {
     return Sha1($plainText);
 }
Ejemplo n.º 4
0
        return new gException('USER_NOT_FOUND', 'Пользователь не зарегистрирован в системе');
    case 'array':
        break;
    default:
        return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$User = Current($Users);
#-------------------------------------------------------------------------------
if (!$User['IsActive']) {
    return new gException('USER_UNACTIVE', $User['LockReason'] ? $User['LockReason'] : 'Пользователь отключен');
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if ($User['Watchword'] != Md5($Password) && $User['Watchword'] != Sha1($Password)) {
    #-------------------------------------------------------------------------------
    $UniqID = $User['UniqID'];
    #-------------------------------------------------------------------------------
    if ($UniqID == 'no' || $UniqID != $Password) {
        return new gException('PASSWORD_NOT_MATCHED', 'Введен неверный пароль');
    }
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (Time() - $User['EnterDate'] > 86400) {
    #-------------------------------------------------------------------------------
    $IsUpdate = DB_Update('Users', array('UniqID' => Md5(UniqID('ID'))), array('ID' => $User['ID']));
    if (Is_Error($IsUpdate)) {
        return ERROR | @Trigger_Error(500);