I am working on a login script and I want to display a message on the login.php page once the user is logged out.

I have something like the following:

PHP Code:


if (isset(
$_GET['action']) AND $_GET['action'] == 'logout') {
$logged_out TRUE;

if (
$logged_out === TRUE) echo 'You are successfully logged out.'

I use "login.php?action=logout" as the logout link.

Although the logout action is done, the message is not displayed and I guess the reason is that when I destroy the session, the variable $logged_out becomes FALSE again so that the notice is not displayed. Do you have any idea how I could display such a message? WordPress does something like this (it displays a message on login page when you log out) but I couldn't figure it out.