php - Page Does Not Recognize SESSION -
i have come along not solve long. have created script in php unsets 1 single session variable, page stats session here code page :
<?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 not logged in right now."; } require_once("../footer.php"); ?>
that whole code on page. , prints out "you not logged in right now." $_session['user']
assigned true in login.php page , have session_start();
@ beginning of page right after <?php
opening. session variable recognized @ other files php extension , single file not working on. tried
<?php session_start(); echo $_session['user']; ?>
and not print anything. skips line , nothing. doing wrong ? thank help. header.php code
<?php session_start(); require("config.php"); // contains connection database , successful. if(isset($_session['user'])==1){ echo "<div id=\"topnav\" class=\"topnav\"><a href=\"#\" class=\"signup\"><span>".$_session['username']."</span></a> <a href=\"http://www.webmasteroutlet.com/users/logout.php\" class=\"signup\"><span>logout</span></a></div>"; } else if ($_session['admin']) { echo "<div id=\"topnav\" class=\"topnav\">"."<a href=\"#\" class=\"signup\"><span>".$_session['adminusername']."</span></a> "; echo "<a href=\"http://www.webmasteroutlet.com/admin/adminlogout.php\" class=\"signup\"><span>logout</span></a></div>"; } else if ( !isset($_session['user'])) { require ($_server['document_root']."/users/login.php"); } require("search.php"); ?>
i think need if set , make sure pass sessions data page looks unsetting
Comments
Post a Comment