lucerias Posted October 2, 2006 Share Posted October 2, 2006 Can anyone explain get_magic_quotes_gpc() to me? i have gone through the definition of PHP from site but can't really get the point. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/22721-the-meaning-of-get_magic_quotes_gpc/ Share on other sites More sharing options...
wildteen88 Posted October 2, 2006 Share Posted October 2, 2006 In short:Returns the current configuration setting of magic_quotes_gpc which is set in the php.iniSo if the magic_quotes_gpc is set to 1 or TRUE the get_magic_quotes_gpc function will return true. If magic_quotes_gpc is set to 0 or FALSE get_magic_quotes_gpc function will return false.magic_quotes escapes quotes from within a string which is PHPs way of making user input safe for you to use. Quote Link to comment https://forums.phpfreaks.com/topic/22721-the-meaning-of-get_magic_quotes_gpc/#findComment-102186 Share on other sites More sharing options...
Jenk Posted October 2, 2006 Share Posted October 2, 2006 A semantic correction: get_magic_quotes_gpc() returns 0 or 1. Quote Link to comment https://forums.phpfreaks.com/topic/22721-the-meaning-of-get_magic_quotes_gpc/#findComment-102287 Share on other sites More sharing options...
lucerias Posted October 3, 2006 Author Share Posted October 3, 2006 Thanks guys, i know that it returns bool true or false but what is this config about? I am not asking on or off but the purpose of magic_quotes_gpc() itself. Quote Link to comment https://forums.phpfreaks.com/topic/22721-the-meaning-of-get_magic_quotes_gpc/#findComment-102787 Share on other sites More sharing options...
printf Posted October 3, 2006 Share Posted October 3, 2006 It was a safety feature, originally designed to help new coders starting to learn PHP. Because PHP learning curve is some what easy compared to Perl or other higher level languages you end up with many people who want just the end result, they don't care about learning how to set a good coding standard that they should follow. This results in thousands of hacked script floating around the Internet that are dangerous. So my hosts started implementing magic_quotes so as to protect their servers from all of these dangerous scripts! But this can cause even more problems, if you don't check if magic_quotes is on and then you addslashes to already escaped string. Adding slashes like anything else you do, should be done in a selective way, because it senseless to addslashes to a variable value that doesn't need it.me! Quote Link to comment https://forums.phpfreaks.com/topic/22721-the-meaning-of-get_magic_quotes_gpc/#findComment-102794 Share on other sites More sharing options...
lucerias Posted October 3, 2006 Author Share Posted October 3, 2006 Thank you printf, your explanation is impressive. Quote Link to comment https://forums.phpfreaks.com/topic/22721-the-meaning-of-get_magic_quotes_gpc/#findComment-102798 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.