Jump to content

Avoid post flooding


SkyRanger

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.