Guest User

Untitled

a guest
May 2nd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php
  2. session_start();
  3. ob_start();
  4. $user = $_POST['un'];
  5. $pass = $_POST['pw'];
  6.  
  7. $unpws = file("rest_data/eta_un_pw.txt");
  8.  
  9. $allowLogin = false;
  10.  
  11. for($i = 0; $i<count($unpws); $i++)
  12. {
  13. $tempArray = explode(":",$unpws[$i]);
  14. if($tempArray[0] == $user && $tempArray[1] == $pass)
  15. {
  16.  
  17. $allowLogin = true;
  18. }
  19. else
  20. {
  21. $allowLogin = false;
  22. }
  23. }
  24.  
  25. if($allowLogin)
  26. {
  27. $_SESSION['user'] = $user;
  28. header("Location: etaCreator.php");
  29. }
  30. else
  31. {
  32. echo "Sorry. Your username and password did not match.";
  33. }
  34. ob_flush();
  35. ?>
Add Comment
Please, Sign In to add comment