limitphp Posted February 15, 2009 Share Posted February 15, 2009 I have a cookie value that my web developer is telling is: %27Folk%27 Is %27Folk%27 = 'Folk' or \'Folk\' ? thanks Link to comment https://forums.phpfreaks.com/topic/145259-solved-need-help-with-cookie/ Share on other sites More sharing options...
Philip Posted February 15, 2009 Share Posted February 15, 2009 'Folk' If you're getting \'Folk\', then you need to use stripslashes() Link to comment https://forums.phpfreaks.com/topic/145259-solved-need-help-with-cookie/#findComment-762528 Share on other sites More sharing options...
limitphp Posted February 15, 2009 Author Share Posted February 15, 2009 'Folk' If you're getting \'Folk\', then you need to use stripslashes() Thats wierd. On my test machine php 5 with wamp server it works perfectly fine. On the live site php 4 it doesn't work. My web developer is telling me the cookie value is 'Folk', but for some reason on the page its saying the cookie value is \'Folk'\ Do you know why it would do that? I tested to see what value its putting in the cookie...and its putting in 'Folk'. But when I display the value it says its \'Folk\' I don't understand how it can display the wrong value? Link to comment https://forums.phpfreaks.com/topic/145259-solved-need-help-with-cookie/#findComment-762529 Share on other sites More sharing options...
supposedlysupposed Posted February 15, 2009 Share Posted February 15, 2009 PHP automaticaly adds backslashes before all single quotes, double quotes, and backslashes to data that is received through GET, POST, and COOKIE. It's a security feature called Magic Quotes, and can be read about here on PHP's website: http://us3.php.net/manual/en/security.magicquotes.what.php and you can find out even more about it if you wish to google it or something. As KingPhilip said, simply using the function stripslashes() will take away the slashes added by Magic Quotes. Link to comment https://forums.phpfreaks.com/topic/145259-solved-need-help-with-cookie/#findComment-762634 Share on other sites More sharing options...
limitphp Posted February 15, 2009 Author Share Posted February 15, 2009 PHP automaticaly adds backslashes before all single quotes, double quotes, and backslashes to data that is received through GET, POST, and COOKIE. It's a security feature called Magic Quotes, and can be read about here on PHP's website: http://us3.php.net/manual/en/security.magicquotes.what.php and you can find out even more about it if you wish to google it or something. As KingPhilip said, simply using the function stripslashes() will take away the slashes added by Magic Quotes. I see. Thanks guys. Link to comment https://forums.phpfreaks.com/topic/145259-solved-need-help-with-cookie/#findComment-762713 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.