Send form content in PHP email (2)-How do I remove unnecessary backslashes? (MAGIC_QUOTES_GPC)

Source: Internet
Author: User
Tags php email

The main content of this section is relatively simple, that is, to remove unnecessary backslashes.

In fact, this is a legacy of the past, PHP in order to facilitate beginners to join the content, but later found that it caused more problems, and in today's language has been abandoned

This feature has been DEPRECATED as of PHP 5.3.0 and removed as of PHP 5.4.0.

Extended reading: http://php.net/manual/en/security.magicquotes.php (official manual)

Just know two ways to close the MAGIC_QUOTES_GPC.

The first method: Create a new text file, enter the following, and then save As. ". Htacess" is then saved in the site root folder. (This method only applies to Apach)

Php_flag MAGIC_QUOTE_GPC off

The second method: Create a new file named Remove_quotes.php, enter the following, and then require the first part of the PHP file where you want to remove the backslash.

1<?PHP2 if(GET_MAGIC_QUOTES_GPC()) {3     $process=Array(&$_get, &$_post, &$_cookie, &$_request);4      while(List($key,$val) = each($process)) {5         foreach($val  as $k=$v) {6             unset($process[$key][$k]);7             if(Is_array($v)) {8                 $process[$key][stripslashes($k)] =$v;9                 $process[] = &$process[$key][stripslashes($k)];Ten}Else { One                 $process[$key][stripslashes($k)] =stripslashes($v); A             } -         } -     } the     unset($process); - } -?>

Send form content in PHP email (2)-How do I remove unnecessary backslashes? (MAGIC_QUOTES_GPC)

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.