Re: [WebDNA] Session timeout solution

This WebDNA talk-list message is from

2010


It keeps the original formatting.
numero = 104631
interpreted = N
texte = --00032555b4ce263cb8047e4d32b2 Content-Type: text/plain; charset=UTF-8 Chris, Yea - I assume anything we give out on this list is good to share on the main site. Here's the script and stuff. Come back to me if I have left anything out. For the server side check I use a customised multi-group-checker template. Every time the user refreshes a page their session time (stored in seconds since) is updated. If they refresh a page and the timeout has passed the multi-group-checker kicks them out. - Tom -- On the CMS admin page [!] ------------------------------------ ### Set countdown variables and serve the script - prefTIMEOUt set in seconds ### [/!][math show=f]days=floor([prefTIMEOUT]/86400)[/math][!] [/!][math show=f]hours=floor(([prefTIMEOUT]-([days]*86400))/3600)[/math][!] [/!][math show=f]mins=floor(([prefTIMEOUT]-([hours]*3600))/60)[/math][!] [/!][math show=f]secs=[prefTIMEOUT]-(([hours]*3600)+([mins]*60))[/math][!] [/!]
this displays the countdown
this displays the alert -- On CMS page end -- The countdown JS // CountDown Script Inspired by Sandeep Gangadharan http://sivamdesign.com/scripts/ // Modified by Digital Revolutionaries function checkPlural(noun, value) { noun = ((value == 1) || (value == 0)) ? noun : (noun += "s"); return noun; } function countDown() { sec--; if (sec == -1) { sec = 59; min = min - 1; } else { min = min; } if (min == -1) { min = 59; hou = hou - 1; } else { hou = hou; } hour = checkPlural("hour", hou); minute = checkPlural("min", min); second = checkPlural("sec", sec); if (hou == 0) { hoursLeft = ""; } else { hoursLeft = (hou) + " " + hour + " "; } if (min == 0) { minsLeft = ""; } else { minsLeft = (min) + " " + minute + " "; } time = (hoursLeft) + (minsLeft) + sec + " " + second + " until auto-logout"; if (document.getElementById) { document.getElementById('div_countdown').innerHTML = time; } SD=window.setTimeout("countDown();", 1000); if (hou < '01' && min < '05') { document.getElementById('div_alert').style.display = 'block'; document.getElementById('div_alert').innerHTML = 'You only have ' + time + '
You need to complete your current task and refresh the page now'; if (sec == '59') { document.getElementById('div_alert').focus(); } } if (hou == '00' && min == '00' && sec == '00') { sec = "00"; window.clearTimeout(SD); document.getElementById('div_countdown').innerHTML = 'SiteMinder has logged you out !'; window.alert('SiteMinder has logged you out !'); window.location = "/admin/logout.tmpl"; } } -- Countdown js ends --00032555b4ce263cb8047e4d32b2 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Chris,

Yea - I assume anything we give out on this list = is good to share on the main site. =C2=A0 Here's the script and stuff. = =C2=A0 Come back to me if I have left anything out.

For the server side check I use a customised multi-group-checker template= . =C2=A0Every time the user refreshes a page their session time (stored in = seconds since) is updated. =C2=A0If they refresh a page and the timeout has= passed the multi-group-checker kicks them out.

- Tom




-- On the CMS admin page

[!]


------------------------------------
### = =C2=A0Set countdown variables and serve the script =C2=A0- prefTIMEOUt set = in seconds ###

[/!][math show=3Df]days=3Dfloor([pr= efTIMEOUT]/86400)[/math][!]
[/!][math show=3Df]hours=3Dfloor(([prefTIMEOUT]-([days]*86400))/3600)[= /math][!]
[/!][math show=3Df]mins=3Dfloor(([prefTIMEOUT]-([hours]= *3600))/60)[/math][!]
[/!][math show=3Df]secs=3D[prefTIMEOUT]-(([= hours]*3600)+([mins]*60))[/math][!]
[/!]<script type=3D"text/javascript">
// variables for= the countDown script
var sec =3D [secs]; =C2=A0 // set the seconds
var m= in =3D [mins]; =C2=A0 // set the minutes
var hou =3D [hours]; =C2=A0 // set= the hours
</script>


<div = id=3D"div_countdown"></div> =C2=A0 this displays the cou= ntdown

<div id=3D"div_alert"></= div> =C2=A0this displays the alert

-- =C2=A0On CMS page end


-- The countdown JS

// CountDown Script= Inspired by Sandeep Gangadharan http://sivamdesign.com/scripts/
// Mo= dified by Digital Revolutionaries

