Magic_quotes_gpc not enabled for PHP to solve escape

Source: Internet
Author: User
Magic_quotes_gpc is not enabled for PHP. if single quotes or other characters appear in GET and POST data, data cannot be added. this problem can be solved by using addslashes. Magic_quotes_gpc is not enabled for PHP. if single quotes or other characters appear in GET and POST data, data cannot be added. this problem can be solved by using addslashes.
By default, the PHP command magic_quotes_gpc is on, which runs automatically on all GET, POST, and COOKIE data. Addslashes (). Do not use strings that have been escaped by magic_quotes_gpc Addslashes ()Because it causes double-layer escape. In this case, you can use the function Get_magic_quotes_gpc ().

For example:PHP code
  1. If (! Get_magic_quotes_gpc ()){
  2. $ Title = addslashes ($ _ POST ['title']);
  3. } Else {
  4. $ Title = $ _ POST ['title'];
  5. }

First, check whether magic_quotes_gpc is enabled. if not, call addslashes (). If the method is enabled, assign values directly.


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.