Example #1
0
 /**
  * The login form action field requests the method attemptLogin via domain/login/attemptLogin 
  * Example: <form action="login/attemptLogin"></form>
  * 
  * @return void
  */
 public function attemptLogin()
 {
     $LoginModel = new LoginModel();
     // store boolean representing if client credentials matched database record
     $login = $LoginModel->validateLoginForm($_POST);
     if ($login) {
         // store login status in session
         Session::set('logged_in', true);
         // redirect to dashboard
         header('Location: ' . URL_WITH_INDEX_FILE . 'index');
     } else {
         // redirect to login screen
         header('Location: ' . URL_WITH_INDEX_FILE . 'login');
     }
 }