...

View Full Version : Flood Control



SecretPete
04-30-2006, 06:20 AM
I would like to add flood control to here: http://dailyplug.com/linkdump/ but I don't know where to start, can you guys help me out?

redhead
04-30-2006, 10:41 PM
Okay... first off you want to strip HTML out of the posts, use the strip_tags() function like this before saving the link:


$linkname = strip_tags($_POST['Link_title2']);

I guess there are several types of flooding... Those who post the same link X times, and those who post X made up links just for fun...

To deal with the first: you probably want to check that the URL hasnt already been entered into the database (I assume you're storing it in a database rather than a text file? If it's in a database, you could either set the URL field in the table to UNIQUE or you could actually look for that URL in the table, and only save the new one if it returns no results.

To avoid the second, set a cookie (see www.php.net/set_cookie) and then dont allow them to post anything else until their cookie has expired, perhaps?

I think it'd be best to give some of the above a try and see how effective they are. Hope this helps.

SecretPete
05-01-2006, 12:16 AM
Okay... first off you want to strip HTML out of the posts, use the strip_tags() function like this before saving the link:


$linkname = strip_tags($_POST['Link_title2']);

I guess there are several types of flooding... Those who post the same link X times, and those who post X made up links just for fun...

To deal with the first: you probably want to check that the URL hasnt already been entered into the database (I assume you're storing it in a database rather than a text file? If it's in a database, you could either set the URL field in the table to UNIQUE or you could actually look for that URL in the table, and only save the new one if it returns no results.

To avoid the second, set a cookie (see www.php.net/set_cookie) and then dont allow them to post anything else until their cookie has expired, perhaps?

I think it'd be best to give some of the above a try and see how effective they are. Hope this helps.

Yes thank you for the html tip... I have just put a cookie on there :)

trib4lmaniac
05-01-2006, 03:06 PM
No good if they don't have cookies enabled :(

Instead, only let them post if they have Cookie1 but not Cookie2 :)
Cookie1 is set on the first page visit, Cookie2 is set when they submit a link.

Or you could check IP addresses.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum