You are here: Re: setcookie() help please « All PHP « IT news, forums, messages
Re: setcookie() help please

Posted by - Dazed on 04/10/06 07:08

- Dazed <user@name.com> wrotc:

>when I call set_css_color.php by:
>code:
>$colorloc = "".getenv('REQUEST_URI')."";
>echo"<a
>href=\"$DOCUMENT_ROOT/set_css_color.php?color=gray&url=$colorloc\">gray</a>\n";
>
>and the contents of set_css_color.php is:
><?
>$colorcookietime=time()+(3600*24*356);
>$cookiepath="/";
>setcookie("CSS_COLOR", $color, $colorcookietime, "$cookiepath");
>header("Location: $url");
>?>
>
>the value of the cookie seyt is "gbyy" instead of "gray"
>
>If I call it by:
>code:
>$colorloc = "".getenv('REQUEST_URI')."";
>echo"<a
>href=\"$DOCUMENT_ROOT/set_css_color.php?url=$colorloc\">gray</a>\n";
>
>and the contents of set_css_color.php is:
><?
>$colorcookietime=time()+(3600*24*356);
>$cookiepath="/";
>setcookie("CSS_COLOR", "gray", $colorcookietime, "$cookiepath");
>header("Location: $url");
>?>
>
>the value of the cookie set is "gray", as expected
>
>Can anyone shed a clue as to why the cookie gets set to "gbyy" in the
>first example instead of "gray"?
Found a fix;
changed:
set_css_color.php?color=gray&url=$colorloc
to
set_css_color.php?newcolor=gray&url=$colorloc

and changed:
setcookie("CSS_COLOR", $color, $colorcookietime, "$cookiepath");
to
setcookie("CSS_COLOR", $newcolor, $colorcookietime, "$cookiepath");

 

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

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