Re: Re: YA Session Problem

From: Date: Thu, 02 Aug 2001 13:57:03 +0000
Subject: Re: Re: YA Session Problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-60900@lists.php.net to get a copy of this message
On 8/2/2001 12:38 AM this was written: > Show source. > > At a guess, I'd say that $PHPSESSID isn't getting passed around properly... I forgot to add in my last email one... This code can be executed at http://www.fromthduke.com/session/ Here is my source this source is almost identical to what I dealt with earlier with the installation program that used sessions and didn't work: --------- file 1 ----------- <? session_start(); if (!isset($var1)) { session_register("var1"); session_register("var2"); header("location: index.php"); } $var1 = "My var 1"; $var2 = "My var 2"; ?><HTML> <HEAD> <TITLE>Session Page 1</TITLE> </HEAD> <BODY BGCOLOR=#FFFFFF> PHPSESSID: <? echo $PHPSESSID; ?><BR> Var1: <? echo $var1; ?><BR> Var2: <? echo $var2; ?><BR> <FORM ACTION="index2.php" METHOD="POST"> VAR 3: <INPUT TYPE=TEXT VALUE="My Var 3" NAME="myvar3"> <INPUT TYPE=SUBMIT VALUE="go"><BR> </FORM> </BODY> </HTML> --------- file 1 ----------- --------- file 2 ----------- <? session_start(); // start session session_register("var3"); // register var 3 session variable $var3 = $myvar3; ?><HTML> <HEAD> <TITLE>Session Page 2</TITLE> </HEAD> <BODY BGCOLOR=#FFFFFF> PHPSESSID: <? echo $PHPSESSID; ?><BR> Var1: <? echo $var1; ?><BR> Var2: <? echo $var2; ?><BR> VAR3: <? echo $var3; ?><BR> </BODY> </HTML> --------- file 2 ----------- Here is what happens for me: 1. On my mac (using IE 5) when I load this page, the first time it will continually reload because it's hitting the header() function at the top. It will then fail. If I try again, it will "stick" miraculously. On the PC it doesn't have this redirect problem initially. 2. When I submit the form, I got to the second page, the session ID is echoed back the same as the first one, but on my server in the /tmp directory there is a new session ID created with var3 contained therein. It is as if session_start() or session_register() is creating a new session ID automatically. FYI, I tried the suggestion of using session_name(login) as the other gentleman said but that failed to start any session at all no session ID would be echoed back. -- Thomas Deliduka IT Manager ------------------------- New Eve Media The Solution To Your Internet Angst http://www.neweve.com/

« previous php.general (#60900) next »