RE: [PHP] cookie problemes (solved with javascript)

From: Date: Tue, 25 Feb 2003 09:29:01 +0000
Subject: RE: [PHP] cookie problemes (solved with javascript)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-137046@lists.php.net to get a copy of this message
I not a expert in javascript but this code is working. I guess it is easy to change some line of code to work for your neads. Kale ________________________________________________________________________ ____ // kale's code ________________________________________________________________________ _____ <? $ID = "kale"; $n_sessid = $ID."_Sessid"; session_start(); $sessid = session_id(); if(isset($Read)){ print $HTTP_COOKIE_VARS[$n_sessid]; } ?> <script language="JavaScript"> function setCookie(name, value) { var the_name = name; var the_value = value; var the_cookie = the_name + "=" + escape(the_value); var the_date = new Date("December 31, 2050"); var the_cookie_date = the_date.toGMTString(); the_cookie = the_cookie + ";expires=" + the_cookie_date; document.cookie = the_cookie; alert("Thanks, now go to the next page."); } </script> <form name="insertCookie" method="post"> <input type="submit" name="Cookie" value="Cookie" onClick="setCookie('<?print $n_sessid;?>', '<?print $sessid;?>')"> <input type="submit" name="Read" value="Read"> </form> ________________________________________________________________________ __________________ // end kale's code ________________________________________________________________________ __________________ -----Original Message----- From: Awlad Hussain [mailto:php@sheridan-phoenix.com] Sent: Tuesday, February 25, 2003 11:15 AM To: kale Subject: Re: [PHP] cookie problemes Hi Kale, I have the same problem with cookie, i would appericiate if you can share the java script code you used to create the cookie and how it solved the problem. -awlad ----- Original Message ----- From: "kale" <kaleonardo@home.ro> To: "Php. Net" <php-general@lists.php.net> Sent: Tuesday, February 25, 2003 7:59 AM Subject: RE: [PHP] cookie problemes > The clock is ok. I write cookie with javascript and read with php. For > moment is the best solution i have. In future i hope to resolve this > problem and i find solution i post it here. Thanks for help. > kale > > -----Original Message----- > From: Gonzo [mailto:gonzo-list@nullcraft.com] > Sent: Monday, February 24, 2003 8:11 PM > To: kaleonardo@home.ro > Cc: php-general@lists.php.net > Subject: RE: [PHP] cookie problemes > > > > $path = "/"; > > $domain = ".mydomain.ro"; > > And in my cookie folder i find a cookie named: > > myuser@mydomain[1].txt But other computer (with > > problems) i don't have any cookie with same name. > > And if i reload the page and print $HTTP_COOKIE_VARS[$n_sessid] it's > > nothing. I have 12 computers and 10 are ok. > > Check the clocks on the 2 machines that do not have the cookies. > > Gonzo > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#137046) next »