Jump to content

PHP not reading cookies


lex1000

Recommended Posts

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

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?

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.

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?

  • 4 weeks later...

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.

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.