Jump to content


Photo

flood controll help cheers.


  • Please log in to reply
5 replies to this topic

#1 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 19 June 2006 - 03:29 AM

Can you help please.

I am trying to inplerment a flood time feature,
if the time is more then 1 min do somethink else wait.

Somethink is wrong with $new_time wrote wrongly cheers.
<?


$time=("h:i:s");


$new_time=list( date("h") , date("i")+1 , date("s") );


if( $new_time > $time ) {

do somethink

} else {

echo "sorry you got to wait 1 min"

}


?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 19 June 2006 - 03:34 AM

Think about what your doing here and try again.

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 19 June 2006 - 03:49 AM

[!--quoteo(post=385507:date=Jun 19 2006, 03:34 AM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ Jun 19 2006, 03:34 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Think about what your doing here and try again.
[/quote]

Is that correct dont know lol cheers.
<?


$time=date("h:i:s");


$new_time=date("i")+1;


if( $new_time > $time ) {

do somethink

} else {

echo "sorry you got to wait 1 min"

}


?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 19 June 2006 - 04:05 AM


This example works in minites but not in full time.
<?

$time=date("i");


$new_time=date("i")+1;


if($new_time > $time) {

echo"do somethink";

} else {

echo "sorry you got to wait 1 min";

}

?>

how can i add +1 to i in this format cheers
<?

$time=date("h:i:s");

//here ("h:i:+1s") wont let me add the 1 to i how lol,
$new_time=date("i")+1;


if($new_time > $time) {

echo"do somethink";

} else {

echo "sorry you got to wait 1 min";

}

?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 19 June 2006 - 05:24 AM

[!--sizeo:5--][span style=\"font-size:18pt;line-height:100%\"][!--/sizeo--]solved[!--sizec--][/span][!--/sizec--]

<?

$time=date("h:i:s");

$a=date("i")+1;

$new_time=date("h:$a:s");

if($new_time > $time) {

echo"do somethink";

} else {

echo "sorry you got to wait 1 min";
exit;

}

?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#6 radalin

radalin
  • Members
  • PipPipPip
  • Advanced Member
  • 179 posts

Posted 19 June 2006 - 08:36 AM

I'm curious if this code can really get to the else section!!!???

Let me guess. You assign a time variable with date function. And then you assign an another time variable with one minute later. And you check if the new time (which is 1 minute higher then the old one) is bigger then the old time! Can this code get to the else section?

And also you will get a 60th min if the post is at the 59th min! Just read carefully the date function because what you define in ' " ' is the format of the date! Use date("m-d-Y",mktime(blabla)) to define a newer date.

Still this function can't control the time problem. It should get from somewhere the last operation time to be able to check the time interval between the old calling of the file and the new one!

Long story short I think that your code should be something like:
if ( date("h:a:s") - $_GET['oldtime'] < 1 )
{
echo "please wait a minute";
exit();
}
else{
echo "dosomething";
}


Just think the logic of your code a little bit too.
Roy Simkes
Yet Another Parkyeri Developer




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users