예제 #1
0
 /**
  * [signup description] 前台用户注册
  * @Author   alanfang2012@163.com
  * @DateTime 2015-09-01T22:27:15+0800
  */
 public function signup()
 {
     if (!empty($_POST)) {
         $user_mod = new \Model\UserModel();
         $res = $user_mod->create();
         if ($res) {
             $p = $user_mod->makePwd($res['user_name'], $res['user_pswd']);
             $res['user_pswd'] = $p['user_pswd'];
             $res['salt'] = $p['salt'];
             $z = $user_mod->add($res);
             session('user_id', $z);
             session('user_name', $res['user_name']);
             if ($z) {
                 $this->redirect('user/info');
             }
         }
         $this->assign('errorInfo', $user_mod->getError());
     }
     $this->display();
 }