Here is one we use...displays a timer in the browsers status window and redirects user
when time runs out
script language="JavaScript"><!--
//session timer variables
var g_nSessionTimeout = 240; // time out in minutes
var g_nSessionWarn = 0; //when to warn ** g_nSessionTimeout -
g_nSessionWarn = displayed time when warning is displayed
var g_nStopMinutes = ( g_nSessionTimeout - 1 );
var g_nStopSeconds = 59;
function stop() {
clearTimeout(tick);
}
function sessionTimer()
{
if ( g_nSessionTimeout != 0 )
{
if ( g_nStopSeconds == 0 )
{
g_nStopSeconds = 59;
g_nStopMinutes = ( g_nStopMinutes - 1 );
if ( g_nStopMinutes == ( ( g_nSessionTimeout - g_nSessionWarn) - 1 ) )
window.alert('For security reasons your session will \n time
out in ' + (g_nSessionTimeout - g_nSessionWarn) + ' minutes if there is no
activity.');
}
else
g_nStopSeconds = (g_nStopSeconds - 1);
if (g_nStopSeconds <= 9)
g_nStopSeconds = "0" + g_nStopSeconds;
window.status = ('Your Session Will Time Out In ' + g_nStopMinutes + ':' +
g_nStopSeconds );
if ( ( g_nStopMinutes == 0) && ( g_nStopSeconds == 0) )
{
window.status = 'Your sesson has been disconnected';
var url = location.href
arg = ""
arg = arg + "/blahblah/login/logout.cfm"
url1 = url.substring(0,url.lastIndexOf(".asp")+1)
top.location.href = url1.substring(0,url1.lastIndexOf("/")+1)+arg
}
else
setTimeout( "sessionTimer()",1000 );
}
}
sessionTimer();
//-->
</script>
>
>= = = Original message = = =
>
>At 01:09 PM 02/11/03 -0500, Scott Wilhelm wrote:
>>Does anyone have a good solution for a session timer? I'd like
>to be
>>able to add something to my CMS that will prompt users at certain
>time
>>intervals about their session status.
>
>I was thinking one could write something in Javascript to do
>this, but I'm
>not sure how.
>
>T
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4