- git clone && cd
$ php -S localhost:8080
Last active
February 20, 2017 01:18
-
-
Save kanonji/acf97c84fac6ffbff794d77dbd41c1ec to your computer and use it in GitHub Desktop.
Destroying session with session_regenerate_id(true)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/session |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_save_path('./session'); | |
session_start(); | |
echo 'Session started' . '<br>' . PHP_EOL; | |
echo session_id() . '<br>' . PHP_EOL; | |
session_regenerate_id(true); | |
echo 'Session regenerated' . '<br>' . PHP_EOL; | |
echo session_id() . '<br>' . PHP_EOL; | |
echo '$_SESSION["foo"]: ' . $_SESSION['foo'] . '<br>' . PHP_EOL; | |
?> | |
<hr> | |
<iframe src="."></iframe> | |
<iframe src="."></iframe> | |
<iframe src="."></iframe> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (false === file_exists('./session')) mkdir('./session'); | |
session_save_path('./session'); | |
session_start(); | |
$_SESSION['foo'] = 'foo'; | |
echo 'Session started' . '<br>' . PHP_EOL; | |
echo session_id() . '<br>' . PHP_EOL; | |
echo '$_SESSION["foo"]: ' . $_SESSION['foo'] . '<br>' . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment