Problem with Firefox/Mozilla and Cookies.

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am having a problem with my program which only happens when using
Mozilla or Firefox.
The pages I wrote, are part of a private web directory, a service
offered by the ISP, which upon configuration, restricts its access
only to users registered on the site. So then once the user signs in,
the entry point of the user to my pages, has access to a cookie
(site_<some number>) set by the validation program. I can use the
values in this cookie to retrieve the user_id, and some other code
that I need to query a databata to find out the user access level to
the site (administrator, plain user, etc...). It works fine, the
problem happens if the a user using any of the Mozilla browsers, (1)
Logs on to my site, surf around, and (2) without closing the window
goes somewhere else (e.g.:">, or, and then
(3) again without closing the window comes back to my pages using by
retyping the same URL he used to access my page at the beggining. When
he tries this, the validation system lets him in without any having to
log in again, but I loose all the cookies and session variables,
therefore I no longer know their user_id and code to access the
I checked the browser configuration and the cookies are set to last
until the browser window is closed, but seems like is not doing that.

Here is a snipet of my code that retrieves the cookie:


  $site_cookie = $_COOKIE["site_2400067262"];
  list($u,$l,$md5p,$user_oid,$pref_datetime,$perms_datetime,$pl) =
explode("&", $site_cookie);
  $u_name = split("=", $u);
  $u_login = split("=", $l);
  $u_oid = split("=", $user_oid);
// In case the cookie is not available, save its value in session
  $_SESSION["u_name"] = $u_name;
  $_SESSION["u_login"] = $u_login;
  $_SESSION["u_oid"] = $u_oid;
} else {
// Retrieve the session variables if the cookie is not available
  $u_name = $_SESSION["user_name"];
  echo ("u_name is ".$u_name);
  $u_login = $_SESSION["u_login"];
  $u_oid = $_SESSION["u_oid"];

$isAdmin = false;
if (isset($u_oid[1])){
  $db = mysql_connect("",
"kidswitror_rcp", "allergenfree");
  $result = mysql_query($sql) or trigger_error(mysql_error(),
  while($row = mysql_fetch_array($result, MYSQL_NUM)){
    if (($row[0] == $KWFAAdmin) || ($row[0] == $RecipesInOurDB) ||
($row[0] == $RecipesDBTeam)){
      $isAdmin = true;
$_SESSION['user_name'] = $u_name[1];
$_SESSION['user_login'] = $u_login[1];
$_SESSION['user_oid'] = $u_oid[1];
$_SESSION['isAdmin'] = $isAdmin;
$_SESSION['frompage'] = 'introduction';
$_SESSION['db_result'] = $result_array;
$_SESSION['total_rows'] = 0;
$_SESSION['category'] = '';

So the second time around the site_cookie is no longer availble , and
I fall on the else, but all of the session variable are gone.

Has anyone ever experienced something similar ?

I'd appreciate any help on this.


Re: Problem with Firefox/Mozilla and Cookies. (M.D.) wrote in message

I did not go deeply into your code, but I think that problem in this

Quoted text here. Click to load it

What is "site_2400067262"? Why you checking this? It's doesn't looks
like PHP Session Id. When login - store some login flag in session and
check it every time. But this is not the best way to use SESSIONS for
password protected areas...

Re: Problem with Firefox/Mozilla and Cookies.

Hi Paul,

site_2400067262 is an unique cookie which the isp system set upon the
validation of the user on the system. It contains information about
the user name and user id, which I later use to retrieve some
additional data from the database.
With some further investigation (by echoing session_id()) I found out
that it seems that Mozilla and Firefox sets new session Id everytime
that the user leaves the pages and comes back by retyping the URL on
the address box. So that is why I loose the cookie and any session
varible that I set.
So my problem is that the mozilla based browsers do not retain the
same session_id.

Any suggestion on how to get around this ?


M.D. (Paul Yanchenko) wrote in message
Quoted text here. Click to load it

Re: Problem with Firefox/Mozilla and Cookies. (M.D.) wrote in message

Quoted text here. Click to load it

What's about expiration date in cookies, setted by ISP? In
mozilla/firefox you can watch particual cookie.

Re: Problem with Firefox/Mozilla and Cookies. (Paul Yanchenko) wrote in message
Quoted text here. Click to load it

The expiration date on them are set to "at the end of the session"

Re: Problem with Firefox/Mozilla and Cookies. (M.D.) wrote in message
Quoted text here. Click to load it

   In that case, obviously the problem is with your authentication
script. How, could it allow when there is no cookies and no session??
Perhaps you may want to  look at

   Also, you may want to be specific about your browser versions, etc?
Check if it is specifically blocking any cookie values.

  <?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com

Site Timeline