Guest User

Untitled

a guest
Jan 17th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. unset($_SESSION["currentUser"]);
  5. unset($_SESSION["currentUserID"]);
  6.  
  7. if (isset($_POST["login"])) {
  8.  
  9. $formUser=$_POST["EmailAddress"];
  10. $formPass=$_POST["Password"];
  11.  
  12. include("dbConnect.php");
  13. $dbQuery=$conn->prepare("select * from Profile where EmailAddress=:formUser");
  14. $dbParams=array('formUser'=>$formUser);
  15. $dbQuery->execute($dbParams);
  16. $dbRow = $dbQuery->fetch(PDO::FETCH_ASSOC);
  17.  
  18. if ($dbRow["EmailAddress"]==$formUser) {
  19. if ($dbRow["Password"]==$formPass) {
  20. $_SESSION["currentUser"]=$formUser;
  21. $_SESSION["currentUserID"]=$dbRow["id"];
  22. header("Location: index.php");
  23. }
  24. else {
  25. header("Location: login.php?failCode=2");
  26. }
  27. } else {
  28. header("Location: login.php?failCode=1");
  29. }
  30.  
  31. } else {
  32.  
  33. ?>
Add Comment
Please, Sign In to add comment