function checkPlural(noun, value) {
 =C2= =A0noun =3D ((value =3D=3D 1) || (value =3D=3D 0)) ? noun : (noun +=3D &quo= t;s");
 =C2=A0return noun;
}

fu= nction countDown() {
sec-= -;
if (sec =3D=3D -1) {
sec =3D 59;
min= =3D min - 1;
}
else {
min= =3D min;
}
if (min =3D=3D -1) {
min= =3D 59;
hou =3D hou - 1;
}
else= {
hou =3D hou;
}

hou= r =3D checkPlural("hour", hou);
minute =3D checkPlural("min= ", min);
seco= nd =3D checkPlural("sec", sec);

if (hou =3D=3D 0) {
hou= rsLeft =3D "";
}
else {
hou= rsLeft =3D (hou) + " " + hour + " ";
}

if (= min =3D=3D 0) {
minsLeft =3D "";
}
else= {
minsLeft =3D (min) + " " + minute + " ";
}

tim= e =3D (hoursLeft) + (minsLeft) + sec + " " + second + " unti= l auto-logout";


if= (document.getElementById) {
doc= ument.getElementById('div_countdown').innerHTML =3D time;
}
<= div>
SD= =3Dwindow.setTimeout("countDown();", 1000);
if (hou < '01= ' && min < '05') {
doc= ument.getElementById('div_alert').style.display =3D 'block'= ;
document.getElementById('div_alert').innerHTML =3D 'You onl= y have ' + time + '<br />You need to complete your current ta= sk and refresh the page now';
if = (sec =3D=3D '59') {
document.getElementById('div_alert'= ).focus();
}
= }
if (hou =3D=3D '00' && min =3D=3D '00' &&= ; sec =3D=3D '00') {
sec= =3D "00";
window.clearTimeout(SD);
document.getElementById(&= #39;div_countdown').innerHTML =3D 'SiteMinder has logged you out !&= #39;;
win= dow.alert('SiteMinder has logged you out !');
window.location =3D= "/admin/logout.tmpl";
}
}<= /div>

-- =C2=A0Countdown js ends




--00032555b4ce263cb8047e4d32b2-- Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] Session timeout solution (Donovan Brooke 2010)
  2. Re: [WebDNA] Session timeout solution (Tom Duke 2010)
  3. Re: [WebDNA] Session timeout solution (christophe.billiottet@webdna.us 2010)
  4. Re: [WebDNA] Session timeout solution (Tom Duke 2010)
  5. [WebDNA] Session timeout solution (christophe.billiottet@webdna.us 2010)
--00032555b4ce263cb8047e4d32b2 Content-Type: text/plain; charset=UTF-8 Chris, Yea - I assume anything we give out on this list is good to share on the main site. Here's the script and stuff. Come back to me if I have left anything out. For the server side check I use a customised multi-group-checker template. Every time the user refreshes a page their session time (stored in seconds since) is updated. If they refresh a page and the timeout has passed the multi-group-checker kicks them out. - Tom -- On the CMS admin page [!] ------------------------------------ ### Set countdown variables and serve the script - prefTIMEOUt set in seconds ### [/!][math show=f]days=floor([prefTIMEOUT]/86400)[/math][!] [/!][math show=f]hours=floor(([prefTIMEOUT]-([days]*86400))/3600)[/math][!] [/!][math show=f]mins=floor(([prefTIMEOUT]-([hours]*3600))/60)[/math][!] [/!][math show=f]secs=[prefTIMEOUT]-(([hours]*3600)+([mins]*60))[/math][!] [/!]
this displays the countdown
this displays the alert -- On CMS page end -- The countdown JS // CountDown Script Inspired by Sandeep Gangadharan http://sivamdesign.com/scripts/ // Modified by Digital Revolutionaries function checkPlural(noun, value) { noun = ((value == 1) || (value == 0)) ? noun : (noun += "s"); return noun; } function countDown() { sec--; if (sec == -1) { sec = 59; min = min - 1; } else { min = min; } if (min == -1) { min = 59; hou = hou - 1; } else { hou = hou; } hour = checkPlural("hour", hou); minute = checkPlural("min", min); second = checkPlural("sec", sec); if (hou == 0) { hoursLeft = ""; } else { hoursLeft = (hou) + " " + hour + " "; } if (min == 0) { minsLeft = ""; } else { minsLeft = (min) + " " + minute + " "; } time = (hoursLeft) + (minsLeft) + sec + " " + second + " until auto-logout"; if (document.getElementById) { document.getElementById('div_countdown').innerHTML = time; } SD=window.setTimeout("countDown();", 1000); if (hou < '01' && min < '05') { document.getElementById('div_alert').style.display = 'block'; document.getElementById('div_alert').innerHTML = 'You only have ' + time + '
You need to complete your current task and refresh the page now'; if (sec == '59') { document.getElementById('div_alert').focus(); } } if (hou == '00' && min == '00' && sec == '00') { sec = "00"; window.clearTimeout(SD); document.getElementById('div_countdown').innerHTML = 'SiteMinder has logged you out !'; window.alert('SiteMinder has logged you out !'); window.location = "/admin/logout.tmpl"; } } -- Countdown js ends --00032555b4ce263cb8047e4d32b2 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Chris,

Yea - I assume anything we give out on this list = is good to share on the main site. =C2=A0 Here's the script and stuff. = =C2=A0 Come back to me if I have left anything out.

For the server side check I use a customised multi-group-checker template= . =C2=A0Every time the user refreshes a page their session time (stored in = seconds since) is updated. =C2=A0If they refresh a page and the timeout has= passed the multi-group-checker kicks them out.

- Tom




-- On the CMS admin page



------------------------------------
### = =C2=A0Set countdown variables and serve the script =C2=A0- prefTIMEOUt set = in seconds ###

[/!][math show=3Df]days=3Dfloor([pr= efTIMEOUT]/86400)[/math][!]
[/!][math show=3Df]hours=3Dfloor(([prefTIMEOUT]-([days]*86400))/3600)[= /math][!]
[/!][math show=3Df]mins=3Dfloor(([prefTIMEOUT]-([hours]= *3600))/60)[/math][!]
[/!][math show=3Df]secs=3D[prefTIMEOUT]-(([= hours]*3600)+([mins]*60))[/math][!]
[/!]<script type=3D"text/javascript">
// variables for= the countDown script
var sec =3D [secs]; =C2=A0 // set the seconds
var m= in =3D [mins]; =C2=A0 // set the minutes
var hou =3D [hours]; =C2=A0 // set= the hours
</script>


<div = id=3D"div_countdown"></div> =C2=A0 this displays the cou= ntdown

<div id=3D"div_alert"></= div> =C2=A0this displays the alert

-- =C2=A0On CMS page end


-- The countdown JS

// CountDown Script= Inspired by Sandeep Gangadharan http://sivamdesign.com/scripts/
// Mo= dified by Digital Revolutionaries

function checkPlural(noun, value) {
 =C2= =A0noun =3D ((value =3D=3D 1) || (value =3D=3D 0)) ? noun : (noun +=3D &quo= t;s");
 =C2=A0return noun;
}

fu= nction countDown() {
sec-= -;
if (sec =3D=3D -1) {
sec =3D 59;
min= =3D min - 1;
}
else {
min= =3D min;
}
if (min =3D=3D -1) {
min= =3D 59;
hou =3D hou - 1;
}
else= {
hou =3D hou;
}

hou= r =3D checkPlural("hour", hou);
minute =3D checkPlural("min= ", min);
seco= nd =3D checkPlural("sec", sec);

if (hou =3D=3D 0) {
hou= rsLeft =3D "";
}
else {
hou= rsLeft =3D (hou) + " " + hour + " ";
}

if (= min =3D=3D 0) {
minsLeft =3D "";
}
else= {
minsLeft =3D (min) + " " + minute + " ";
}

tim= e =3D (hoursLeft) + (minsLeft) + sec + " " + second + " unti= l auto-logout";


if= (document.getElementById) {
doc= ument.getElementById('div_countdown').innerHTML =3D time;
}
<= div>
SD= =3Dwindow.setTimeout("countDown();", 1000);
if (hou < '01= ' && min < '05') {
doc= ument.getElementById('div_alert').style.display =3D 'block'= ;
document.getElementById('div_alert').innerHTML =3D 'You onl= y have ' + time + '<br />You need to complete your current ta= sk and refresh the page now';
if = (sec =3D=3D '59') {
document.getElementById('div_alert'= ).focus();
}
= }
if (hou =3D=3D '00' && min =3D=3D '00' &&= ; sec =3D=3D '00') {
sec= =3D "00";
window.clearTimeout(SD);
document.getElementById(&= #39;div_countdown').innerHTML =3D 'SiteMinder has logged you out !&= #39;;
win= dow.alert('SiteMinder has logged you out !');
window.location =3D= "/admin/logout.tmpl";
}
}<= /div>

-- =C2=A0Countdown js ends




--00032555b4ce263cb8047e4d32b2-- Tom Duke

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

OT: 4.5 Unix License Value? (2004) tricky embedded[showifs/hideifs] (w/ code.. long) (2000) WCS Newbie question (1997) NT Version on IIS 4.0 (1997) creator code (1997) Security Issues and WebCommerce Solution (1997) multi-paragraph fields (1997) Date search - yes or no (1997) acrobat -> wc (1998) Re:2nd WebCatalog2 Feature Request (1996) Text data with spaces in them... (1997) Is there a max number of fields? (1998) Running a store on BOTH http and https (1998) shipcost (1997) Practice runs ? (1997) European dates (1998) ACGI processing for .html (1997) [WebDNA] WebDNA and MAMP/Apache (Mac) (2018) Document Contains No Data! (1997) Only charge card when product shipped ? (1997)