Admin Panel Cookies - How would I do it?
I am creating an admin panel for my website. I have heard that it is possible to protect it in the following way:
Admins (who should be able to access the admin panel) get a certain cookie.
This cookie then allows them to get into the admin panel when they go to the panel directory.
When anyone else goes to the panel directory, just gets taken back to the homepage, and doesn't see anything on the panel
How would I do this?
Typically this is done via PHP session-handling (e.g. starting with the session_start() function, and when the user logs in, add a setting in $_SESSION to indicate whether they are an admin user. Then on your admin-only pages, your logic would be something like:
<?php // this must be the first line: no output of any kind before it
// rest of page...
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)