Re: Sessions just don't work on my machine. (Trying this again)

From: Date: Mon, 24 Sep 2001 16:04:17 +0000
Subject: Re: Sessions just don't work on my machine. (Trying this again)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-68545@lists.php.net to get a copy of this message
I had the exact same problem.. don't know if you had this advice yet or not but what I did is when I started a session I would grab the session id for that session and put it in a variable and then just pass that session id everywhere I went.. turn on the trans_id or add the session id to the end of every link so it gets pass throughout all the links/forms you have on the site. start_session(); $SID = session_id(); That's what I do and then I just pass the $SID on all the links and forms and it works for me. Hope that helps or is at least something new for you to try. jay ----- Original Message ----- From: "Thomas Deliduka" <thomas@neweve.com> To: "PHP List" <php-general@lists.php.net> Sent: Monday, September 24, 2001 10:56 AM Subject: [PHP] Sessions just don't work on my machine. (Trying this again) > I have written here several times on this subject and in the end those who > have gratiously helped me have ended up just telling me they have no clue > why it doesn't work. It HAS to be my server setup but I don't know what it > could be. > > Sessions just don't work on my machine... > > The heart of the problem is the session_start() function. > > The first time you start a session with this function it creates a new > session, that's fine. > > The problem happens when it's run and no matter if the SSID is in a cookie > or passed via a form, it will still create a new session, every single time. > It will not pickup the old session. > > Here is the app I setup to demonstrate the problem: > > http://fromtheduke.com/session/ > > The first page initiates the session, the variable is posted to the next > page, the next page should retrieve the session and display the first two > variables which were registered in the session, then display the third var. > > You'll see the third var showsup, the first two don't. The session ID may > or may not remain the same. If you manually remove the index2.php file and > reload the first page, the SSID will have changed. > > Source of the files: > index.php: > <? > > session_start(); > > session_register("var1"); > session_register("var2"); > > $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> > -------------------------- > > Source of index2.php: > <? > > 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> > -------------------------- > > I have tried session_name() to force the session ID. I was told though this > function doesn't set the SSID. It gives the SSID a name or something. > > I have been told this is all setup correctly, yet, you can see it doesn't > work. > > The permissions on my /tmp directory look like this: > > drwxrwxrwt /tmp > > Does this have anything to do with this? I don't know much about the > permissions part of things. > > -- > > Thomas Deliduka > IT Manager > ------------------------- > New Eve Media > The Solution To Your Internet Angst > http://www.neweve.com/ > > > > -- > 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 (#68545) next »