views:

26

answers:

2

I'm trying to set up a feature where after accessing a wepage, the user is not allowed to return until they have been away for x minuets. It's on a login system, so I don't need to worry about IPs etc. What I had in mind was as following:

  1. User accesses page; current time (of access) is logged (in database?).
  2. User tries to return to page; get time since last access (from database?).
  3. If user has been away for x minuets, allow page access.
  4. If user has been away for less than x minuets, block page access.

All this would be done (I guess) with a MYSQL database. Anyone now how to achieve this? I just spent the last 3 hours trying and failing...I guess I don't know enough.

Thanks in advance!

A: 

Instead of a database, you could easily do this with using sessions.

Here are some tutorials to follow:

Anthony Forloney
A: 

You don't need to use a database. You could much more easily store this information in the session. Since they need to be logged in, you probably don't have to worry about them deleting their cookies, and creating a new session, because that would require them to log in again.

Kibbee