Advertisement
Guest User

macieg

a guest
Sep 26th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4.  
  5.  
  6. ?><!doctype html>
  7. <html>
  8. <head>
  9. <meta charset="utf-8">
  10. </head>
  11.  
  12. <body>
  13.  
  14.  
  15.  
  16. <?php
  17. if (isset($_GET['logout']) && $_GET['logout']==1)
  18. {
  19. unset($_SESSION['czy_zalogow']);
  20. session_destroy();
  21. }
  22.  
  23. if(isset($_POST['login']) && isset($_POST['haslo']))
  24. {
  25. $l = $_POST['login'];
  26. $h = $_POST['haslo'];
  27.  
  28. if($l == "admin" && $h == "tajne")
  29. {
  30. $_SESSION['czy_zalogow']=1;
  31. }
  32. }
  33.  
  34.  
  35.  
  36.  
  37. if(!isset($_SESSION['czy_zalogow']))
  38. {
  39. ?>
  40.  
  41. <form name="f1" method="post" action="wyloguj.php">
  42. Login: <input type="text" name="login"><br>
  43. Hasło: <input type="password" name="haslo"><br>
  44. <input type="submit" value="Zaloguj">
  45. <?php
  46. }
  47. else
  48. {
  49. echo "<a href=\"wyloguj.php?logout=1\">Wyloguj!</a>";
  50.  
  51. }
  52. ?>
  53. </body>
  54.  
  55.  
  56. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement