Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Flood Control

  1. #1
    Banned
    Join Date
    Dec 2005
    Location
    That's a secret.
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Flood Control

    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?

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    United Kingdom Confused: Often
    Posts
    859
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Okay... first off you want to strip HTML out of the posts, use the strip_tags() function like this before saving the link:

    PHP Code:
    $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.
    redhead

  • #3
    Banned
    Join Date
    Dec 2005
    Location
    That's a secret.
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by redhead
    Okay... first off you want to strip HTML out of the posts, use the strip_tags() function like this before saving the link:

    PHP Code:
    $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

  • #4
    Regular Coder trib4lmaniac's Avatar
    Join Date
    Feb 2004
    Location
    Cornwall, UK
    Posts
    535
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •