473,473 Members | 2,097 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Need help preventing spammers in guestbooks

1 New Member
Hello,
This is my first post, and any help would be greatly appreciated.
I create online memorials which contain guestbooks which have been the subject of computer generated spam. I have been able to modify the php script to eliminate posts containing www and http which solved the problem for a while, but the spammers are back in full force.

I need to add a security measure to eliminate the spam, but I don't want it to bee too obtrusive. I thought if I added a field to the form with a required field that was constant (with a line describing that the viewer must enter the text "VXPTO132" in order to complete the post, this would work.

Unfortunately, I don't know php enough to know how to add that string into the code. Could anyone please tell me the line(s) I need to add? Thank you in advance.


Here's the code:

<html><head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<META HTTP-EQUIV="Content-Language" CONTENT="En">
<META NAME="Keywords" CONTENT="none">
<META NAME="revisit-after" CONTENT="31 days">
<title>Precious Memories & More ~ Personal Tributes</title>
</HEAD><body>
<center>
<h2><b><font face="arial">Personal Tribute</b></h2></font><br>
</center>
<?php

/*+---------------------------------------------------------------+
| PHP GuestBook Version 1.5.0
| Copyright 1999-2000 All Rights Reserved.
| TELEMATICS SOFTWARE
| E-Mail:mr.shifter@hosted.uklinux.net
| Script License: GPL
| Script Archive at:
| http://www.hosted.uklinux.net/php/freescripts/index.php
| Upload both guestbook.php and guestbook.html, chmod 666
| to guestbook.html read/write for all. Call the html page in
| your browser and you now have a simple guestbook script.
|
+--------------------------------------------------------------+*/
/*-------------- Set Necessary Variables ----------- */

$GUEST_LIST = "guestbook.htm";
// Absolute path to guestbook.htm file.
// chmod 666 to this html file

$PLACE_HOLDER = "<!--Add_Comments-->";
//Position of new messages in html document.


$REFERERS = array('www.preciousmemoriesandmore.com' ,'www.goodbyes.org', 'preciousmemoriesandmore.com','goodbyes.org');
// use without http://
// URL(s) of servers who are authorised to use this script.


/*------- End Variables section ---------- */

function error($error_message) {
echo $error_message."<BR>";
exit;
}

function check_referer () {
global $REFERERS, $HTTP_REFERER;
if ($HTTP_REFERER != "")
while (list($val, $ref) = each($REFERERS))
if (preg_match("/^http:\/\/$ref/", $HTTP_REFERER))
return;
error("Unauthorized access to: $HTTP_REFERER");
}

check_referer();

if ($action == 'write') {

$date = date("d/m/Y");

$file_array = file($GUEST_LIST) or die("Sorry...can not open $GUEST_LIST");

$file = join ("", $file_array);

$name = htmlspecialchars(stripslashes($name));
$email = htmlspecialchars(stripslashes($email));
$title = htmlspecialchars(stripslashes($title));
$comment = htmlspecialchars(stripslashes($comment));

//if the comment contains "www." then stop execution of script
if(strstr($comment, "www."))
{
die("Sorry, but you cannot post URLs in a message. Please try again");
}

//if the comment contains "www." then stop execution of script
if(strstr($comment, "http:"))
{
die("Sorry, but you cannot post URLs in a message. Please try again");
}

$add = $PLACE_HOLDER;
$add .= "\n<DL><DT><A HREF=\"mailto:$email\">$name</A><DD><BR>$comment<BR><BR>Tribute added on $date</DL>\n";
$file = preg_replace("/$PLACE_HOLDER/", $add, $file);

$fp = fopen("$GUEST_LIST", "w") or die ("Sorry...can not write to $GUEST_LIST");
flock($fp, 1);
fputs($fp, $file);
flock($fp, 3);
fclose($fp);


echo("<center><p> You have entered the following tribute,<br></p><table><tr><td>");
echo ("$add<BR>");
echo("</td</tr></table></center>");
echo("<center><p>Thanks for adding your personal tribute</p></font></center>");

}
?>
<br>
<center><font face="arial" size="2" color"FFFFFF">
Return to <A HREF="guestbook.htm">the Tribute Page</A> to view your message<br>
(If your message is not displayed, click on the REFRESH button)
<hr>
</font>
</center>
</body></html>
Jul 20 '06 #1
1 4826
ronverdonk
4,258 Recognized Expert Specialist
I have in my email archive an excellent article by Ian Gilfillan about how to tackle this problem.

It details how to scan addresses and text for non-allowed words, tags and other indications that might suggest a spammer attack.

This article is too long to post in this reply, but if you send me your email address (you don't have one in the members list) I will forward this article to you.
You can send me mail via the members list.

Hear from you - Ronald :cool:
Jul 20 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Jim | last post by:
Hi, I keep getting form results emailed to me that would indicate a form from my web site is getting submitted with all fields blank or empty, but my code should preventing users from proceeding...
1
by: David Hane | last post by:
Hi all, I would like give users the ability to experiment with complex queries but I'm worried about them creating queries that will bog down the server. Does anyone have any ideas for...
6
by: Jerry Werner | last post by:
I need to replace my email address on hundreds of web pages with a new address (in a graphic, not a mailto) in order to thwart the email harvesters that spammers are using. Ideally, I'd like to do...
21
by: PassingBy | last post by:
I recently came across a template site selling cd's and was wondering what the groups opinion is of this? I purchased one of the cd's and the templates are great and Im looking forward to...
43
by: SLH | last post by:
hi people. im trying to validate input received via a text area on an ASP page before writing it to a database. i cant use client side javascript due to policy, so it all has to happen on the...
12
by: Mark Rae | last post by:
Hi, See the previous thread Request.Form abuse in this newsgroup... I'm looking for a simple and efficient way to prevent people hijacking the <formtags on my websites and using them to send...
4
by: shror | last post by:
dear all, i have started learning php 2 weeks ago and i have wrote my first script for mail sender and the script takes all my data and move to the thanks page but the problem is that the mails...
4
by: CleaningTips | last post by:
Me and my buddy made a website called www.CleaningTips.com, its basically a free forum and free blog driven web site dedicated as a source people can goto to find out how to clean and remove...
12
by: MikeB | last post by:
I created a small website for a friend. On this website he has a contact page where people can send him email. When I wrote this page I checked some tutorial pages and they warned about certain...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.