so my contact page looks like this
<?php
include 'header.php';
foreach($_POST as $key => $value) {
$posts[$key] = filter($value);
}
if(isset($posts['name'])) {
if($posts['name'] == ""){
$error = "Please enter your real name!";
}else if(!isEmail($posts['email'])){
$error = "Please enter a valid email address!";
}else if($_POST['message'] == ""){
$error = "Please enter your message!";
}else{
$subject ="Contact";
$message="{$_POST['message']}";
$header="From: {$posts['name']} <{$posts['email']}>";
$to = $site->site_email;
$send_contact=mail($to,$subject,$message,$header);
$success = "Message Sent!";
}
}
?>
<div class="contentbox">
<div class="head">Contact</div>
And I want to block spammers in this way……
You can only send 1 email per hour. From this contact.php page
Please help me with this and send me back this same code but edited with a time blocking code or something.
Thanks
Store the IP adrress of sender and time message is submitted. When another message is submitted, find the same IP address and compare the time. If it is less than an hour, give an error to send it later.