<?php
// Establishing Connection with Server by passing server_name, user_id and password as a parameter
include 'connection.php';
// session_start();
$user_check=$_SESSION['login_user'];
// SQL Query To Fetch Complete Information Of User
$ses_sql=mysqli_query($conn, "SELECT * FROM auth where email='$user_check'");
$row = mysqli_fetch_assoc($ses_sql);
$login_session =$row['email'];
$username =$row['name'];
$created_at =$row['created_at'];
$city =$row['city'];
$phone =$row['phone'];
$profile_photo =$row['photo'];
if(!isset($login_session)){
mysqli_close($conn); // Closing Connection
header('Location: index.php'); // Redirecting To Home Page
}
?>
I am commenting out the session_start()
because I'm already starting the session in another php file that is included.
I can't understand why the the page isn't redirecting properly to the index.php
file.
Uncomment your session start
Also make sure there is no html before you start your session