I am experiencing some issues with php, on my localhost. I receive a err_too_many_redirects error from my browser.
I am recieving this error when I am trying to direct a user from accessing information from a different place on the web server.
Here is the code:
<?php
session_start();
if(isset($_SESSION['valid'])) {
$loggedIn = $_SESSION['name'];
if($loggedIn != basename(getcwd())) {
echo "You are in the wrong place.";
$url = '../../users/' . $loggedIn . '/index.php';
header('Location: ' . $url);
} else {
echo "Hello";
}
} else {
$url = 'index.php';
header('Location: ' . $url);
}
?>
Can someone please explain to me why it is doing this? I have tried multiple things such as re-arranging the order of the process.
Can someone please help me?