Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ($_POST['destroy'])
- {
- session_destroy();
- }
- else
- {
- session_start();
- }
- ?>
- <html>
- <head>
- <title>Session test</title>
- </head>
- <body>
- <?php
- if (isset($_POST['destroy']))
- {
- echo "Destroy set";
- }
- $_SESSION['counter']++;
- echo "You have visited this page " . $_SESSION['counter'] . " times" . "<BR>";
- echo "I am tracking you using the session id " . session_id() . "<BR>";
- echo "Click <a href="" . $_SERVER['PHP_SELF'] . "?destroy=1">here</a> to destroy the session.";
- ?>
- $_POST['destroy']
- $_GET['destroy']
- session_start();
- $_SESSION = array();
- if (isset($_COOKIE[session_name()])) {
- setcookie(session_name(), '', time()-42000, '/');
- }
- session_destroy();
- if( $_GET['destroy'] == 1 )
- if( isset($_GET['destroy']) )
Add Comment
Please, Sign In to add comment