PHP filter words and mysql?

Jerry

New member
Can someone please give me a working code that will filter words from a form and using a mysql database. I have the following code but I can not get it to work I tried adding a echo statement but I dont know where to add it.


Can you tell me why this script is not working. It is not echo out the new phase with the filter words.


<?
/*****************************
filter.php
*****************************/
//$UserInput['comments'] would be the $_POSTED comment from the form

class word_filter{

function word_filter($UserInput){
//Connect to the database
$this->db_connection();

$this->query_string = "SELECT * FROM wordfilter";
$this->query = mysql_query($this->query_string);

$PWords=array();//Post words
$PWordsR=array();//Replacements

while($WF=mysql_fetch_assoc($this->query…
extract($WF);
$PWords[]=$word;
$PWordsR[$word]=$replace_with;
}
foreach($PWords as $key=>$value){
$StripT=strip_tags($UserInput['comments'…
$Replace=str_ireplace($PWords,$PWordsR,$…
}
$this->NUserInput=$Replace;

}
function db_connection(){
$dbhost = 'paper2010.db.7124637.hostedresource.com…
$dbuser = 'paper2010';
$dbpass = 'Lamonte24';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');

$dbname = 'paper2010';
mysql_select_db($dbname);

//To include selecting the wordfilter database table
 
Back
Top