time delay between user actions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
charliebibston
Forum Newbie
Posts: 1
Joined: Sun Jul 04, 2010 1:33 pm

time delay between user actions

Post by charliebibston »

Hi all,

I want to create a php application in which users are not allowed to perform a certain action (such as clicking a certain button) more than once every 30 seconds.

I've thought about using sessions and storing the time when the button is clicked and comparing that to the current time each subsequent time the button is clicked to see if 30 seconds have passed. However, as I understand it a user can simply delete their cookies to get around this? Is there something I am missing? Preferably I want the system to be very difficult, if not impossible, to bypass.

Thanks
jraede
Forum Contributor
Posts: 254
Joined: Tue Feb 16, 2010 5:39 pm

Re: time delay between user actions

Post by jraede »

You could have a database table of with a column for action and a column for timestamp, and run a check against that each time they try to click a button.
User avatar
Ziq
Forum Contributor
Posts: 194
Joined: Mon Aug 25, 2008 12:43 am
Location: Russia, Voronezh

Re: time delay between user actions

Post by Ziq »

Maybe you can give access to this feature only to users who authenticate? And store information about last button click in a user profile? It is only way to protect your application from clearing cookies, i guess
Post Reply