Parse php to warehouse receiving and warehouse picking. When the data is put into the database and retrieved, it is displayed on the page that you need to pay attention to when receiving the data into the database $ straddslashes ($ str); $ sqlinsertinto 'tab' ('content') values ($ str ); $ strstripsla at warehouse picking
What should I pay attention to when the data is put into the database and retrieved and displayed on the page?
Warehouse receiving
$ Str = addslashes ($ str );
$ SQL = \ "insert into 'tab' ('content') values (\ '$ str \')\";
Warehouse picking
$ Str = stripslashes ($ str );
Display time
$ Str = htmlspecialchars (nl2br ($ str ));
// -- Import the title, name, and other fields into the database (with spaces at the beginning and end)
Functiontrans_string_trim ($ str ){
$ Str = trim ($ str );
$ Str = eregi_replace ("'", "'' ", $ str );
$ Str = stripslashes ($ str );
Return $ str;
}
// -- Process the input of an article, that is, the textarea field;
Functiontrans_string ($ str ){
$ Str = eregi_replace ("'", "'' ", $ str );
$ Str = stripslashes ($ str );
Return $ str;
}
// -- Display the data in the form from the library; convert the data in text to trans. in textarea, the data is directly displayed without conversion.
// -- Display the HTML code on the WEB page, including the link address
Functiontrans ($ string ){
$ String = htmlspecialchars ($ string );
$ String = ereg_replace (chr (10 ),"
", $ String );
$ String = ereg_replace (chr (32), "", $ string );
Return $ string;
}
// -- Display on the WEB page without filtering HTML code;
Functiontrans_web ($ string ){
$ String = ereg_replace (chr (10 ),"
", $ String );
$ String = ereg_replace (chr (32), "", $ string );
Return $ string;
}
// -- Display HTML code and leading and trailing spaces on the WEB page, mainly used to display user nicknames
Functiontrans_trim ($ string ){
$ String = trim ($ string );
$ String = htmlspecialchars ($ string );
$ String = ereg_replace (chr (10 ),"
", $ String );
$ String = ereg_replace (chr (32), "", $ string );
Return $ string;
}
// -- Display in span;
Functiontrans_span ($ string ){
$ String = ereg_replace (chr (10), "\ n", $ string );
$ String = ereg_replace (chr (32), "", $ string );
$ String = ereg_replace ('"'," ", $ string );
Return $ string;
}
// -- Display cookies on the WEB to filter html
Functiontrans_cookie ($ str ){
$ Str = trans ($ str );
$ Str = stripslashes ($ str );
$ Str = eregi_replace ("'' "," '", $ str );
Return $ str;
}
?>
$ Str = addslashes ($ str); $ SQL = \ "insert into 'Tab '('content') values (\' $ str \')\"; $ str = stripsla...