...

View Full Version : get_magic_quotes_gpc?



Camron467
03-27-2009, 05:14 PM
I am teaching myself php with a book, and the book explains everything pretty well except for this snippet of code:


if (get_magic_quotes_gpc()){
$qstring = stripslashes($qstring);
}
$qstring = mysql_real_escape_string($qstring)

Can anybody explain what this does or what it is used for to me?

abduraooft
03-27-2009, 05:19 PM
Try to follow GPC Stripping Tutorial (http://www.codingforums.com/showthread.php?t=144149) by Fou-lu

NancyJ
03-27-2009, 08:02 PM
//if magic quotes are turned on (automatically adds slashes to $_POST/$_GET etc data)
if (get_magic_quotes_gpc()){
//remove the slashes
$qstring = stripslashes($qstring);
}
// use mysql_real_escape_string to escape data - more advanced/secure than simply doing addslashes() which is essentially what magic quotes does
$qstring = mysql_real_escape_string($qstring)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum