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

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
┌─┐
┴─┴
ಠ_ರೃ
got a script posted if any body wantedPHP Code:$bad_words = explode('|', 'badword1|badword2|badword3|etc|etc');
foreach ($bad_words as $naughty)
{
$comments = eregi_replace($naughty, "bobba", $comments);
}
say a bad word = "bobba"
Thanks,Nick
┌─┐
┴─┴
ಠ_ರೃ
Use like: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;
}
?>
$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
SQL:
filter.phpCode:CREATE TABLE `filter` ( `id` int(11) NOT NULL auto_increment, `word` varchar(50) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM;
at the top of your page addPHP 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;
}
?>
PHP Code:include("filter.php");
Looking for a good desiner to design a social networking template.
PM me.
Want to hide these adverts? Register an account for free!