SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    sweden
    Posts
    646
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    No html in guestbook?

    I made a guestbook in php and mysql for a friend last year.
    Now people put stupid viagra links in that guestbook and I need to get rid of people entering html into the guestbook.

    Is there a simple solution for this?

  2. #2
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,424
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)

  3. #3
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    sweden
    Posts
    646
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Will strip tags remove all html in the code?

  4. #4
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,424
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Yes.

  5. #5
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    sweden
    Posts
    646
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I did this now and it only take away the links, but it would be nice get rid of more. But then I guess we're talking about a more complicated validation to check the input...

    I really hate these spammers and viagra stuff. They try to destroy the whole internet.

  6. #6
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    you could search the input for the occurence of the word viagra

    PHP Code:
    if(eregi("viagra",$msg)) { 
    die(
    'Please do not try to spam us. We take it quite personally and wish the fleas of a thousand camels to infest your pubic hair.'); 
    exit(); 
    } else {
    #post it

    Similar sort of solution to email injection attacks.

    Spike
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  7. #7
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    sweden
    Posts
    646
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    That was a great little code. And it works fine.
    Is there a simple way to add more words than just viagra to that code?

  8. #8
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    I guess you could set up an array of words you want to look out for and set up a foreach loop looking for them...
    PHP Code:
    $look_for = array("viagra""cialis");
    $msg 'this is a test for viagra';

    foreach(
    $look_for as $spy) {
    if(
    eregi($spy,$msg)) { 
    die(
    'Please do not try to spam us. We take it quite personally and wish the fleas of a thousand camels to infest your pubic hair.'); 
    exit(); 
        }
    }
    echo 
    $msg


    Spike
    Last edited by spikeZ; Feb 3, 2006 at 08:17. Reason: word filter removed my swear word in the array!
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  9. #9
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    sweden
    Posts
    646
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Lovely.


Bookmarks

Posting Permissions

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