Variables do not seem to be registering properly OR being carried through properly in a session.
Here are code snippets from three files: "php.ini", "index.php", and "page2.php"
I included "php.ini" data-handling settings that I think are appropriate.
The code from "index.php" shows (basically) how a session is initialized and then how I attempt to register variables with it.
The snippet from "page2.php" shows (basically) how I try to acknowledge that a variable is registered.
I have tried getting the variable's value using $HTTP_SESSION_VARS, $HTTP_GET_VARS, and $HTTP_POST_VARS with no success.
In all cases, "session_start()" is the first line on the page, preceding any output.
I appreciate any help with what might be happening, here.
PHP v.4.1.2
FreeBSD v.4.3
==== php.ini ====
session.save_handler = files
session.save_path = /tmp
session.use_cookies = 0
session.name = SOMEID
session.auto_start = 1
session.serialize_handler = php
session.use_trans_sid = 0
==== index.php ====
session_start();
session_destroy(); // I have tried not using this, but have had no success
session_name("newsession"); // I have tried putting this line before "session_start()", with no success
login sequence and authentication goes here
if ($loginok) {
then, pull data from db and assign values to variables
after that, use the following to register those variables:
session_register("username");
session_register("firstname");
session_register("lastname");
session_register("uid");
$test1 always says "yes, that variable is registered"
$test1 = session_is_registered('username');
echo $test1;
header("Location: page2.php?id=1");
}
==== page2.php ====
session_start();
this always properly reflects the "newsession" name from "index.php";
echo session_name();
$test2 always says "no, that variable is not registered!"
$test2 = session_is_registered('username');
echo $test2;
==== end code snippets ====
Thank you for any and all help with this!