The index.php is the login page of my website, after logging in successfully. My index.php page doesn't redirect to the Dashboard.php. I have to change it manually from URL. Or i have to login again, then it works correctly. This issue occurred after deploying my website to the server. it is working fine locally. I have used php headers to redirect: login code:
if($result)
{
if (mysqli_num_rows($result) > 0) {
while ($rows = mysqli_fetch_assoc($result)) {
//creating session
session_start();
$_SESSION['Id'] = $rows['user_Id'];
$_SESSION['Name'] = $rows['Name'];
header("location: Dashboard.php");
}
}
After Successful login: my page redirects to the index.php again. as i mentioned above. I logged in successfully because i can access other pages by url.
here is start my index page:
<?php include_once "includes/Functions.php" ?>
<?php
session_start();
if(isset($_SESSION['Name']))
{
ob_start();
header("Location: Dashboard.php");
}
?>