Jump to content

faction help


ctcp

Recommended Posts

my fanction

<?php
function language_filter($string) {
// no matter where you get $obscenities array, from database, file or just from the script...
    $obscenities = array("test","word"," foul ","language");
    foreach ($obscenities as $curse_word) {
        if (stristr(trim($string),$curse_word)) {
            $length = strlen($curse_word);
            for ($i = 1; $i <= $length; $i++) {
                $stars .= "*";
            }
            $string = eregi_replace($curse_word,$stars,trim($string));
            $stars = "";
        }
    }
    return $string;
} 
?>

can sombady help me what is wrong here and not work :(

<?php echo $string = ($row_usersinfo['username']); language_filter($string);?> 

 

 

Link to comment
https://forums.phpfreaks.com/topic/231874-faction-help/
Share on other sites

http://php.net/manual/en/function.eregi-replace.php

 

Eregi was depreciated and you should look at the alternative now.

 

As for this:

 

<?php echo $string = ($row_usersinfo['username']); language_filter($string);?> 

 

If your wanting to filter the username for profanity then you call your function like so:

 

<?php echo language_filter($row_usersinfo['username']);?> 

 

make sure your including the .php file that holds the function if it's outside the code your using.

Link to comment
https://forums.phpfreaks.com/topic/231874-faction-help/#findComment-1192937
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.