hi
is there any way that i can use to create a countdown timer using php
im designing an online exam and i want to create a secure timer that counts for an hour
i dont want to use javascript in case that it's disabled by the browser
thanks
php timer
Moderator: General Moderators
Re: php timer
meta (refresh) tag maybe. 
Re: php timer
Create a session variable, and set it to the time that the exam starts. create an iFrame which uses metadata to refresh itself, say, every second, and a php script in this iFrame which reads this session variable and displays time remaining. When time runs out, set a session variable so that when they submit the form after time, the system knows not to count it. As long as they submit before the time limit, it would then grade it and give credit. You could try setting a meta refresh/redirect as stated above to automatically move the user off the page slightly after time is up, but I would still show a clock which gives more accurate indication of time remaining.
-OmniUni
-OmniUni
Re: php timer
Use meta refresh:
and of course in your http://exams.com/finished.php check it again (in case the user has tempered the meta tag).
Code: Select all
<?php
$refresh_time = $test_time - time() + $_SESSION['start_time'] > 0 ? $test_time - time() + $_SESSION['start_time'] : 0;
?>
<meta http-equiv="refresh" content="<?php echo $refresh_time; ?>;url=http://exams.com/finished.php">There are 10 types of people in this world, those who understand binary and those who don't
Re: php timer
thanks alot
i will try to implement what you have post and i will tell you what happends
thanks again
i will try to implement what you have post and i will tell you what happends
thanks again