469,924 Members | 1,429 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,924 developers. It's quick & easy.

PHP and Mozilla: Mozilla bug? cookie problem and how I solved it

Hello,

I just ran into an interesting problem with cookies while
using PHP 4 and Mozilla 1.6. Basically, I have been using
PHP on a site called:

foo.bar.net?script.php

Within that script I call setcookie() and manipulate
cookie variable $_COOKIE['username']. All works fine
as far as what is produced in the HTML output.

However, it so happens that when I logged into the
provider's web page, which happens to be called

bar.net?login.php

the provider stores a cookie called $_COOKIE['username'].

So then mozilla uses the wrong cookie indexed under
Mozilla -> Edit -> Preferences -> Privacy & Security -> Cookies
-> Manage Stored Cookies

It ends up using $_COOKIE['username'] from site bar.net
instead of $_COOKIE['username'] from foo.bar.net.

Hey, mozilla, if I'm navigating at foo.bar.net, please
use the cookie from foo.bar.net when automatically
filling out my forms, or follow what my correct
html says, but don't use $_COOKIE['username']
from bar.net cause that's my provider's cookie,
not mine, and it's a different one.

People, am I right or am I wrong? Is this a bug in
mozilla? Seems like a bug in mozilla, or, a bug in
PHP, but it really seems like a bug in mozilla since
my PHP output is correct (and uses the value of
$_COOKIE['username'] from foo.bar.net, however
when mozilla fills in the form values, it does
not use what I say in the value attribute of
my input element. Instead, it fills out the
cookie value for bar.net that it stored.

This seems clearly wrong to me. Ideas?
I checked Form Manager in Mozilla, but
saw no such cookie named username there.

So the solution was to prepend foo_ to all my
COOKIES and hope my provider doesn't use them.

Feedback much appreciated,

Thanks,

Neil
Jul 17 '05 #1
0 1528

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by M.D. | last post: by
29 posts views Thread by Jerim79 | last post: by
2 posts views Thread by Gary Hasler | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.