Any one can help me my session isn't properly redireted when I set a Session Here My code:
session_start();
include_once 'dbconnect.php';
if (!isset($_SESSION['user_id']))
{
header('Location: profile.php');
}
else{
header('Location: loigin.php');
}
Thankyou I hope any one can help me :)
your code should be like this based on logic..
ob_start();
session_start();
include_once 'dbconnect.php';
if (!isset($_SESSION['user_id'])) // if the session is not set it will redirect to login.php
{
header('Location: loigin.php');
}
else{ // else redirect to profile.php
header('Location: profile.php');
}