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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.