Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 2 of 2

Thread: PHP help needed

  1. #1
    Join Date
    Jul 2005
    Posts
    1,653
    Tokens
    50

    Latest Awards:

    Default PHP help needed

    hey

    I have $_POST['comment'] right, basically, can someone help me with checking if $_POST['comment'] has swear words and if so replace them with #'s.

    thanks.

  2. #2
    Join Date
    Sep 2006
    Location
    Oxford, United Kingdom
    Posts
    574
    Tokens
    0

    Default

    Silly idea, but couldnt you impliment a sort of bbcode feature on it?

    Rather then checking when its posted, it checks where its displayed.

    eg having your filter file with all your swearwords etc... in and then having filter wrapped around it?

    filter($comment);

    Or something?

    edit, like this:
    filter.php
    PHP Code:
    <?
    function filter($content){ // our nice filter function
    $content nl2br(htmlspecialchars($content)); //  our message that we want to put the filter in

        
    $filter = array(  // The filter tags
           
    "SWEARWORDHERE"// omg, a swear word
           
    "SWEARWORDHERE"// omg, another swear word
            
    );

          
    $html = array( // The HTML counter part of the tags
            
    "#########"
            
    "#########"
        
           );

          
    $content preg_replace($filter$html$content); // replaces all filtered words tags with  their HTML counter parts
        
    return nl2br($content);
    }

    ?>
    then when defining the $content variable or w/e have something like this:
    PHP Code:
        $content filter($r['content']); 
    then obviously include the filter file in every page the filter is included on

    PHP Code:
    include("filter.php"); 
    Theres probably an easier way to do it, but meh
    Last edited by CHTom; 21-12-2006 at 02:26 PM.

Posting Permissions

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