How come if I have logged into my website as a registered user I cannot access other pages after setting session rules?

只谈情不闲聊 提交于 2020-01-06 07:46:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!