You are here: Re: Firefox cookie oddities « PHP Language « IT news, forums, messages
Re: Firefox cookie oddities

Posted by Paul Duffy on 07/25/07 12:18

>
> You're more likely to get a reply if you can reduce your code down to
> something which demonstrates the problem *and* *nothing* *else*
>
> I would suggest you look at the paths on the cookies.
>
> C.

OK, I've tried to shorten it by stripping out the specifics of the code.

This is a test case for when a browser sends a bad cookie ID. At a new
session outputs should only be for $uno, $one, $four, $cookieTime and
$cookieRand (no session cookieID and not stored). Whether it's a new
session or not, Firefox gets $uno, $duos, $one, $five and $six (has session
cookieID and is stored) but not $four, $cookieTime or $cookieRand.

Also, $storedCookie comes back as 1 instead of 0 which should not happen
if the psql query was done before the cookieID was stored.

What's extra confusing is that, otherwise, it behaves as it should, a new
value is inserted into the database, the cookie value held by FF changes
to this new value and all seems well. The only thing I can think of that
could be causing this would be FF calling the page again when a new cookie
is set and reloading it in which case the values would be valid, but this
seems an unorthodox way for a browser to behave and could make debugging
an issue in future.

> CODE (not closed because this is a partial):
>
> <?php
>
> if (is_numeric($_COOKIE["ID"]))
> { Check cookie exists
> $storedCookie = TRUE/FALSE(1/0);}
>
> if (!$_SESSION["cookieID"])
> {
> if ($storedCookie)
set session cookieID
> else
set cookie and session cookieID
> }
> else
> {
> if($storedCookie)
> {
> if ($_SESSION["cookieID"] != $_COOKIE["ID"])
> { $_SESSION["cookieID"] = $_COOKIE["ID"]; }

> Set theme
> }
> else
> {
set new cookie and reset session ID
> }
> }
>

> echo "<!-- Initial cookieID = ".$uno." Initial Serv.cookieID =
> ".$duos." -->
> ";
> echo "<!-- COOKIE['ID'] 1 ".$one." -->
> ";
> echo "<!-- SESSION['cookieID'] 2 ".$two." COOKIE['ID'] 3 ".$three." -->
> ";
> echo "<!-- SESSION['cookieID'] 4 ".$four." -->
> ";
> echo "<!-- SESSION['cookieID'] 5 ".$five." COOKIE['ID'] 6 ".$six." -->
> ";
> echo "<!-- Stored Cookie is ".$storedCookie." -->
> ";
> echo "<!-- SESSION['cookieID'] 7 ".$seven." -->
> ";
> echo "<!-- cookieTime ".$cookieTime." -->
> ";
> echo "<!-- cookieRand ".$cookieRand." -->
> ";

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация