Jump to content

Need addslashes() explanation


co.ador

Recommended Posts

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 :) )

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.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.