trq Posted December 21, 2009 Share Posted December 21, 2009 The if(function_exists('get_magic_quotes_gpc')) { code that keldorn posted is nonsense. The get_magic_quotes_gpc function exists in php4, php5, and php6, so that code will always perform stripslashes() even if the magic_quotes_gpc setting is OFF. This will result in any actual \ in the data being removed. stripslashes() should only be executed when magic_quotes_gpc in ON, in which case calling the get_magic_quotes_gpc() function will return a TRUE value. Are you sure , I learned that from the PHP IPN example from Paypal. If you'll take a look, https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_admin_IPNImplementation Why would paypal show a incorrect way to detect magic quotes. Would of the code example been reviewed before being put on the site? You can learn bad habits from anywhere. (Forums & third party code in particular ) Quote Link to comment https://forums.phpfreaks.com/topic/185678-need-addslashes-explanation/page/2/#findComment-981310 Share on other sites More sharing options...
PFMaBiSmAd Posted December 21, 2009 Share Posted December 21, 2009 Well, the code you posted is not the same logic as at the paypal link. The code at the paypal link is calling the get_magic_quotes_gpc() function and using stripslashes() if magic_quotes_gpc is ON, which is exactly what had already been posted in this thread. Quote Link to comment https://forums.phpfreaks.com/topic/185678-need-addslashes-explanation/page/2/#findComment-981314 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.