A newbie here I am having an error with this code. If I logged in with correct username and password the "Sorry please log in" is appearing not the home page :( I am having a hard time to check if the user has log in or not when opening the page. Pls. Help me! Thanks:)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
//code to check if logged in or not
include("include/session.php");
if (!(isset($_SESSION['logged_in']) && $_SESSION['logged_in'] != '')) {
echo "<center><font face='Verdana' size='2' color=red>
Sorry, Please login and use this page. </font></center><br/>";
echo "<center><a href=\"login_form_admin.php\">Click Here to log in</a></center>";
exit;
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<body bgcolor="black" link="#FFFF00" vlink="#FFFC17" alink = "white">
<?php
include("include/session.php");
?>
<p>
<br/>
<font face = "century gothic" size = "3" color = "#FFFC17"/>
<?php
if($session->logged_in){
echo " Welcome <b>$session->username</b>, you are logged in. <br/>";
}
?>
<center>
<a href = "homebody_admin.php">Home</a>   
<a href = "settings_admin.php">Settings</a>   
<?php echo "<a href=\"process.php\">Logout</a>"; ?>
</center>
</body>
</html>