Magic Quotes is used to filter forms submitted over illegal information processing, if (GET_MAGIC_QUOTES_GPC ()) echo "Magic quotes is enabled"; else echo "Magic quotes is D Isabled ";
PHP-magic Quotes
Before to PHP 6th there is a feature called Magic quotes created to help protect novice programmers from writing bad form processing code. Magic quotes will automatically evade dangerous form data that may be used for SQL injection with backslashes. The character escapes from PHP include: Quote ', double quote ', backslash, and null character.
Advertising tizag.com
However, this novice protection proves to be causing more problems than solving the problem, not in PHP 6. If any version of your PHP version is before 6th, then you should use this lesson to learn how magic quotes may affect you.
Magic quotes-they make?
First thing first, you need to check if you have magic quotes to make your server. The GET_MAGIC_QUOTES_GPC function returns 0 (close) or 1 (UP). These Boolean values are suitable for becoming a good speaker, if 1 of them are true and 0 are false.
if (GET_MAGIC_QUOTES_GPC ())
echo "Magic quotes is enabled";
Else
echo "Magic quotes is disabled";
Output is with you PHP is open
Magic quotes in action
It is now possible to make a simple form showing how the processor's machine with magic quotes will enable those who may escape the danger of the character. This form is presented to itself, so you just need to make a file, "Magic quotes.php" to test it.
echo "Altered Text:". $_post[' question ');
?>
Remove backslash-s tripslashes () function
In the use of PHP backslash cleanup function stripslashes It's smart add some magic quotes like our check "they have enabled?" "The above section. In this way, you will not accidentally be removed from the slash thought to be legal, future if your PHP magic quotes settings change.
echo "removed slashes:";
Remove those slashes
if (GET_MAGIC_QUOTES_GPC ())
echo stripslashes ($_post[' question ');
Else
echo $_post[' question '];
?>
http://www.bkjia.com/PHPjc/445498.html www.bkjia.com true http://www.bkjia.com/PHPjc/445498.html techarticle Magic Quotes is used to filter forms submitted over illegal information processing, if (GET_MAGIC_QUOTES_GPC ()) echo Magic quotes is enabled;else echo Magic quotes are Disabled PHP-magic q ...