By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,278 Members | 1,358 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,278 IT Pros & Developers. It's quick & easy.

set timer on page access

P: 2
hello everybody,
I'm a new member here, and I'm happy to be with you.
Please I'm a student and I need to finish my project as soon as possible, but I have a problem. Actually, my project is to do online exam system using php and Mysq and I need your help in php. I want to create a timer using php that will start counting the time when the student access the test page until it reach 10 minutes then it will submit the page and insert the data in to the database.
Please, I really need your help as soon as possible, and I will be grateful to you.
Thanks...
May 7 '07 #1
Share this Question
Share on Google+
4 Replies


P: 2
hello everybody,
I'm a new member here, and I'm happy to be with you.
Please I'm a student and I need to finish my project as soon as possible, but I have a problem. Actually, my project is to do online exam system using php and Mysq and I need your help in php. I want to create a timer using php that will start counting the time when the student access the test page until it reach 10 minutes then it will submit the page and insert the data in to the database.
Please, I really need your help as soon as possible, and I will be grateful to you.
Thanks...
May 7 '07 #2

MMcCarthy
Expert Mod 10K+
P: 14,534
You have posted in the Articles section. I am moving this question to the PHP forum.

ADMIN
May 7 '07 #3

pbmods
Expert 5K+
P: 5,821
I want to create a timer using php that will start counting the time when the student access the test page until it reach 10 minutes then it will submit the page and insert the data in to the database.
Unfortunately, you can't do this directly with PHP. You can use JavaScript's setTimeout function to do this, or you could use a META tag (search for 'http-equiv=refresh'), though this wouldn't force the form to submit.

Alternatively, you could put each question on a separate page. On the first page, the program would set a session variable (we'll call it 'timeout') equal to the current time plus ten minutes (make sure you check for an existing timeout so Users can't cheat the system!).

When the User tries to load a page, you could then compare the stored timeout value to the current time. If $_SESSION['timeout'] <= time(), then the User's SOL, and he can't continue.
May 7 '07 #4

MMcCarthy
Expert Mod 10K+
P: 14,534
To avoid confusion. These two threads have been merged.

ADMIN
May 8 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.