Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html lang="pl">
- <head>
- <meta charset="utf-8"/>
- <title>Cookies&Session</title>
- </head>
- <body>
- <form method="get">
- <button type="submit" name="cookieBtn">Cookie</button>
- <button type="submit" name="sessionBtn">Sesja</button>
- <button type="submit" name="cookieSessionDel">Usun cookie i sesje</button>
- </form>
- <?php
- //$cookieSubmitBtn = $_GET['cookieBtn'];
- //$sessionSubmitBtn = $_GET['sessionBtn'];
- //$sessionCookieDeleteBtn = $_GET['cookieSessionDel'];
- if(isset($_GET['cookieBtn'])) {
- setcookie('CiasteczkoTestowe', "Testowe cookie");
- echo "Ciasteczko zostało utworzone";
- } else if(isset($_GET['sessionBtn'])) {
- session_start();
- echo "Sesja została utworzona";
- } else if(isset($_GET['cookieSessionDel'])) {
- unset($_COOKIE['CiasteczkoTestowe']);
- session_destroy();
- echo "Ciasteczko i sesja zostały usunięte";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment