I thought I had the perfect PHP mailform script but for some reason these damn bots are still bypassing the validation in my html by just linking straight to the php file I think
Can i insert some code so the mailform.php check the information is only being submitted from my site?
Here is my code
PHP Code:
<?php
////////////////////////////////////////////////////////////////
// PERFECT //
// ------- //
// PHP E-mail Receive Form Electronic Content Text //
// File: feedback.php //
// Version: 1.8 (April 21, 2008) //
// Description: Processes a web form to read the user input //
// and then send the data to a predefined recipient. You //
// are free to use and modify this script as you like. //
// Instructions: Go to "http://www.centerkey.com/php". //
// License: Public Domain Software //
// //
// Center Key Software * www.centerkey.com * Dem Pilafian //
////////////////////////////////////////////////////////////////
// Configuration Settings
$SendFrom = "$fname <$femail>";
$SendTo = "info@domains.com";
$SubjectLine = "$subject";
$ThanksURL = "thanks.html"; //confirmation page
// Build Message Body from Web Form Input
$MsgBody=<<<END
{$_POST['fname']} has made an enquiry about: {$_POST['subject']}\n\n{$_POST['fmess']}\n\nTheir contact details are:
{$_POST['fname']}\n{$_POST['fadd1']}\n{$_POST['fadd2']}\n{$_POST['fcity']}\n{$_POST['fpost']}\n\n{$_POST['fnumber']}\n{$_POST['femail']}
END;
$MsgBody = htmlspecialchars($MsgBody, ENT_NOQUOTES); //make safe
// Send E-Mail and Direct Browser to Confirmation Page
if (count($_POST) > 0)
$Spam = count($_POST) == 0 || stristr($MsgBody, "cc: ") ||
stristr($MsgBody, "href=") || stristr($MsgBody, "[url") || stristr($MsgBody, "http://");
if (!$Spam)
mail($SendTo, $SubjectLine, $MsgBody, "From: $SendFrom");
header("Location: $ThanksURL");
?>