Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: josh
  5. * Date: 03/04/2017
  6. * Time: 14:33
  7. */
  8.  
  9.  
  10. session_start();
  11.  
  12. $_SESSION['loggedIn'] = false;
  13.  
  14. $username = 'test';
  15. $password = 'test';
  16.  
  17. //If not a valid request
  18. if(!validRequest()){
  19. header('redirect somewhere CHANGE ME');
  20. return;
  21. };
  22.  
  23. if(!authenticateCredentials($username, $password)) {
  24. //FAILED TO AUTHENTICATE LADS UR PASSWORD WAS WRONG LOL
  25. header('GO SOMEWHERE ELSE CHANGE ME');
  26. return;
  27. }
  28.  
  29. // HAPPY ROUTE ELTS GO
  30. $_SESSION['loggedIn'] = true;
  31.  
  32. header('FUCKIN MADE IT SHOW SOMETHING ELSE');
  33.  
  34.  
  35. function validRequest() {
  36. return (array_key_exists('username', $_POST) && array_key_exists('password', $_POST));
  37. }
  38.  
  39. function authenticateCredentials($username, $password) {
  40. return ($username == $_POST['username'] && $password == $_POST['password']);
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement