Hi there,
I’m a total n00b when it comes to PHP, so you’ll have to pardon my ignorance. I have a basic foundation in javascript/html/css/jquery so I’m not completely uninitiated… Essentially what I want to do is implement the following script:
[php]
<? // BadWordFilter // This function does all the work. If $replace is 1 it will replace all bad words // with the wildcard replacements. If $replace is 0 it will not replace anything. // In either case, it will return 1 if it found bad words or 0 otherwise. // Be sure to fill the $bads array with the bad words you want filtered. FUNCTION BadWordFilter(&$text, $replace){ // fill this array with the bad words you want to filter and their replacements $bads = ARRAY ( ARRAY("butt","b***"), ARRAY("poop","p***"), ARRAY("crap","c***") ); IF($replace==1) { //we are replacing $remember = $text; FOR($i=0;$i<sizeof($bads);$i++) { //go through each bad word $text = EREGI_REPLACE($bads[$i][0],$bads[$i][1],$text); //replace it } IF($remember!=$text) RETURN 1; //if there are any changes, return 1 } ELSE { //we are just checking FOR($i=0;$i[/php]
I will have a page with an html form, one text field and a submit button. I’m guessing that I need to save the above script to a PHP file, and set that file as the action for the submit button in the html form. The problem is - how do I return the filtered results to the next page?
Thanks in advance!