Advertisement
Guest User

ForEach

a guest
Mar 25th, 2017
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.41 KB | None | 0 0
  1.   if (isset($_REQUEST["button"]))
  2.   {
  3.     $username = !empty($_POST["loginName"]) ? trim($_POST["loginName"]) : null;
  4.     $password = !empty($_POST["loginPassword"]) ? trim($_POST["loginPassword"]) : null;
  5.  
  6.     $currentUser = getLogIn($username,$password);
  7.     $passHash = getHashedPassword($username);
  8.  
  9.     $validPass = password_verify($password, $passHash);
  10.  
  11.     if ($validPass) {
  12.         echo "Success";
  13.  
  14.               foreach($currentUser as $user)
  15.                 {
  16.  
  17.  
  18.               if($user->userName== $username && $user->userPass==$password)
  19.               {
  20.  
  21.                 if($user->userType == "Administrator") {
  22.                   $_SESSION['secondMenu']=menuDecision($currentuser["userType"]);
  23.                   header('Location: ../View/accountAdministrator.php');
  24.                 }
  25.  
  26.                 else if($user->userType == "Customer")
  27.                 {
  28.                   $_SESSION['secondMenu']=menuDecision($currentuser["userType"]);
  29.                   header('Location: ../View/accountCustomer.php');
  30.                 }
  31.                 else
  32.                 {
  33.                   $_SESSION['secondMenu']=menuDecision($currentuser["userType"]);
  34.                   $_SESSION['errorMessage']="The login details supplied do not match any valid user.";
  35.                   require_once("../View/account.php");
  36.                 }
  37.               }
  38.             }
  39.       else {
  40.         echo "Error";
  41.         }
  42.       }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement