コード例 #1
0
ファイル: smi-controller.php プロジェクト: Maharaja1/drdata
 public function signup()
 {
     try {
         if ($_POST['email'] != $_POST['emailconfirm']) {
             throw new Exception('signup: emails do not match');
         }
         if (!Check::isemail($_POST['email'])) {
             throw new Exception('signup: bad email format');
         }
         if ($_POST['password'] != $_POST['passwordconfirm']) {
             throw new Exception('signup: passwords do not match');
         }
         if (!Check::validpassword($_POST['password'])) {
             throw new Exception("signup: " . Check::err());
         }
         $r = new Researcher();
         if ($r->ins(array('email' => $_POST['email'], 'password' => md5($_POST['password']))) === false) {
             throw new Exception($r->err());
         }
         $rid = $r->getid();
         $_SESSION['user'] = $r->getone($rid);
         return 'home.tpl';
     } catch (Exception $e) {
         $this->err($e);
         View::assign('error', $this->error);
         return 'error.tpl';
     }
 }