开发者

Session checks for loggedin user on pages / links?

When a user visits a pag开发者_开发知识库e, does the system check if the user is loggedin on every page, with every link click or is this a one time thing? The issue I am having is: The user logsin which works fine. But if i enter the URL to my signup page the system directs me to the signup page and changes my header back to as if i am a non user. And this is happening randomly on many pages. Some places without signing in it is showing me the registered user's header. So i assume the session is not working but I am not sure how the system knows or checks this or if it is auto or do we need to write code for each page, each link on each page? Platform is codelignitor php.

Thanks.


I would think this depends on what language you are using for your pages. Some more details would be helpful here. The system may be using a cookie to check if you are still valid and this cookie is expiring.


I guess you are missing the session check codes. Please check the session set in every controller class so that if logged in session is not enable just redirect to general user page else to logged in user page.


Probably there are some controllers that are protected and some public. If you are using an Auth library probably there is a method like $this->auth->logged_in() or similar. Check it in the contrsuctor of each protected controller, or, better yet, make a protected_controller class that extends CI' base controller, that does the job. Then make protected controllers to use this as base.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