English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i am making a online quiz and it is required that it should end in 1 hour.....if anyone can please the post a code or any help...i will be thankful

2007-03-09 19:38:25 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

rather than expiring...it should redirect to another page...

2007-03-09 19:39:56 · update #1

3 answers

Errr I am really frustrated in the answers that your getting :) Sorry for the madness:)

Since your creating an ONLINE quiz you could handle the expiration of what you are doing in a SESSION Variable. You could either EXPIRE the session for a given time or MAKE a cookie which holds relevant session data.

Personally I would use a SESSION Variable!

Within a Session, you can assign a "start_time" which has an timestamp of when it has started, and then assign a Temporarily session timeout.
http://php.net/session_set_cookie_params

You can customize this method that has some asynchronous calls from website to server using (AJAX) that queries data to inorder to check if session has been expired. For instance, you can send your time to server and get a response stating how much time left!

The reason why I would do that is to inform the user that he has "that much time left" if you wish to make it a blind warning, you could set a session_set_cookie_params that will time out any existing session variable and when he submits late it will tell him he is done!

But to make it LIVE time, you would need Javascript, and if you wish to interact with that LIVE time, you would need some sort of HTTPResponse and Request Asynchronously from AJAX.

Hope that helped!

Good Luck, let me know if your still stuck. I could probably lead you to more directions.

2007-03-13 17:53:56 · answer #1 · answered by ? 6 · 0 0

The function to expire a page in php is as follows
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
?>

But i don't think it will redirect the page. But give it a try.

2007-03-13 08:46:24 · answer #2 · answered by Atif Majid 3 · 0 1

I think it might be easier to use a java script in your header, This assumes you will keep the user on the page for the entire hour or use it as an include on every page and call it as a function.

http://www.dhani.mbojo.com/2007/02/06/setting-up-a-javascript-timer/

2007-03-10 16:47:18 · answer #3 · answered by Tracy L 7 · 0 1

fedest.com, questions and answers