PHP One hour limit

September 26, 2010 at 12:14:41
Specs: Windows XP
Hello people :)

I need to make PHP Script, who will allow to do an action only once per one hour per User. Username will be $Username and Action to allow per hour will be like - echo "123";

Cant figure out how to do this.


See More: PHP One hour limit

Report •


#1
September 26, 2010 at 13:32:50
Here's an example. Note that, a savvy user can just delete their cookes & they'd be reset.

session_start();
if ( time() - $_SESSION['holdtime'] < 3600 ) {
echo "You must wait one hour";
} else {
$_SESSION['holdtime'] = time();
echo "Time ok, do action...";
}

Report •

#2
September 26, 2010 at 13:52:17
Thank you a lot :) You realy helped me :)

Report •

Related Solutions


Ask Question