I get a lot of spam emails through PHP contact forms that I post on sites.
It seems like all my accounts with 1and1 particuallarly get a lot of spam through contact forms.
Does anyone know any way to stop it. Is there something in like a php.ini file I can set or some type of validation that can be added to the form?
It's driving me nuts. And it happens a lot on clients sites as well, but all ones that are hosted by 1and1.
1and1 tells me there's no real solution. I think that's bullshit.
This is virtually the php that I use to do so:
<?php
if(($POST[name]) || ($POST[email]) || ($POST[inquiryText])){
$name = $POST[name];
$email = $POST[email];
$subject = "Website Contact Form";
$comments= $POST[inquiryText];
$message ="$name has contacted you.\r\nEmail: $email\r\n\n$comments";
$name=trim($name);
$email=trim($email);
$toaddress='blah@blah.net';
mail($toaddress,$subject,$message,"From: $email");
echo "<span class='descriptionDetails'>$name, your contact has been sent.</span>";
}else{
echo '<span class="descriptionDetails">Please complete and submit the form below.</span>';
}
?>
<form name="contact" id="contact" method="post" action="contact.php" onSubmit="return confirmSubmit();" onReset="return confirmReset();">
<p> Name:<br />
<input name="name" type="text" id="name" size="25" maxlength="75" />
<br />
<br />
E-mail:<br />
<input name="email" type="text" id="email" size="25" maxlength="75" />
</p>
<p>Enter Your Comments / Questions:<br />
<textarea name="inquiryText" cols="30" rows="8" id="inquiryTextNEW13579"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="Send Contact" /> <input type="reset" name="reset" value="Reset Contact" />
</p>
</form>
I was thinking there may be a way to see if the post data is coming from my domain?