function remotelogin_action() { cookie::del('passinfo'); $this->view->loginfalse=cookie::get('loginfalse'.md5($_SERVER['REQUEST_URI'])); if (front::$args) { $user=new user(); $args = xxtea_decrypt(base64_decode(front::$args), config::get('cookie_password')); $user=$user->getrow(unserialize($args)); if (is_array($user)) { if ($user['groupid'] == '888') front::$isadmin=true; cookie::set('login_username',$user['username']); cookie::set('login_password',front::cookie_encode($user['password'])); session::set('username',$user['username']); require_once ROOT.'/celive/include/config.inc.php'; require_once ROOT.'/celive/include/celive.class.php'; $login=new celive(); $login->auth(); $GLOBALS['auth']->remotelogin($user['username'],$user['password']); $GLOBALS['auth']->check_login1(); front::$user=$user; }elseif (!is_array(front::$user) ||!isset(front::$isadmin)) { cookie::set('loginfalse'.md5($_SERVER['REQUEST_URI']),(int) cookie::get('loginfalse'.md5($_SERVER['REQUEST_URI'])) +1,time() +3600); event::log('loginfalse','失败 user='******'username']); front::flash('密码错误或不存在该管理员!'); front::refresh(url('admin/login',true)); } } $this->render(); }
function check_admin() { if (cookie::get('login_username')&&cookie::get('login_password')) { $user=new user(); $user=$user->getrow(array('username'=>cookie::get('login_username'))); $roles = session::get('roles'); if ($roles && is_array($user)&&cookie::get('login_password')==front::cookie_encode($user['password'])) { $this->view->user=$user; front::$user=$user; }else{ $user=null; } } if (!isset($user)||!is_array($user)) { front::redirect(url::create('admin/login')); } }