FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Date

 


DanielXP
I have the following

Code:
$time = date("YmdHis");


How can i add $floodtime on to this?

I want it so like if the seconds is 59 it wont go to 69 coz theres only 60 seconds.

Or is there any better ways to do a flood protection?
muggle
I’m not sure that I’m getting you right, but you may take a look at this page:
http://us2.php.net/manual/en/function.time.php
SlowWalkere
When you use the date() function, either you have to supply a timestamp as the second parameter or the current time is used for you. If I understand you correctly, you want to get the current time plus 10 seconds saved. In that case, you can do this...
Code:
$time = date("YmdHis", time() + 10);

As for other ways of doing flood protection, I'm not sure. Haven't read enough about it to be of any use. However, if you're going to store that info ($time) in a database to check against future request times, why not just store it as a timestamp? Then you don't need to bother with the date conversion and math in seconds is easier.

Good luck,
- Walkere
DanielXP
Thanks SlowWalkere
coreymanshack
you could also say
<?php
if($seconds > 60){
$seconds=60;
//or whatever u want to do
}
?>
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.