Character filtering program. According to the customer's requirements, they can manually set and filter unnecessary keywords in the background, so they will write the following code, character filtering program! DOCTYPEhtmlPUBLIC-based on customer requirements, they can manually set and filter unnecessary keywords in the background, so they can write the following code: character filtering program
Untitled Document
If ($ _ POST ){
$ Words = isset ($ _ POST ['fiter _ word'])? $ _ POST ['fiter _ word']: '';
$ SQL = "Update gx_filter set filter_words = '$ word' where id = 1 ";
Mysql_query ($ SQL) or die (mysql_error ());
Echo "script" alert ('set successfully'); location = 'filter. php'; script ";
}
?>
This is on the character filtering page. let's take a look at how to determine and filter characters that are not allowed by our customers.
Function filter_words ($ str ){
$ SQL = "Select * from gx_filter where id = 1 limit 1 ";
$ Result = mysql_query ($ SQL );
$ Rs = mysql_fetch_array ($ result );
$ Array = explode ('|', $ rs ['filter _ word']);
If (is_array ($ array )){
$ Array_length = sizeof ($ array );
For ($ I = 0; $ I <$ array_length; $ I ++ ){
$ Str = @ str_replace ($ array [$ I], '', $ str );
}
}
Return $ str;
}
Read the characters to be filtered from the database, and then process them as above.
Application: for original site reprinted, please indicate www.111cn.cn/phper/php.html
Success! DOCTYPE html PUBLIC -//...