Re: need help with cookies

From: Date: Thu, 22 Mar 2001 19:01:15 +0000
Subject: Re: need help with cookies
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45183@lists.php.net to get a copy of this message
as allready stated you need to set the cookie before data is outpued, you can override this by editing your php.ini output_buffering = on; on another note, I would use sessions for all this, youve created a tone of code that does almost exactly what sessions can do in a matter of a few lines. -- Chris Lee lee@mediawaveonline.com <kris@grinz.com> wrote in message news:20010322193049.DDB289248@hegel.grinz.com... Hi, I am trying to set a cookie and it doesn't work. I am running IE 5. I have IE set to prompt before setting cookies but I never get a prompt. Here is my code - basically, if someone logs in, it is to set a cookie. What am I missing? Kris if($success==1){ $loginid="$id"; NewSessionID($id); GetProfile($id); $page_title="LTT: $loginid Index"; include("html-head.php3"); if($id==""){ include("ln/ln_ln_dna.php3"); exit; } include("ms/rg1/index.php3"); exit; } function NewSessionID($id){ $sid=""; $length=16; srand((double)microtime()*1000000); $SessPool = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $SessPool .= "abcdefghijklmnopqrstuvwxyz"; $SessPool .= "0123456789"; for($tempslime=0; $tempslime < $length; $tempslime++) { $sid .= substr($SessPool, (rand()%(strlen($SessPool))), 1); } setcookie("LoginAuth", $sid,time()+3600); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#45183) next »