コード例 #1
0
 public function registerSubmitAction()
 {
     if ($this->request->isPost()) {
         $type = $this->request->getPost('type');
         $params = array();
         $ubm = new DtbUserBasic();
         $check_value = true;
         $password = $this->request->getPost('password');
         $nickname = $this->request->getPost('nickname');
         $img_verity = $this->request->getPost('img_verity');
         $res = $this->checkVerity($img_verity);
         if (!$res) {
             $this->flash->error('验证码错误!!');
             return $this->dispatcher->forward(array('controller' => 'user', 'action' => 'register'));
         }
         if ($type == 1) {
             //mobile
             $mobile = $this->request->getPost('mobile');
             $mobile_code = $this->request->getPost('mobile_code');
             if (!$this->_checkRegisterConditon($type, $mobile, '', $password, $mobile_code, $nickname)) {
                 echo "<a href='/user/register'>返回</a>";
                 $response = new Phalcon\Http\Response();
                 $this->response->redirect("/user/register");
             }
             $params = array('nickname' => $nickname, 'password' => md5($password), 'mobile' => $mobile, 'email' => $mobile . '@test.com', 'reg_form' => 1);
         } else {
             $email = $this->request->getPost('email');
             if (!$this->_checkRegisterConditon($type, '', $email, $password, '', $nickname)) {
                 echo "<a href='/user/register'>返回</a>";
                 $response = new Phalcon\Http\Response();
                 $response->redirect("/user/register");
             }
             //email
             $params = array('nickname' => $nickname, 'password' => md5($password), 'email' => $email, 'mobile' => '0', 'reg_form' => 2);
         }
         $res = $ubm->register($user_id, $params, $type);
         if ($res) {
             $this->flash->success('注册成功,请登陆!');
             return $this->dispatcher->forward(array('controller' => 'user', 'action' => 'applyInvest'));
         }
     }
 }