Esempio n. 1
0
 public function updateinfoAction()
 {
     $res = $this->getRequest()->getParams();
     $birth = $res[year] . "-" . $res[month] . "-" . $res[day];
     $arr = array('sex' => $res[gender], 'name' => $res[nick], 'sheng' => $res[province], 'shi' => $res[city], 'xian' => $res[town], 'birth' => $birth, 'interest' => $res[hobby]);
     $userinfo = new userinfoModel();
     $rows_affected = $userinfo->updateUserinfo($arr, $res[address]);
     if ($rows_affected > 0) {
         $this->view->id = $res[address];
         $this->view->res = 1;
     } else {
         $this->view->res = 2;
     }
 }
Esempio n. 2
0
 public function expertregisterAction()
 {
     $account = $this->getRequest()->getParam('account');
     $password = $this->getRequest()->getParam('password');
     $name = $this->getRequest()->getParam('name');
     $content = $this->getRequest()->getParam('context');
     $work = $this->getRequest()->getParam('work');
     $code = $this->getRequest()->getParam('surecode');
     if ($code == $_SESSION["validcode"]) {
         $User = new UserModel();
         if ($User->ifRegister($account)) {
             $set = array('account' => $account, 'password' => $password, 'name' => $name, 'email' => $account, 'type' => 2);
             //在注册用户的时候顺带着要建一个用户个人信息
             if ($User->insert($set) > 0) {
                 $where = "email='{$account}'";
                 $result = $User->fetchAll($where)->toArray();
                 $info = array('userid' => $result[0][id], 'sex' => 'M', 'name' => $result[0][name], 'sheng' => '北京市', 'shi' => '北京市', 'xian' => '东城区', 'birth' => '1994-5-29', 'interest' => '跑步');
                 $userinfo = new userinfoModel();
                 $expert = array('info' => $content, 'userid' => $result[0][id], 'work' => $work, 'concern' => 0, 'image' => '/WebOne/public/image/initial.png');
                 $expertinfo = new expertinfoModel();
                 if ($userinfo->insert($info) > 0 && $expertinfo->insert($expert) > 0) {
                     //注册账号成功
                     $this->render('ok');
                 }
             } else {
                 $this->view->info = '1';
                 $this->_forward('error');
             }
         } else {
             $this->view->info = '2';
             //账号已经创建
             $this->_forward('error');
         }
     } else {
         $this->view->info = '3';
         $this->render('error');
         //验证码输入错误
     }
 }