Forum Moderators: phranque
A session cookie WILL persist if a user does not close the browser - that is, if they go off the site, leave their browser open, then come back tomorrow they will still be logged in. If you want to avoid this, then you have to go back to setting an expire date and time in the cookie and figure out how to set it X hours ahead of the last activity.
The details of all this are too deep for a quick answer in this thread, search these forums for 'cookies' in the programming language the login scheme is using, you will find answers and examples.
A session cookie WILL persist if a user does not close the browser - that is, if they go off the site, leave their browser open, then come back tomorrow they will still be logged in.
True, but it depends on the scripting and how the sessions are defined.
For example, the default session timeout for VB (ASP) is 20 minutes and set automatically at the server level. Of course the coder has the option of increasing this timeout.
In this case, even if a user leaves their current browser open, their session will eventually timeout and they must re-login.
}
function getexpirydate( nodays){
var UTCstring;
Today = new Date();
nomilli=Date.parse(Today);
Today.setTime(nomilli+nodays*24*60*60*1000);
UTCstring = Today.toUTCString();
return UTCstring;
}
function getcookie(cookiename) {
var cookiestring=""+document.cookie;
var index1=cookiestring.indexOf(cookiename);
if (index1==-1 ¦¦ cookiename=="") return "";
var index2=cookiestring.indexOf(';',index1);
if (index2==-1) index2=cookiestring.length;
return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}
function setcookie(name,value)
{
duration=30;cookiestring=name+"="+escape(value)+";EXPIRES="+getexpirydate(duration);
document.cookie=cookiestring;}
function delcookie(name)
{
cookiestring=name+"="+escape('')+";EXPIRES="+getexpirydate(-1);
document.cookie=cookiestring;