コード例 #1
0
 function customerLogin()
 {
     session_save_path('/tmp');
     ini_set('session.gc_probability', 1);
     if (!isset($_SESSION)) {
         session_start();
     }
     $_SESSION['categories'] = $_POST['categories'];
     $_SESSION['sizes'] = $_POST['sizes'];
     $_SESSION['colors'] = $_POST['colors'];
     $_SESSION['gender'] = $_POST['gender'];
     $this->email = $_REQUEST['email'];
     $this->password = $_REQUEST['password'];
     $this->password_hash = $this->createPasswordHash($this->password);
     $model = new Application_Models_MongoDB();
     $match = $model->loginCustomer($this->email, $this->password_hash);
     try {
         if ($match == false) {
             throw new Exception('Username and or password did not match!');
         } elseif ($match == true) {
             print_r($match);
             $_SESSION['user'] = $match;
         }
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }