-
get_magic_quotes_gpc() function is deprecated, please help
over 9 years ago
-
over 9 years ago
In place of get_magic_quotes_gpc(), you can use htmlentities() method. It will help to prevent sql injection. e.g.
if (isset($_POST)) { $post = new httppost($_POST); echo htmlentities($post->value['field_name']); }
If still you facing any issue. Let me know.
-
-
over 9 years ago
Hi,
The issue is that you are using PHP version 5.4 or above which has the function deprecated.
The 2 options you have. 1. First is to switch back to version 5.3 or less. 2. Second is to enclose the code under a condition which checks PHP version.
function quote_smart($value, $handle) { // Stripslashes if(phpversion() < "5.3") { if (get_magic_quotes_gpc()) { $value = stripslashes($value); } } // Quote if not integer if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value, $handle) . "'"; } return $value; }
Hope this helps.
-
2 Answer(s)