help protecting form to email from spammers



Hello,

I am kind of a newb to php and could use some help. I have made a form to
email php page that uses the mail function to send me the results of a
form. The php portion looks like this:

<?PHP
if ($submit) {
$Address = !empty($Address) ? $Address : 'NA';
$Address2 = !empty($Address2) ? $Address2 : 'NA';
$City = !empty($City) ? $City : 'NA';
$State = !empty($State) ? $State : 'NA';
$Country = !empty($Country) ? $Country : 'NA';
$Postal = !empty($Postal) ? $Postal : 'NA';
$Phone = !empty($Phone) ? $Phone : 'NA';
$Company = !empty($Company) ? $Company : 'NA';
$EmailNot = !empty($EmailNot) ? $EmailNot : 'NO';
$today = date("m/d/y");
mail("me@xxxxxxxxxxxx",
"Info on $Regarding",
"A User has submitted a Contact form on Mydomain.com
on $today
================================================
Name: $FName $LName
Email: $Email
Address: $Address
$Address2
$City
$State
$Country
$Postal
Phone: $Phone
Company: $Company
Message: $Comment
Referer: $Referer
Opt-Out: $EmailNot",
"From: $FName $LName <$Email>");
header ("location: thanks.html");
} // end if they hit "Submit"
?>

Later on the page is the form itself (edited for brevity):

<form name="contactinfo" method="post">
(various input areas)
</form>

I know that as is this page isn't secure from a spammer exploiting it for
their own purposes. Can someone help me clean it up to protect against
that kind of thing? I believe the input data has to be validated /
scrubbed or something? I've been googling and while I understand the
concept I'm not quite getting how to do it within the framework of what I
have already created,

Thanks much.
.



Relevant Pages

  • Upgrading PHP port to 4.4.1 breaks Drupal site
    ... Using portdowngrade to revert to PHP 4.4.0 worked again. ... Failed opening 'sites/default/settings.php' for inclusion ... line 642, referer: http://office.bals.org/ ...
    (freebsd-questions)
  • Re: help protecting form to email from spammers
    ... I have made a form to email php page that uses the mail function to send me the results of a form. ... Referer: $Referer ... (various input areas) ...
    (alt.php)
  • Re: cant send mail using mail()
    ... the first function i tried is the ... the apache error log said that the parameters are uninitialised. ... Though in the php manual is states the 4th ... trace:, referer: http://localhost/basin/pekerjaan.php?iduser=4&idpekerjaan=2 ...
    (comp.lang.php)
  • Re: Dynamic Banner
    ... >> the referer is stored in HTTP_REFERER ... > $HTTP_REFERER in PHP. ... norway, are urlencoded, you miss it. ... be a problem when some people use characters with accents etc. ...
    (alt.internet.search-engines)
  • keystone php3 eating memory on my new box using php 4.3.9 apache then errors
    ... REHDAT LINUX 4S PHP 4.3.9 LEGACY APP I MOVED NOW EATS MEMORY CAN ANYONE ... ps.php3 on line 736, referer: ... [client 10.1.30.223] ... Use of undefined constant accountname ...
    (comp.lang.php)