showMsg('','/admin_index/');} } public function loginAction(){ $p = $_REQUEST; $pName = empty($p['name'])?Tool_Fnc::ajaxMsg('用户名不能为空'):Tool_Fnc::safe_string($p['name']); $pPasswd = empty($p['passwd'])?Tool_Fnc::ajaxMsg('密码不能为空'):trim($p['passwd']); $tMO = new AdminModel; $tRow = $tMO->field('*')->where("admin = '{$pName}' and status=1")->fRow(); if(md5($pPasswd) != $tRow['password']){Tool_Fnc::ajaxMsg('账号密码不正确'); } $_SESSION['admin'] = array('id'=> $tRow['id'],'name' => $tRow['admin']); setcookie('admin[id]',$tRow['id'],time()+60*60*24*365,'/'); setcookie('admin[name]',$tRow['admin'],time()+60*60*24*365,'/'); if(isset($p['remember']) && $p['remember'] == 'remember'){ setcookie('admin[id]',$tRow['id'],time()+60*60*24*365,'/'); setcookie('admin[name]',$tRow['admin'],time()+60*60*24*365,'/'); } Tool_Fnc::ajaxMsg('登录成功',1); $this->showMsg('', '/admin_index'); } public function quitAction(){ session_destroy(); setcookie('admin[id]','',time()-1,'/'); setcookie('admin[name]','',time()-1,'/'); unset($_COOKIE); $this->showMsg('', '/admin_login'); } }