Advertisement
Guest User

PHPHPPHPHPHPHPPHPH

a guest
Jan 23rd, 2020
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <?php
  2. //error_reporting(0);
  3.  
  4. if(isset($_GET['username']) AND isset($_GET['password'])){
  5. $username = $_GET['username'];
  6. $password = $_GET['password'];
  7. } else {
  8. $username = "";
  9. $password = "";
  10. }
  11.  
  12. if(isset($_COOKIE['username']) AND isset($_COOKIE['password'])){
  13. $username = $_COOKIE['username'];
  14. $password = $_COOKIE['password'];
  15. }
  16.  
  17. ?>
  18.  
  19. <?php
  20.  
  21. if($username == "test" AND $password == "test"){
  22.  
  23. echo '
  24. Sono Loggato, ora sloggati!
  25.  
  26. <br><br>
  27.  
  28. <form method="POST">
  29. <input type="submit" name="logout" value="logout"/>
  30. <a href="/"></a>
  31. </form>
  32. ';
  33.  
  34. if(isset($_POST['logout'])){
  35. $username = NULL;
  36. $password = NULL;
  37. header("refresh:0; url=/");
  38. }
  39.  
  40. setcookie("username", $username, time() + 300);
  41. setcookie("password", $password, time() + 300);
  42. } else {
  43. echo '
  44.  
  45. <form action="/" method="GET">
  46. Username:&nbsp;<input type="text" name="username"></input>
  47. <br><br>
  48. Password:&nbsp;<input type="password" name="password"></input>
  49. <br><br>
  50. <input type="submit" value="login"></input>
  51. </form>
  52.  
  53. ';
  54. }
  55.  
  56. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement