pavanpuligandla Posted October 30, 2008 Share Posted October 30, 2008 hii.. i'm ending the session after 30 minutes of inactivity in my php page containing 3 frames using: <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"> so i'm displaying a warning message using javascript to alert the user that his/her session is about to expire in 2 minutes, to continue click ok and to end the session click cancel. herez my javascript code for tht. <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> but when i click ok, the session is not carrying over and getting ended after 2 minutes. can anyone tel me how to avoid this. i think there is an error enclosed in BOLD quoted code. Many Thanks, Pavan.P Quote Link to comment Share on other sites More sharing options...
predator12341 Posted October 30, 2008 Share Posted October 30, 2008 i am not to update with this however i would say it is because of <META HTTP-EQUIV="Refresh" CONTENT="1800; URL=http://localhost/MyDreamProject/sessiontimeout.php"> you have set it to 30 minutes so even if you click continue it will expire after 30 minutes because it is not being reset correctly Regards Mark Quote Link to comment Share on other sites More sharing options...
pavanpuligandla Posted October 30, 2008 Author Share Posted October 30, 2008 can you tel me how to proceed? i think, i need to use session_start(); in that navigation.php page. Quote Link to comment Share on other sites More sharing options...
predator12341 Posted October 31, 2008 Share Posted October 31, 2008 hey pavanpulidandla can we see the code you have in sessiontimeout.php Quote Link to comment Share on other sites More sharing options...
BoltZ Posted October 31, 2008 Share Posted October 31, 2008 refreshme.document.location.href = "http://localhost/Project/navigation.php" Try using getElementById or something like this. Is the content in the i-frame reloaded? And do you call session_start() in navigation.php? If yes thencheck if your browser sends the right Session ID Try pinging the server to continue the session if the user clicks the ok button Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.