SkyRanger Posted May 24, 2007 Share Posted May 24, 2007 I am trying to figure out a way to stop visitors from flooding my guestbook and comments scripts. Is there a way to do this other than using captcha. ie: Only 1 post every 10 seconds? Quote Link to comment https://forums.phpfreaks.com/topic/52861-avoid-post-flooding/ Share on other sites More sharing options...
chigley Posted May 24, 2007 Share Posted May 24, 2007 Why not set a session variable with a timestamp when the user adds a comment. Then, when adding a comment use: <?php $lastpost = $_SESSION["lastpost"]; // Let's say it = 1180033452 $current = time(); // Let's say it = 1180033457 if(($current - $lastpost) < 10) { echo "Please wait ten seconds before adding another comment"; } else { // Process comment } ?> Quote Link to comment https://forums.phpfreaks.com/topic/52861-avoid-post-flooding/#findComment-260989 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.