Jump to content

Language filter php form processor script


Jarid

Recommended Posts

I wrote this html form:

<form action=filterwords.php method=post ENCTYPE="multipart/form-data" target="iFramestatus">
<input type=hidden name=action value=modified>
<input type=hidden name=login value="%%login%%">
<input type=hidden name=ID value="%%ID%%">
<textarea cols=28 rows=4 name=Unused10>%%Unused10%%</textarea>
<input type=submit name=submit value=" Update ">
</form>

Most of this form is filled out by my members area cgi script. I am trying to use filterwords.php to remove curse words from the textarea field "unused10" and then resubmit the data to my members area cgi script "pm.cgi"

 

Here is my php script.

<?php
  $action = $_REQUEST['action'] ;
  $login = $_REQUEST['login'] ;
  $ID = $_REQUEST['ID'] ;
  $text = $_REQUEST['Unused10'] ;
  $submit = $_REQUEST['submit'] ;


function filterBadWords($str){

// words to filter
$badwords=array( "[badword1]", "[badword2]");

// replace filtered words with random spaces
$replacements=array( "[    ]", "[      ]", "[   ]" );

for($i=0;$i < sizeof($badwords);$i++){
  srand((double)microtime()*1000000); 
  $rand_key = (rand()%sizeof($replacements));
  $str=eregi_replace($badwords[$i], $replacements[$rand_key], $str);
}
return $str;
}
$text = filterBadWords($text);


?>

 

How do i send the modified data to pm.cgi?

Did i use the filter script correctly?

 

Thanks for the help

 

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.