I am having a problem with session I have auth script that after
taking the username and password sets the username in the session. The
auth for is included in the page that needs authentication. So after it
authenticates the user it continues to desplay the remader of the page.
My problem is the username is needed in the rest of the page to bring
up the right data. But when it loads the rest of the page I get no
data unless I refresh the page then I get all of the data. Is this the
way sessions works. How can I work around this?
<?
session_start();
$username=$user;
include ("userauth.php"); <--- Calls the login script
include("../inc/dataconf.inc");
More code hear.............
This is the part of the userauth.php script that sets the session
$SCRIPT_URL=getenv("SCRIPT_NAME");
if($LoginCookie) // if cookie exists, check authenticity
{
$authenticated=verify_auth($LoginCookie);
if($authenticated==0) display_loginform();
} else {
$login=login_user($user_name,$password);
if($login==0) display_loginform();
}
// if user has logged in, the script carries on here....
$cookie_var = split("-", $LoginCookie);
// this variable contains who the user is logged in as!
$username = $cookie_var[0];
$user=$username;
session_register('user'); <---Sets session hear
?>