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? 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 } ?> Link to comment https://forums.phpfreaks.com/topic/52861-avoid-post-flooding/#findComment-260989 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.