Frezi2005

Untitled

Apr 3rd, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. <html lang="pl">
  2. <head>
  3. <meta charset="utf-8"/>
  4. <title>Cookies&Session</title>
  5. </head>
  6. <body>
  7. <form method="get">
  8. <button type="submit" name="cookieBtn">Cookie</button>
  9. <button type="submit" name="sessionBtn">Sesja</button>
  10. <button type="submit" name="cookieSessionDel">Usun cookie i sesje</button>
  11. </form>
  12. <?php
  13. //$cookieSubmitBtn = $_GET['cookieBtn'];
  14. //$sessionSubmitBtn = $_GET['sessionBtn'];
  15. //$sessionCookieDeleteBtn = $_GET['cookieSessionDel'];
  16.  
  17. if(isset($_GET['cookieBtn'])) {
  18. setcookie('CiasteczkoTestowe', "Testowe cookie");
  19. echo "Ciasteczko zostało utworzone";
  20. } else if(isset($_GET['sessionBtn'])) {
  21. session_start();
  22. echo "Sesja została utworzona";
  23. } else if(isset($_GET['cookieSessionDel'])) {
  24. unset($_COOKIE['CiasteczkoTestowe']);
  25. session_destroy();
  26. echo "Ciasteczko i sesja zostały usunięte";
  27. }
  28. ?>
  29. </body>
  30. </html>
Advertisement
Add Comment
Please, Sign In to add comment