lex1000 Posted March 5, 2008 Share Posted March 5, 2008 I've been doing some PHPBB integration work. Basically I'm setting the cookie 'phpbb2mysql_sid' with zope/python. According to firefox the cookie is populated, but according to php it is empty. in firefox:- Name phpbb2mysql_sid Value "15037053A3Q79VO11u4" print_r($_COOKIE) in php Array ( [__utmz] => [__utma] => [phpbb2mysql_data] => a:2:{s:11:\"autologinid\";s:0:\"\";s:6:\"userid\";i:-1;} [__ac_name] => [seen-warning] => [preview_mode] => [mode] => [__ac] => [phpbb2mysql_sid] => [_ZopeId] => ) 1 Zope/python quote encloses cookie values, and that's something I can't change. So my first thought was 'this is magic quotes'. I've tried it with magic_quotes_gpc on and off. But it makes no difference. I've got another build on another server with the same zope/python/phpbb integration work applied. On this server it all works as expected, phpbb reads the session cookie and is logged on. While the 2 boxes are both lynux/apachie they have been build by different people (neither of which was me). The box on which it works is running php 5.2.5 (and has magic_quotes_gpc turned on). The box on which it doesn't work is running 5.2.0. Does anybody have any idea why php isn't recognising the cookie's value. Lex. Link to comment https://forums.phpfreaks.com/topic/94472-php-not-reading-cookies/ Share on other sites More sharing options...
redarrow Posted March 5, 2008 Share Posted March 5, 2008 if you dont show your code how can we help please.............. if cookies dont work use session there safer and better mate....... I dont agree that php cookie dont work, it the programmer that programs them wrong not php read up on cookies agin as we all do for refrence sake....................... http://www.w3schools.com/php/php_cookies.asp did you set the cookie correctly? Link to comment https://forums.phpfreaks.com/topic/94472-php-not-reading-cookies/#findComment-483771 Share on other sites More sharing options...
lex1000 Posted March 7, 2008 Author Share Posted March 7, 2008 if you dont show your code how can we help please.............. if cookies dont work use session there safer and better mate....... I dont agree that php cookie dont work, it the programmer that programs them wrong not php read up on cookies agin as we all do for refrence sake....................... http://www.w3schools.com/php/php_cookies.asp did you set the cookie correctly? redarrow thanks for your reply. The zope/python code that sets the cookie is: resp.setCookie(self.phpbb_pref+'_sid',session_id, path='/') where self.phpbb_pref = 'phpbb2mysql_sid' and session_id = '15037053A3Q79VO11u4' The php code to read the cookie is: print_r($_COOKIE) Firefox's web developer toolbar is telling me the cookie is set, so I can only assume this is correct. Unfortunately there's of legacy president that dictates I use cookies, so switching to session variables isn't an option. I agree php handles cookies. I believe the problem is in the different way zope/python and php deal with cookies. zope/python is very inflexable, php less so. The code works on a different box, so I think its something to do with the way I've got php set I on the second box. Everything I've read says its magic quotes, but turning them on/off doesn't seem to make any difference. I just can't see what I'm doing wrong. Link to comment https://forums.phpfreaks.com/topic/94472-php-not-reading-cookies/#findComment-486091 Share on other sites More sharing options...
PFMaBiSmAd Posted March 7, 2008 Share Posted March 7, 2008 Are you sure that when you are turning magic quotes gpc on that they are actually getting turned on? How are you turning them on? This also sounds like a register globals problem. Is there another program/post/get/session variable with the name phpbb2mysql_sid? Link to comment https://forums.phpfreaks.com/topic/94472-php-not-reading-cookies/#findComment-486103 Share on other sites More sharing options...
lex1000 Posted April 3, 2008 Author Share Posted April 3, 2008 Are you sure that when you are turning magic quotes gpc on that they are actually getting turned on? How are you turning them on? This also sounds like a register globals problem. Is there another program/post/get/session variable with the name phpbb2mysql_sid? I'm changing the php.ini then restarting apachie. I'm then looking at the phpinfo() to check the value of the magic quotes gpc. I don't think anything other than the cookie has a phpbb2mysql_sid variable, but I'll check. Link to comment https://forums.phpfreaks.com/topic/94472-php-not-reading-cookies/#findComment-508445 Share on other sites More sharing options...
lex1000 Posted April 3, 2008 Author Share Posted April 3, 2008 I've managed to get some more useful information which makes this thread obsolete. I've started a new thread here: http://www.phpfreaks.com/forums/index.php/topic,190781.0.html Link to comment https://forums.phpfreaks.com/topic/94472-php-not-reading-cookies/#findComment-508586 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.