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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]