I attempted to create a members only area, When I try to register,
http://fixmysite.us/masterasp/register.php
The link to sign up works, however when I try to login
http://fixmysite.us/masterasp/login.php
The same link to sign up doest work (I guess the variable $IsUserLoggedIn is faslse)
Here is the code setting that variable is the user is sucessfully logged (in my header.php file)
PHP Code:
<?php
// Run a quick check to see if we are an authenticated user or not  
// First, we set a 'is the user logged in' flag to false by default.  
$isUserLoggedIn false;  
$session session_id();
$query "SELECT * FROM users1 WHERE session_id = '".$session."' LIMIT 1";  
$userResult mysql_query($query) or die ("Error in query: $query. ".mysql_error()); 
if(
mysql_num_rows($userResult) == 1){  
    
$_SESSION['user'] = mysql_fetch_assoc($userResult);  
    
$isUserLoggedIn true;
    echo 
"<span>Welcome ".$_SESSION["user"]["username"]."</span>"
    echo 
"<ul>";
    echo 
"<li><a href=\"/masterasp/logout.php\">Logout</a></li>";
    echo 
"</ul>";
} else {  
    echo 
"<ul>";
    echo 
"<li><a href=\"/masterasp/login.php\">Login</a></li>";
    echo 
"<li><a href=\"/masterasp/register.php\">Register</a></li>";
    echo 
"</ul>";
}
?>

Here is my code for become_a_provider.php.
PHP Code:
<?php if($isUserLoggedIn) { ?>
<h2>Become a provider</h2>
.....
<?php } else { ?>
<p>In order to become a provider, you must be logged in.  Reqistration is free and takes only a second,  <a href="../register.php">register</a> or <a href="../login.php">login</a>.</p>
<p align="center"><img src="../images/sad.jpg" alt="I'm sad" class="result"></p>
<?php ?>
I dont understand why that variable is true upon registration, but not on the login screen
shouldn't it be?