webref.eu Posted July 31, 2008 Share Posted July 31, 2008 Hi All To make your script able to work on any server, do you always incorporate tests for magic_quotes_gpc in your code, e.g. if(!get_magic_quotes_gpc()){ $Username = addslashes($Username); } is this best practice or don't you bother? Thanks All. Link to comment https://forums.phpfreaks.com/topic/117564-test-for-magic_quotes_gpc/ Share on other sites More sharing options...
rhodesa Posted July 31, 2008 Share Posted July 31, 2008 magic_quotes is being depreciated. so normally, i check for the opposite (stripslahses if it's enabled) Link to comment https://forums.phpfreaks.com/topic/117564-test-for-magic_quotes_gpc/#findComment-604656 Share on other sites More sharing options...
rhodesa Posted July 31, 2008 Share Posted July 31, 2008 i usually use something like this to stripslashes on everything: <?php if(function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc()){ $func = create_function('&$value','$value = stripslashes($value);'); array_walk_recursive($_GET,$func); array_walk_recursive($_POST,$func); array_walk_recursive($_COOKIE,$func); } ?> Link to comment https://forums.phpfreaks.com/topic/117564-test-for-magic_quotes_gpc/#findComment-604660 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.