View Single Post
  #17 (permalink)  
Old 06-25-09, 04:33 AM
bally123 bally123 is offline
Newbie Coder
 
Join Date: Jul 2006
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Hey guys the honeypots seem to be working but the only problem I have now, it seems that my mailform.php is still sending blank emails... I think I need to add some sort of validation to the processing part to say either if form is blank disregard email or only process if form is submit from enquriy.html... How would I go about doing this?

Here is my PHP Code with honeypots:
PHP Code:

<?php

if(!empty($_POST['real_name'])) echo 'A bot sent this message';
else {
////////////////////////////////////////////////////////////////
// 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 =      "enquiry@domain.tld";
$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($MsgBodyENT_NOQUOTES);  //make safe 

// Send E-Mail and Direct Browser to Confirmation Page
      
if (count($_POST) > 0)
      
$Spam count($_POST) == || stristr($MsgBody"cc: ") ||
          
stristr($MsgBody"href=") || stristr($MsgBody"[url") || stristr($MsgBody"http://");
      if (!
$Spam)
          
mail($SendTo$SubjectLine$MsgBody"From: $SendFrom"); 
header("Location: $ThanksURL");
}
?>
Reply With Quote