PHP 8.5.0 Alpha 1 available for testing

Voting

: four plus zero?
(Example: nine)

The Note You're Voting On

tim at leethost dot com
13 years ago
I was having a problem clearing all session variables, deleting the session, and creating a new session without leaving old session stuff behind in all browsers. The below code is perfect for a logout script to totally delete everything and start new. It even works in Chrome which seems to not work as other browsers when trying do logout and start a new session.

<?php
session_start
();
session_unset();
session_destroy();
session_write_close();
setcookie(session_name(),'',0,'/');
session_regenerate_id(true);
?>

<< Back to user notes page

To Top