Page 1 of 1

Session after closing Browser

Posted: Mon Jun 01, 2020 4:22 pm
by sva260
Hi ,
Can i Disable Users log out auto after closing Browser ?

Thank you

Re: Session after closing Browser

Posted: Mon Jun 01, 2020 7:58 pm
by paulfeakins
Depends how well you can code?

You'll need to add a cookie and then check for it and log someone in automatically if they have it.

More info here:
https://stackoverflow.com/questions/332 ... has-closed

Re: Session after closing Browser

Posted: Wed Jun 03, 2020 1:28 pm
by sva260
paulfeakins wrote:
Mon Jun 01, 2020 7:58 pm
Depends how well you can code?

You'll need to add a cookie and then check for it and log someone in automatically if they have it.

More info here:
https://stackoverflow.com/questions/332 ... has-closed
Thank you paulfeakins for replay ,
You know that most users of OpenCart do not know how to write a single line of code, and the reason they choose OpenCart is the ease of installation lol like me ,
If there an extension or simple way to do that it would be awesome for many of us

Re: Session after closing Browser

Posted: Wed Jun 03, 2020 2:52 pm
by letxobnav
users or customers?

Re: Session after closing Browser

Posted: Mon Jun 08, 2020 7:38 pm
by sva260
letxobnav wrote:
Wed Jun 03, 2020 2:52 pm
users or customers?
customers

Re: Session after closing Browser

Posted: Mon Jun 08, 2020 10:29 pm
by letxobnav
well, the only difference is that the cookie which holds the session id is a session cookie so:

1) you would have to add a "remember me" checkbox to the login page (with a warning about public computer usage) as people would need to opt-in.
2) you would have to start storing the session data in the database (the only valid reason for doing that) and set the expire date accordingly.
2.1) if you use files, php would normally automatically delete inactive sessions from the file system and you would lose the session data anyway.
3) you would have to keep the "remember me" value in the session and use it in the session class.
3.1) if active, set an expire date to the session cookie (now it is a session cookie without expiration date which means the cookie is deleted when the browser is closed)
3.2) if inactive, set no expire date to the session cookie as is now
4) when sign off, delete the session from the session table.

The main effort is the checkbox really.