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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Neil Zanella

    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?scr ipt.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.p hp

    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
Working...