I have a database and inside the database i have a user with a user type as admin.
As soon as i created a new user with user type member i was unable to login on my login page.
It gave me an error saying that :
localhost redirected you too many times.
PHP Code:
<?php
//checks if login session variable exist? If it does, display Logout
session_start();
if (isset($_SESSION['login']) && $_SESSION['login'] != "") {
//link to page logout.php and displays the word Logout + username
echo "<li><a href='logout.php'>Logout " . $_SESSION['login'] . "</a></li>";
if (isset($_SESSION['login']) && $_SESSION['usertype'] != "admin") {
echo ("<li><a href='profile.php'>Profile</a></li>");
} else {
echo ("<li><a href='AdminPage.php'>Administrator</a></li>");
}
if ($_SESSION['login'] == "") {
header("Location:login.php");
}
if ($_SESSION['login'] != "" && $_SESSION['usertype'] == "member") {
header("location:home.php");
}
} else {
//else link to pagelogin.php and display the word Login
echo ("<li><a href ='pagelogin.php'>Login</a></li>");
}
?>
Also have a picture of the login.php codes :

if($_SESSION['login'] == "")to make sure that the location already isn't login.php. - aynber