PHP Classes

combining spam blocker with an existing form

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  combining spam blocker with an...  
Subject:combining spam blocker with an...
Summary:I have an existing php form and need to add this spam blocker...
Author:Tristan Bernardo
Date:2009-02-15 17:13:24
Update:2009-02-21 02:35:14

  1. combining spam blocker with an...   Reply   Report abuse  
Tristan Bernardo - 2009-02-15 20:24:41
I want to incorporate this spambot blocker located at the link below ...

with an existing php form I'm using.

Here is the form I use:



// your name
$recipientname = "YOUR NAME";

// your email
$recipientemail = "YOU@YOURDOMAIN.COM";

// subject of the email sent to you
$subject = "Online-Form Response for $recipientname";

// send an autoresponse to the user?
$autoresponse = "yes";

// subject of autoresponse
$autosubject = "Thank you for your mail!";

// autoresponse message
$automessage = "This is an auto response to let you know that we've successfully received your email sent through our email form. Thanks! We'll get back to you shortly.";

// thankyou displayed after the user clicks "submit"
$thanks = "Thank you for contacting us.<br>We will get back to you as soon as possible.<br>";



<style type="text/css"><!--
td,body,input,textarea {

<table width="100%" height="100%"><tr>
<td valign="top"><font face="Verdana,Arial,Helvetica" size="2">

if($_POST['submitform']) {

$Name = $HTTP_POST_VARS['Name'];
$Email = $HTTP_POST_VARS['Email'];
$Comments = $HTTP_POST_VARS['Comments'];

// check required fields
$dcheck = explode(",",$require);
while(list($check) = each($dcheck)) {
if(!$$dcheck[$check]) {
$error .= "Missing $dcheck[$check]<br>";

// check email address
if ((!ereg(".+\@.+\..+", $Email)) || (!ereg("^[a-zA-Z0-9_@.-]+$", $Email))){
$error .= "Invalid email address<br>";}

// display errors
if($error) {

<?php echo $error; ?><br>
<a href="#" onClick="history.go(-1)">try again</a>


$browser = $HTTP_USER_AGENT;

// format message
$message = "Online-Form Response for $recipientname:

Name: $Name
Email: $Email

Comments: $Comments


Browser: $browser
User IP: $ip";

// send mail and print success message
mail($recipientemail,"$subject","$message","From: $Name <$Email>");

if($autoresponse == "yes") {
$autosubject = stripslashes($autosubject);
$automessage = stripslashes($automessage);
mail($Email,"$autosubject","$automessage","From: $recipientname <$recipientemail>");

echo "$thanks";
else {

<form name="contactform" action="<?php echo $PHP_SELF; ?>" method="post">
<input type="hidden" name="require" value="Name,Email,Comments">
<td colspan="2" align="center"><b>Contact Me!</b><p></td>
<td valign="top" align="right">Name:</td>
<td valign="top"><input name="Name" size="25"></td>
<td valign="top" align="right">E-mail:</td>
<td valign="top"><input name="Email" size="25"></td>
<td valign="top" align="right">Comments:</td>
<td valign="top"><textarea name="Comments" rows="5" cols="35"></textarea></td>
<td colspan="2" align="center"><input type="submit" value="Submit" name="submitform">
<input type="reset" value="Reset" name="reset"></td>

<?php } ?>
<td valign="bottom"><font face="Verdana" size="1">Mailform Copyright 2002 <a href="">Kali's Web Shoppe</a>.</font></td>


There is 1 reply in this thread, which is not being displayed.
Browsing this forum thread replies is available only to premium subscribers.

Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.