Here is how I am setting the session. Here I am pasting my header.php and here is my action_login.php
if(session_id() == ''){
session_start();
$_SESSION["state_login"]=true;
$_SESSION["realname"]=$row['realname'];
$_SESSION["username"]=$row['username'];
if($row["type"]==0){
$_SESSION["user_type"]="public";
}
elseif($row["type"]==1){
$_SESSION["user_type"]="admin";
}
}
and checking in my header that if session is true then login and replace link logout as:
<?php
session_start();
if(isset($_SESSION["state_login"])&& $_SESSION["state_login"]===true && $_SESSION["user_type"]=="admin"){
?>
Why my code is not working.