public function signin()
 {
     $uName = trim($_POST["uname"]);
     $uPass = trim($_POST["pw"]);
     (empty($uName) || empty($uPass)) && exit('{"state":false,"msg":"帐号或密码为空"}');
     $res = M('admin')->field('id,uPass,signCut')->where('uName=\'' . $uName . '\'')->find();
     if ($res) {
         if (md5md5($uPass) == $res['uPass']) {
             $res['signCut'] = $res['signCut'] + 1;
             M('admin')->where('id=' . $res['id'])->save(array('signInTime' => time(), 'signCut' => $res['signCut']));
             $textTpl = "<xml><uName><![CDATA[" . $uName . "]]></uName><signCut><![CDATA[" . $res['signCut'] . "]]></signCut><CreateTime>" . time() . "</CreateTime></xml>";
             MakeXml('pcAdmin', $textTpl);
             session('pcAdmin', array('uName' => $uName, 'signCut' => $res['signCut']));
             exit('{"state":true,"msg":"登录成功","userList":[]}');
         } else {
             exit('{"state":false,"msg":"密码错误"}');
         }
     } else {
         exit('{"state":false,"msg":"没有该帐号' . $uName . '"}');
     }
 }
 public function login()
 {
     if (IS_POST) {
         $username = $_REQUEST['username'];
         $password = $_REQUEST['password'];
         $res = M('admin')->where(array('uName' => $username))->find();
         if (!$res) {
             $this->error("用户名不存在");
             exit;
         }
         if (md5md5($password) != $res['uPass']) {
             $this->error("账号密码不匹配");
         } else {
             M('admin')->where(array('uName' => $username))->save(array('signInTime' => time(), 'signInIp' => get_client_ip(), 'signCut' => $res['signCut'] + 1));
             session('admin', array('id' => $res['id'], 'signCut' => $res['signCut'] + 1));
             redirect(U('Home/Index/index'));
         }
     }
     $this->assign('title', "用户登录");
     $this->display();
 }