Data put into the database and taken out to display on the page need to pay attention to what
When in storage
$str =addslashes ($STR);
$sql =\ "INSERT INTO ' tab ' (' Content ') VALUES (\ ' $str \ ') \";
When you are out of the library
$str =stripslashes ($STR);
when displayed
$str =htmlspecialchars (NL2BR ($STR));
?
//--title, name, etc. field warehousing processing (go to the end of space)
Functiontrans_string_trim ($STR) {
$str =trim ($STR);
$str =eregi_replace ("'", "" ", $str);
$str =stripslashes ($STR);
RETURN$STR;
}
//--Article warehousing processing, that is, textarea field;
Functiontrans_string ($STR) {
$str =eregi_replace ("'", "" ", $str);
$str =stripslashes ($STR);
RETURN$STR;
}
//--is displayed in the form from the library, in text, trans, in textarea, without conversion, direct display
--Display on a Web page, filter HTML code, include a link address
Functiontrans ($string) {
$string =htmlspecialchars ($string);
$string =ereg_replace (CHR), "<br>", $string);
$string =ereg_replace (CHR), "", $string);
return$string;
}
//--is displayed on the Web page without filtering the HTML code;
Functiontrans_web ($string) {
$string =ereg_replace (CHR), "<br>", $string);
$string =ereg_replace (CHR), "", $string);
return$string;
}
//--is displayed on the Web page, filtering HTML code and leading and trailing spaces, mainly for displaying user nicknames
Functiontrans_trim ($string) {
$string =trim ($string);
$string =htmlspecialchars ($string);
$string =ereg_replace (CHR), "<br>", $string);
$string =ereg_replace (CHR), "", $string);
return$string;
}
the//--is displayed in span;
Functiontrans_span ($string) {
$string =ereg_replace (CHR), "\ n", $string);
$string =ereg_replace (CHR), "", $string);
$string =ereg_replace (' "," "", $string);
return$string;
}
//--displays cookies on the web, filtering HTML
Functiontrans_cookie ($STR) {
$str =trans ($STR);
$str =stripslashes ($STR);
$str =eregi_replace ("" "," "", $str);
RETURN$STR;
}
?>