Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2.  
  3. <?php
  4. session_start();
  5.  
  6. $username = "user";
  7. $password = "pass";
  8.  
  9. if (isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] == true){
  10. header("Location: success.php");
  11. }
  12.  
  13. if (isset($_POST['username']) && isset($_POST['password'])){
  14. if($_POST['username'] == $username && $_POST['password'] == $password){
  15.  
  16. $_SESSION['loggedIn'] = true;
  17. header("Location: success.php");
  18. }
  19.  
  20. }
  21. ?>
  22.  
  23. <html>
  24. <body>
  25. <form method="post" action="log-in.php">
  26. Username:<br/>
  27. <input type="text" name="username"><br/>
  28. Password<br/>
  29. <input type="password" name="password"><br/>
  30. <input type="submit" value="Login!">
  31. </form>
  32. </body>
  33. </html>
  34.  
  35. <!DOCTYPE HTML>
  36.  
  37. <?php
  38. session_start();
  39. if(!isset($_SESSION['loggedIn']) || $_SESSION['loggedIn'] == false){
  40. header("Location: index.html")
  41. }
  42. ?>
  43.  
  44. <html>
  45. <h>You have logged in!</h>
  46.  
  47. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement