Note that there are some explanatory texts on larger screens.

plurals
  1. POPage Does Not Recognize SESSION
    text
    copied!<p>I have come along something i could not solve for so long. i have created a script in php that unsets one single session variable, However the page stats the session Here is my code for the page :</p> <pre><code> &lt;?php session_start(); require_once("../header.php"); if($_SESSION['user']) { unset($_SESSION['user']); echo "you succesfully logged out."; header("Refresh:5; url=http://www.webmasteroutlet.com"); } else { echo "you are already NOT LOGGED IN right now."; } require_once("../footer.php"); ?&gt; </code></pre> <p>That is the whole code on this page. and it always prints out "you are already NOT LOGGED IN right now." <code>$_SESSION['user']</code> is assigned true in login.php page and i have <code>session_start();</code> at the very beginning of the page right after the <code>&lt;?php</code> opening. The session variable is recognized at all other files with php extension and that is the only single file that it is not working on. I also tried </p> <pre><code>&lt;?php session_start(); echo $_SESSION['user']; ?&gt; </code></pre> <p>and it does not print anything. It simply skips that line and does nothing. What am i doing wrong ? Thank You very much for your help. this is the header.php code</p> <pre><code>&lt;?php session_start(); require("config.php"); // that only contains connection to the database and it is successful. if(isset($_SESSION['user'])==1){ echo "&lt;div id=\"topnav\" class=\"topnav\"&gt;&lt;a href=\"#\" class=\"signup\"&gt;&lt;span&gt;".$_SESSION['username']."&lt;/span&gt;&lt;/a&gt; &lt;a href=\"http://www.webmasteroutlet.com/users/logout.php\" class=\"signup\"&gt;&lt;span&gt;LOGOUT&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;"; } else if ($_SESSION['admin']) { echo "&lt;div id=\"topnav\" class=\"topnav\"&gt;"."&lt;a href=\"#\" class=\"signup\"&gt;&lt;span&gt;".$_SESSION['adminusername']."&lt;/span&gt;&lt;/a&gt; "; echo "&lt;a href=\"http://www.webmasteroutlet.com/admin/adminlogout.php\" class=\"signup\"&gt;&lt;span&gt;LOGOUT&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;"; } else if ( !isset($_SESSION['user'])) { require ($_SERVER['DOCUMENT_ROOT']."/users/login.php"); } require("search.php"); ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload