Jump to content

Why does PHP Keep logging out?


johnsmith153

Recommended Posts

My script is very simple, with a session set to tell the system a user is logged in.

 

Every page (that needs login authorisation) checks if this sesion exists, and if not it will perform a PHP exit;

 

However, if i click a link on my nav bar, and then quickly click another, it will log me out.

 

This could happen a lot if someone changed their mind on which link to click.

 

Could it be something to do with the fact I am using session_regenerate_id(true); on every page?

 

I use this to prevent hijacking of the session. Is there an alternative, or what should I do?

 

Surely people can use session_regenerate_id(true); AND not get logged out avery so often.

Link to comment
https://forums.phpfreaks.com/topic/131432-why-does-php-keep-logging-out/
Share on other sites

I have found the problem:

 

session_regenerate_id(true);

 

set it to:

session_regenerate_id(false);

 

However, I believe using "false" will keep old sessions active - as well as the new ones.

 

(1) Is this true? How long does it keep for?

(2) What advice does anyone have?

(3) What then is the point of using session_regenerate_id(false); - surely it would be best to not use it at all, than to use "false".

 

 

Do most people use session_regenerate_id at all?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.