The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End access the admin panel page only if logged in

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #157189

    I have the secure log-in form ready for the admin panel of my site. But its useless because i can just go to the directory of the admin panel page. How can i make the admin panel accessible only when the user is logged in?


    You need to check the user’s credentials on the admin page itself.

    Kick them out if they’re not logged in.


    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.

    if(isset($_SESSION['user'])){ header('Location : adminpanel.php'); else header('Location : login.php'); }

    Put this code in the admin panel page start.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.