"What session_start does is looks for an existing session, and if none exists"
This is the rub right here: There IS a session already started when the user logs in. The variables that are registered in this session, have NO WAY for the user to deleted/overwrite/ or any such thing on subsequent pages.
Here is some code for you to look at:
This code starts the session after the user logs in::
<?
require_once("ipp_fns.php");
session_start();
if (@$username && $password && $server_num)
{
if (login($username, $password, $server_num))
{
$server_num = $server_num;
$valid_user = $username;
session_register("valid_user");
session_register("server_num");
do_html_header(" ");
}
else
{
echo "You could not be logged in. Try to login again.";
exit;
}
check_valid_user(); //This function sets the registered variables as global
$permissions = get_rights($valid_user, $server_num);
if ($permissions < 1)
{
echo "This account has been disabled.<p>";
exit;
}
}
This next code is on a subsequent page where the variables for session started above should be available::
<?
require_once("ipp_fns.php");
session_start();
//------------------------LOG PAGE ACCESS-----------------------
$file = "e:/httproot/php-bin/post_pic.php";
$page_size = filesize("$file");
$page_get = "$file";
log_page($page_get, $page_size);
//---------------------------------------------------------------------
do_html_header(" ");
check_valid_user();
$userid = get_userid($valid_user, $server_num);
$permissions = get_rights($valid_user, $server_num);
if ($permissions < 3)
{
do_html_header("Access Denied:");
echo "You do not have the proper access rights to view this page.<p>";
exit;
}
$tree_name = tree_name($server_num);
?>
As you can see, $valid_user and $server_num are the registered variables that have been made global by the check_valid_user() funtion:
//-------------------Here is the check_valid_user() function -----
function check_valid_user()
{
global $valid_user, $server_num;
if (session_is_registered("valid_user") && session_is_registered("server_num"))
{
echo "<table border=0 width=100%>";
echo "<tr><td align=right>Welcome <b><font color=\"#6666cc\">$valid_user</font></b>.<br>";
echo "</td></tr></table>";
}
else
{
do_html_heading("You must Login");
echo "You are not logged in. Please click the login link on the main page to access this resource.<br>";
exit;
}
}
//---------------------------------------------------------------------------------
So by being registered variables for the session they should be available by simply calling the variable on the next page. For some reason the session is "dying" before it gets to the next page, which was not happening before. As stated above, the links to the subseqent pages are within another frame, but that has never bothered the session up to this point. I also stated above that the only thing to change was the code to present the links (some javascript)....
I dont know if this makes it any clearer.