Jump to content

Recommended Posts

Hi all,

 

Im still a newb at PHP and mySQL so go easy on me.

 

I have a site: www.freefreeads.com

 

Basically i did it to learn a bit of php and stuff, more out of fun than anything but now its being attacked by spammers (no surprise really).

 

What i want to know is if there is a way for the links not to show on my page if they contain certain words? I dont know if this will be done through the PHP coding or through SQL

 

Current code i have is:

<?php
//time to show you what you have in the database
$sql = "SELECT * FROM `test_table` ORDER BY `id` DESC LIMIT 5000;";
$result = mysql_query($sql);
print "			<table border=\"0\">\n";
while ($row = mysql_fetch_assoc($result)){
$title = $row['title'];
$url = $row['url'];
	echo "				<tr>
				<td><a href=\"$url\" target=\"http://www.freefreeads.com\">$title</a></td>
			</tr>
";
}
print "			</table>\n";
?>

 

Any help appreciated :)

Link to comment
https://forums.phpfreaks.com/topic/147995-stopping-spammers/
Share on other sites

Hi

 

First thing I would do is to trap the IP addresses of the posters. And then block those belonging to the spammers. Likely that if it is a bot then it is just returning the form fields, so change the names of the form fields (or if you want a bit of fun, do this dynamically, maybe based on the day of the week), which will make them have to change their script to work again.

 

To block the words you could compare them either with a LIKE in SQL or using a regular expression in php, dropping any record from being displayed when it contains a banned word. Probably easiest to store the list of banned words in a table, then loop through them and building up a regular expresssion string to use to checking against the posts (or you could check each one as you loop through them using strpos).

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/147995-stopping-spammers/#findComment-777116
Share on other sites

Hi

 

Another option (which you can add as well) is to send out the page with the date and time in it (no reason you cannot add or subtract a number of hours or days from it to make it less obvious, or that you cannot encode it somehow), and reject any page that is returned too quickly (ie a bot hammering away) or too slowly (ie, a bot submitting the form with details they picked up in the past).

 

Doesn't stop them but does make their lives more difficult.

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/147995-stopping-spammers/#findComment-777301
Share on other sites

To block the words you could compare them either with a LIKE in SQL or using a regular expression in php, dropping any record from being displayed when it contains a banned word. Probably easiest to store the list of banned words in a table, then loop through them and building up a regular expresssion string to use to checking against the posts (or you could check each one as you loop through them using strpos).

 

This is what i want to do, as they can just change IPs etc.

 

Im a complete newb so how would i go about coding this in SQL? I can figure out how to make the table but dont know how to intergrate the rest...

Link to comment
https://forums.phpfreaks.com/topic/147995-stopping-spammers/#findComment-777764
Share on other sites

Hi

 

I put a reply in you post on this in the MySQL area:-

 

http://www.phpfreaks.com/forums/index.php/topic,241625.0.html

 

While they can change IP addresses, chances are they only have a limited pool.

 

You could also get them to enter an email address, and send a confirmation email to that address with a link to click to enable their post to display (although watch out for people using it to generate emails against random addresses just to be a pain).

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/147995-stopping-spammers/#findComment-778046
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.