Home › Forums › Back End › access the admin panel page only if logged in › Reply To: access the admin panel page only if logged in
November 27, 2013 at 2:02 am
#157220
Participant
While checking the user credentials while log in set a session variable if the user credentials are valid.. Then on the admin panel page check if the session variable is set or not ? If it is set then show the admin page or else redirect the user to the login page.
<?php
if(isset($_SESSION['user'])){ header('Location : adminpanel.php'); else header('Location : login.php'); }
?>
Put this code in the admin panel page start.