问题
I am working on a project right now and I'm unable to access pages of my own profile if i have logged in as a user - I have set thisi rule at the top of each of my pages:
if(!isset($_SESSION['loggedin']))
header("location:http://localhost/ci/web-project-jb.php/start");// If an unregistered user tries to manually navigate to any of my webpages they will be brought to 'start' page.
The start page has
<$_SESSION['username'] = null;?>
just to make sure the session has been destroyed
I have set in my logout function that it will destroy session :
function logout()
{
$this->session->sess_destroy();
redirect ('start');
}
I have a session_start(); at my home page after I login (have it on my login page too) but since I've put the above if statement in i can no longer login as a registered user - why could this happen? I even have a session_start called at the login page. Thanks again for your help
来源:https://stackoverflow.com/questions/13714265/how-come-if-i-have-logged-into-my-website-as-a-registered-user-i-cannot-access-o