/    Sign up×
Community /Pin to ProfileBookmark

auto run a script after session out

Hi all,
I am going to develop a site for online exams in which I want to set a fix time for exams. So I need when a user start a exam then the exam will close automatically after time out and a script to display the result of user.

In the duration of exam user will navigate to many pages of site because one question will display in one time.

Pls. tell me how it is possible.

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@MindzaiJul 30.2010 — You can set the start time in the $_SESSION superglobal and check this on every request. If the current time minus the start time is greater than your allocated time, you can ignore any answer sent with that request and send the user to your desired location via a header() redirect. You could also use a javascript to provide a countdown timer but this should be secondary to the steps above as it is client side and so could be manipulated by the user.
Copy linkTweet thisAlerts:
@Hemant_AgrawalauthorJul 30.2010 — How we can minus the time?

How we can get the request time interval?

assume that we make the session time to 1 minute on the page load, then if a user can not refresh the page for 5 minute then I want to auto run a script after completion of 1 minute.
Copy linkTweet thisAlerts:
@MindzaiJul 30.2010 — PHP only executes on the server side so you will need to use a javascript timer to end the quiz sooner - however as I said above this should be secondary to the server-side validation as a javascript timer is easily manipulated.
×

Success!

Help @Hemant_Agrawal spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...