get_magic_quotes_gpc & mysql query


/ Published in: PHP
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. <?php
  2. echo $_POST['lastname']; // O\'reilly
  3. echo addslashes($_POST['lastname']); // O\\\'reilly
  4.  
  5. $lastname = addslashes($_POST['lastname']);
  6. } else {
  7. $lastname = $_POST['lastname'];
  8. }
  9.  
  10. echo $lastname; // O\'reilly
  11. $sql = "INSERT INTO lastnames (lastname) VALUES ('$lastname')";
  12. ?>

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.