i'm ending the session after 30 minutes of inactivity in my php page containing 3 frames using:
Code: Select all
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; CHARSET=UTF-8">
<META HTTP-EQUIV="CONTENT-SCRIPT-TYPE" CONTENT="text/javascript">
<META HTTP-EQUIV="CONTENT-STYLE-TYPE" CONTENT="text/css">
<META HTTP-EQUIV="EXPIRES" CONTENT="-1">
<META HTTP-EQUIV="Refresh" CONTENT="1800;
URL=http://localhost/MyDreamProject/sessiontimeout.php">herez my javascript code for tht.
Code: Select all
<script language="JavaScript">
var a, pageTimer; //declare var
function startClock()
{
pageTimer = 0; //start at 0
a = window.setInterval("tick()",60000); //run func tick every minute.... (60 sec x 1000 ms = 1min)
}
function tick()
{
pageTimer++; //increment timer
if (pageTimer == 15) {warnuser()}; //if 28 min without activity
}
function warnuser()
{
if (confirm("There has been no activity for some time.\nClick 'OK' if you wish to continue your session,\nor click 'Cancel' to log out.\nFor your security if you are unable to respond to this message\nwithin two minutes you will be logged out automatically."))
{
[b] refreshme.document.location.href = "http://localhost/Project/navigation.php"[/b]
}
else
{
document.location.href="http://localhost/Project/logout.php"
}
}
</script>
</head>
<body BGCOLOR="#F8F5EF" class="PSPAGE" onload="startClock();">
<iframe id="refreshme" style="DISPLAY: none; LEFT: 200px; POSITION: absolute; TOP: 40px" name="theframe" width="40" height="0">
</iframe>
can anyone tel me how to avoid this.
i think there is an error enclosed in BOLD quoted code.
Many Thanks,
Pavan.P