View Full Version : automatically logout after given time and submit selected to database simutaneously

10-26-2012, 01:41 AM
i need help..i am beginner in php and trying to build a online exam system site.
i have used cookie for login, now i wish that my content page(after login) having a start button and after clicking on that my "test.php" gets loaded and countdown stat..and after a given time page gets automatically logged out and answers stored in database simultaneously.
anyone please help me..

Thanks in advance..

10-26-2012, 06:01 AM
I suggest you look into the Ajax Push Engine. http://www.ape-project.org/ Because you have to control things, but not in the browser so HTML or javascript is out of the picture. Doing the timing and closing the page needs to be done server side. You are also going to need good ajax understanding to do this.

Maybe someone knows a simpler way to do this or you don't think the test takers know how to look at the html of their page or knows someone that does.

10-26-2012, 06:26 AM
thanks sunfighter..ok is that possible to store the time using time() in a variable when user click on "start test" and then just using "if condition" when difference of current time and that variable equal to my duration then go to logged out??

10-26-2012, 04:32 PM
Yes, your method will work, but you will need a trigger to run the second part, getting the new time.
I know little about APE, never used it, but the server side language is javascript. Js has two functions setInterval() - will execute another function, over and over again, at specified time intervals AND setTimeout() - executes a function, once.
The variables sent to the about functions are the time of the interval in millisecs and the name of the function to execute.
In other words, once started, say by the start button, no further input [trigger] is needed.