simonusher3
posted this
20 July 2020
Hi,
I have encountered the same problem, you have only got one of two options.
- Use a custom php script to process the contact form instead of the default one nicepage uses or,
edit the formprocessor.php and reduce the number of submissions from an IP within an set time period.
Currently the settings are 25 submissions within a 2 hour time frame, if you want to edit this to say, 3 submissions and the time frame to say 4 hours, these are the sections needed to be edited.
$db->exec("CREATE TABLE Submission_History (IP VARCHAR(39), Submission_Date TIMESTAMP)");
}
$db->exec("DELETE FROM Submission_History WHERE Submission_Date < DATETIME('now','-2 hours')");
Change to:
DATETIME('now','-4 hours')");
and
$stmt = $db->prepare("SELECT COUNT(1) FROM Submission_History WHERE IP = :ip;");
$stmt->bindParam(':ip', $ip);
$stmt->execute();
if ($stmt->fetchColumn() > 25) {
$tooManySubmissions
Change to:
if ($stmt->fetchColumn() > 3)
This won't stop the spam completely, It will however reduce the amount and stop the host account be suspended because of it. Please remember, if you update your site and export to HTML, the formprocessor.php will be over-written and you will need to edit it again before you upload to your server.
Simon..
Hi,
I have encountered the same problem, you have only got one of two options.
1. Use a custom php script to process the contact form instead of the default one nicepage uses or,
2. edit the formprocessor.php and reduce the number of submissions from an IP within an set time period.
Currently the settings are 25 submissions within a 2 hour time frame, if you want to edit this to say, 3 submissions and the time frame to say 4 hours, these are the sections needed to be edited.
$db->exec("CREATE TABLE Submission_History (IP VARCHAR(39), Submission_Date TIMESTAMP)");
}
$db->exec("DELETE FROM Submission_History WHERE Submission_Date < DATETIME('now','-2 hours')");
Change to:
**DATETIME('now','-4 hours')");**
and
$stmt = $db->prepare("SELECT COUNT(1) FROM Submission_History WHERE IP = :ip;");
$stmt->bindParam(':ip', $ip);
$stmt->execute();
if ($stmt->fetchColumn() > 25) {
$tooManySubmissions
Change to:
**if ($stmt->fetchColumn() > 3)**
This won't stop the spam completely, It will however reduce the amount and stop the host account be suspended because of it. Please remember, if you update your site and export to HTML, the formprocessor.php will be over-written and you will need to edit it again before you upload to your server.
Simon..
Last edited 20 July 2020 by simonusher3