View Full Version : How to Expire session?

01-08-2008, 07:53 AM

how to get the time in session and how to expire it in a particular time using php for online exam site.please anybody reply me soon.

01-08-2008, 12:00 PM
Quickest (and dirtiest) solution would be pure XHTML in the HEAD section of your document:

<!-- redirect to whatever.html after 600 seconds -->
<meta http-equiv="refresh" content="600;URL=http://www.yourdomain.com/whatever.html"></meta>

Where whatever.html would display a "you've run out of time" message.

01-08-2008, 02:00 PM

Thanks for your reply.

I tried your code. It works. But it doesn't work at the time of processing(i.e.)At the time of writing the examination. Do u have any idea regarding this.

01-08-2008, 02:36 PM
Could you explain what you mean? Perhaps post some code?

01-08-2008, 03:14 PM
i am doing online exam site.if the user can login and write the exam.i planed to expire the test page in 10mins. if the time exceeds,user gets the time expired notice.this is my requirement.have you understand what i have to said?

01-08-2008, 04:35 PM
The code that mlse posted would do what you need. Although it can be disabled. Any solution for this can be however, so you might want to consider some sort of server side checks too (store page generated time, and check it when they hit submit).

The correct element syntax would be (since it is empty):

<meta http-equiv="refresh" content="600;URL=http://www.yourdomain.com/whatever.html" />

01-10-2008, 08:35 AM
am working on one project. The project is of Online examination.
Here i want to calculate the total time spent by user to perform the test and to display it on screen at the end of test.
How do i calculate this time using PHP.
So, plz can anybody help me to solve this issue.
Thanx in advance!!!!