Skip to content
Snippets Groups Projects
Commit 31b082ed authored by Brett T Bieber's avatar Brett T Bieber
Browse files

Merge pull request #14 from s-mfairch4/master

Limit comments to 1 post per ip per min.
parents 3cd54325 03de4fae
No related branches found
No related tags found
No related merge requests found
...@@ -76,6 +76,29 @@ $rules['ip'][] = function($spam) { ...@@ -76,6 +76,29 @@ $rules['ip'][] = function($spam) {
} }
}; };
/**
* Check if we are being flooded by the ip address
* (Only one post per min)
*
* @param $spam
* @return bool
*/
$rules['ip'][] = function($spam) {
$db = UNL_WDN_Comment_Record::getDB();
$sql = "SELECT count(*) as total FROM comment where ip = '" . $db->real_escape_string($spam) . "' AND submitdatetime > DATE_SUB(NOW(), INTERVAL 1 MINUTE)";
if ($result = $db->query($sql)) {
$row = $result->fetch_assoc();
if (isset($row['total']) && $row['total'] >= 1) {
return true;
}
}
return false;
};
$rules['ip'][] = function($spam) { $rules['ip'][] = function($spam) {
//http:BL key //http:BL key
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment