Exemplo n.º 1
0
 public function validateLoginCredentails()
 {
     // send form data to the model
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         // clean user input
         array_htmlspecialchars($_POST);
         // store username and password in object
         $this->username = $_POST['username'];
         $this->password = $_POST['password'];
         // invoke login form validator
         $LoginModel = new LoginModel();
         $LoginModel->validateFormData($_POST);
         var_dump($LoginModel->validateFormData($_POST));
         // get errors array
         $errorsArray = $LoginModel->getErrorsArray();
         if (filter_by_value($errorsArray, 'error', '1')) {
             // render errors to client
             require APP_PATH . 'views/login/login.php';
         } else {
         }
         echo "<br><br>ERRORS START: <br>";
         print_var($errorsArray);
         // render errors to client
         // require(APP_PATH . 'views/login/login.php');
         echo "HELLLLLO";
         echo URL_WITH_INDEX_FILE;
     }
 }