Return to Snippet

Revision: 13249
at April 16, 2009 02:14 by lzyy


Initial Code
<?php
echo get_magic_quotes_gpc();         // 1
echo $_POST['lastname'];             // O\'reilly
echo addslashes($_POST['lastname']); // O\\\'reilly

if (!get_magic_quotes_gpc()) {
    $lastname = addslashes($_POST['lastname']);
} else {
    $lastname = $_POST['lastname'];
}

echo $lastname; // O\'reilly
$sql = "INSERT INTO lastnames (lastname) VALUES ('$lastname')";
?>

Initial URL
http://cn.php.net/get_magic_quotes_gpc

Initial Description
Magic quotes for incoming GET/POST/Cookie data.

This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.

Initial Title
get_magic_quotes_gpc & mysql query

Initial Tags
query

Initial Language
PHP