I work on a tool where the logout functionality is no working. I have an index page, where I include the config file with the session_start().
After, I include a page where I have my banner and my logon and logoff button. When I click on one of these button I go on another page connec.php
, I destroy or create the connection.
The connection is okay, I initialize all my session variables. For the disconnection I do:
if(isset($_POST['logout'])){
$_SESSION = array ();
session_unset();
session_destroy();
$_POST['logout']=1;
//gotopage($GLOBALS["GLOBAL_URL_PSISITE"]);
header("Location: ../index.php");
I'm still connected, and when I do print_r($_SESSION)
always exist.
First of all be sure that the page has
session_start()
defined at the very top, before you do anything on the page, secondly make sure your input field is wrapped aroundform
element and yoursubmit button
hasname=logout
and your form is set tomethod=post