Parse PHP warehouse receiving and warehouse picking

Source: Internet
Author: User

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;
}
//--ArticleWarehouse receiving, 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 on the web page and filter HTMLCode; Including link addresses
Functiontrans ($ string ){
$ String = htmlspecialchars ($ string );
$ String = ereg_replace (CHR (10), "<br>", $ 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), "<br>", $ 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), "<br>", $ 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;
}
?>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.