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 4 of 4
  1. #1
    Join Date
    Dec 2007
    Location
    :vi /bin/LINUXGURU.txt; :wq
    Posts
    513
    Tokens
    305

    Latest Awards:

    Default [PHP] Word Filter

    hi i need a word filter script that will include a .php / .txt file with badwords and replace them with Bobba or *****

    Please Post Back:eusa_danc
    Thanks,
    Nick
    ┌─┐
    ┴─┴
    ಠ_ರೃ

  2. #2
    Join Date
    Dec 2007
    Location
    :vi /bin/LINUXGURU.txt; :wq
    Posts
    513
    Tokens
    305

    Latest Awards:

    Default Here

    PHP Code:
    $bad_words explode('|''badword1|badword2|badword3|etc|etc');
    foreach (
    $bad_words as $naughty)
    {
    $comments eregi_replace($naughty"bobba"$comments);

    got a script posted if any body wanted

    say a bad word = "bobba"
    Thanks,
    Nick
    ┌─┐
    ┴─┴
    ಠ_ರೃ

  3. #3
    Join Date
    Apr 2006
    Location
    Leamington Spa
    Posts
    1,375
    Tokens
    72

    Latest Awards:

    Default

    PHP Code:
    <?php

    function filter($var){

    $badwords[0] = '/badword1/';
    $badwords[1] = '/badword2/';
    $badwords[2] = '/badword3/';
    $badwords[3] = '/badword4/';

    preg_replace($badwords"bobba"$var);

    return 
    $var;

    }

    ?>
    Use like:
    $var = filter($var);
    Post if it doesn't work.
    Last edited by lolwut; 04-01-2008 at 09:12 PM.
    i've been here for over 8 years and i don't know why

  4. #4
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default

    SQL:

    Code:
    CREATE TABLE `filter` (
    `id` int(11) NOT NULL auto_increment,
    `word` varchar(50) NOT NULL default '',
    PRIMARY KEY (`id`)
    ) TYPE=MyISAM;
    filter.php
    PHP Code:
    <?php
    //include your database connection
    include("YOURCONNECTIONFILE");
    //sets a php functions
    function filter($content){
    //selects rows from your database
    $filter mysql_query("SELECT * FROM `filter`");
    //loops all the rows out
    while($wfilt mysql_fetch_array($filter))
    {
    //finds the string and replaces it with the consored image
    $content str_replace ("$wfilt[word]""Bobba"$content);
    }
    //returns the string after being filtered
    return $content;
    }
    ?>
    at the top of your page add

    PHP Code:
    include("filter.php"); 
    Looking for a good desiner to design a social networking template.

    PM me.

Posting Permissions

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