Hello. Im trying to achive a login script. If it detects im logged in, I would like it to include a members page. If it does not detect im logged in I would like it to include the login page. Ive tryed playing around with it, but cant get it working at all.
This bit works perfectly dispaying the echo, of the correct message to the user. The bit I cant do is the includes bit, I tryed the following.
Im a complete novice at PHP, go easy on me
Code:
<?PHP
error_reporting(0);
$var = 0;
session_start();
if(session_is_registered('username')){
$var = 1;
echo 'Welcome, you are still logged in.';
}
else{
$num = 0;
echo 'Welcome, guest.';
}
?>
This bit works perfectly dispaying the echo, of the correct message to the user. The bit I cant do is the includes bit, I tryed the following.
Code:
<?PHP
if($var = ('1')){
include("members.php");
}
else{
include("login.php");
}
?>
Im a complete novice at PHP, go easy on me