|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-01-22 14:20 UTC] sniper@php.net
[2005-02-03 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 01 16:00:02 2025 UTC |
Description: ------------ Followed basic instruction in php documentation for setting cookies. Gave in to standards compliant browsers only, but with code below, cookies work in IE6.0 and Opera but not in Netscape 7.1 or Firefox 1.0. Adding the path, domain, and secure using code identical to Manual causes it to fail in IE as well. Would be nice if this basic function would work for all standards complaint browsers? Page uses ob_start(), session_start() and no header output before call to SetMyCookie. Server is Apache 1.3.33 (Unix). Reproduce code: --------------- Function SetMyCookie($db, $login, $pwd){ if ($db == "" and $login == "" and $pwd == ""){ setcookie("login", "", time() - 3600);//fails in netscape setcookie("password", "", time() - 3600); setcookie("db", "", time() - 3600); }else{ setcookie ("login", $login, time() + 60*60*24*1800); setcookie ("password", $pwd, time() + 60*60*24*1800); setcookie ("db", $db, time() + 60*60*24*1800); } } Expected result: ---------------- Three cookies are set with name login, password, db and values $db, $login, and $pwd set to expire in 1800 days. Cookies visible in the current domain folder. If SetMyCookie is called with empty params, then cookies, with name login, password, and db are deleted from current domain folder. Actual result: -------------- Cookies not set or deleted in Gecko based browsers.