Reduce SPAM with a PHP Contact PageVersion 1.1.0 Date 11-27-2005If you are using version 1.0.0 of this ccontact page please replace it immediately with this one or one that performs checks against user input on the address and subject lines. Spammers are trying to use contact pages to send illegal email. This page is more secure than version 1.0.0 and there will be a version 2.0.0 of this page which will have more features to make it more secure. This page provides an ability to have someone alerted when attacks are done by spammers.Reducing SPAM has become a important part of operating on the internet today. This document will provide a PHP contact page which webmasters can use to keep their e-mail address hidden from SPAM robots. SPAM robots are used to crawl internet web pages and pick e-mail addresses from those web pages. Even today some SPAM crawlers can pick web addresses from pages with the e-mail embedded within javascript. Some webmasters use a graphical image to post their e-mail address on the internet but spammers could still read that manually and sell the address to SPAM lists. Additionally, this contacts page allows webmasters to easily modify the contacts page when their e-mail address changes to reflect the new value of their e-mail address. They do not need to change multiple pages where an e-mail address may be embedded inside HTML code. One thing to remember when using the contacts page, however, is that when you reply to your readers, you are giving them your e-mail address, so only reply to those who you believe you can trust to not sell your e-mail address. Otherwise find a way to disguise your e-mail address. LicensingIn the interest of reducing SPAM, I am granting a licence to all webmasters to use and modify this code. All I ask is for a link back to this website and the credit for the original code to be given to the Computer Technology Documentation Project. About the pagesTwo contacts pages are provided. The first contact page is a simple page with a form embedded where the user can type their e-mail, add a subject, and type their message. There is no capability to provide for web site style. Contact Page 1 - The simpler pageThis page is named contact1.txt. It has been renamed with a text file extension so you can easily view and copy it. To use it, copy and save it and rename it "contact1.php". There are four variables which can be changed in this contact page. They are:
Contact Page 2 - The page using a template HTML fileThe second page utilizes a template file with the name "sitetemplate.html". It allows the contacts page to be adapted to the style of the website. The template file allows for PHP code substitution to be performed by the contacts page. The template file contains embedded strings which allow for the ability to include the php contact form, javascript form verification code and additional links which mainly allow the user to get back to the home page. The embedded strings are bracked both in front and behind by double exclaimation points (!) and are as follows: |
This page is named contact2.txt. It has been renamed with a text file extension so you can easily view and copy it. To use it, copy and save it and rename it "contact2.php".
There are six variables which can be changed in this contact page. They are:Here is a link to the sitetemplate.html sample template file. You can right click it and select "Save target as..." in Internet Explorer to download it. Its text is as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Arachnophilia 3.9">
<meta name="description" content="!!description!!">
<meta name="keywords" content="!!keywords!!">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<title>!!title!!</title>
<link href="style.css" rel="stylesheet" type="text/css">
!!javascript!!
<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" class="main">
<tr>
<td>
<a href="/morepics/Birthdaycakeballoon.jpg" target="_blank" onMouseOver="window.status='Photos courtesy of the CTDP, Free for use' ;return true" onMouseOut="window.status='';return true"><img src="/morepics/Birthdaycakeballoon.gif" alt="Birthday Cake balloon"></a>
</td>
<td style="width: '100%'"><br>
<h1>!!title!!</h1>
</td>
<td>
<a href="/morepics/purplepeopleeaterfromside.jpg" target="_blank" onMouseOver="window.status='Photos courtesy of the CTDP, Free for use' ;return true" onMouseOut="window.status='';return true"><img src="/morepics/purplepeopleeaterfromside.gif" alt="Purple people eater balloon from the side"></a>
</td>
</tr>
</table>
<table class="bg">
<tr>
<td class="left">
<div class="center">
<img src="/gifs/ctdp1.gif" alt="CTDP">
</div>
!!linkscontent!!
</td>
<td class="middle">
<table class="bg">
<tr><td>
<hr class="half">
<div class="center">!!horizlinks!!</div>
<hr class="half">
</td></tr>
</table>
!!content!!
</td>
<td class="right" width="25%">
</td>
</tr>
</table>
</body>
</html>
To use the contact page 2 and the sample template file:
One feature that I could add to this page is an ability to display some graphic text which must be typed in by a user to use this page. This would prevent a SPAM robot from automatically using the page to send you e-mail. If anyone wants this feature, please feel free to use our contacts page to send the request to the webmaster.