( search forums )
php problems
Soldat Forums - Misc - The Lounge
aprilninety
December 18, 2005, 7:55 pm
I've been making guestbooks and shoutboxes for people for awhile now, but recently, I've been getting these spam entries in my MySQl tables and it's a pain in the butt to have to try and delete them.

My question is, is there a very simple way to stop this spamming of my shoutboxes with free medicine crap? I dont want a login system, I just want a simple code that can fix my problems.

mar77a
December 18, 2005, 8:11 pm
hmn, you can use cookies like this....
on the page that processes the post form...(At the very top)

[code]
<?

$cookie = $_COOKIE['roflpwned'];
if($cookie){
echo "Flood control activated...wait 5 minutes to post again.";
exit;
}else{
setcookie("roflpwned", "1", time()+60*5);
}

[...]

[/code]

i think that should work...

FliesLikeABrick
December 18, 2005, 8:45 pm
or instead of/in addition to cookies, you can check the timestamp of their last post in the mysql table. Before you add their new post, check to see when their last post was, and don't let them post if it was in the last X minutes

DePhille
December 18, 2005, 8:54 pm
-Empty the boxes when the form has been submitted , so they have to retype it.
-Do what mar77a said
-Do what FLAB said
-Make a tiny script that removes all entries with the exact same message and author (risky , if Admin:Yes , some will be deleted.)

FliesLikeABricks is the safest , mar77a's is the most efficient.

Grtz , DePhille

Soulsnipa
December 18, 2005, 9:46 pm
yo dude

Deleted User
December 18, 2005, 11:51 pm
don't

PopeJohnPaul_II
December 19, 2005, 12:12 am
Here is a helpful url:
http://www.sitepoint.com/article/stop-comment-spam

The best idea would be to use non-descriptive form names.

FliesLikeABrick
December 19, 2005, 1:56 am
-Make a tiny script that removes all entries with the exact same message and author (risky , if Admin:Yes , some will be deleted.)

^quote from dephille

don't have it delete the same message and same author, thats excessive. just don't let an author post the same message more than twice within 20 entries of eachother

DePhille
December 19, 2005, 12:41 pm
Yea brick is right but you do have a problem when you use cookies to dtermine the author (If he types in George instead of Pamela he's 'another' author , so you'll need some other recognition).
Cookies can be deleted/blocked (Don't know too sure about session cookies) but that's what I meant with mar77a's script being not too safe.

What you could do (and that might be what FliesLikeABrick already suggested , don't know) is store IPs (like I do in my shoutboxes) and then filter the list for their IP , getting the latest timestamp and then checking if there is enougg time between the last post and the new one.
Thats the safest and most efficient way I can come up with at the moment , if the user wants to bypass that he has to have a dynamic IP and he has to restart his modem , PC or something else refreshes his IP , which normally takes longer than a minute. It could be that FliesLikeABrick was suggesting that but I didn't read that he's also storing IPs.

Grtz , DePhille

mar77a
December 19, 2005, 12:47 pm
quote:Yea brick is right but you do have a problem when you use cookies to dtermine the author (If he types in George instead of Pamela he's 'another' author , so you'll need some other recognition).


Heh, the cookie is set on the users computer, it has nothing to do with the "nickname" the put in the guestobook.

mar77a
December 19, 2005, 12:49 pm
And by the way, if you want to delete messages from a MySQL row, just use auto-incrementing ID's.