Re: cookies on localhost WinXP

From: Date: Wed, 30 Jul 2003 20:55:28 +0000
Subject: Re: cookies on localhost WinXP
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-157600@lists.php.net to get a copy of this message
"Cpt John W. Holmes" <holmes072000@charter.net> wrote in message news:016b01c356da$6603f320$a629089b@TBHHCCDR... > From: "Steve Buehler" <steve@ibapp.com> > > hmmmmm. Looks like on my localhost I can't seta cookie like this: > > setcookie ("coach_access[login_id]", > > "coach",0,"/","$cookhost"); > > if I change it to just: > > setcookie ("coach_access_login_id", > > "coach",0,"/","$cookhost"); > > it will work. But then my script won't work without a lot of re-writing > > because it uses $coach_access[login_id] instead. Any help here? Am I > just > > doing something wrong? I can't set it with the following either. > > header('Set-Cookie: coach_access[login_id]=coach'); > > But can as: > > header('Set-Cookie: coach_access_login_id_=coach'); > > but again, I would have to re-write a lot of script. > > You'd be better of if you re-wrote your code to make it correct, but you > could just put: > > $coach_access['login_id'] = $_COOKIE['coach_access[login_id]']; > > Please don't tell us that you're storing login IDs in a cookie and actually > depending upon them for anything?? Um, why not? I do it all the time, and if there is some security issue or other reason to not do it I'd like to know so I can change my style in the future. I generally create a random hex string 40 chars long and store it as a cookie called loginid. -- Rob > > ---John Holmes... >

« previous php.general (#157600) next »