I need to build an extremely simple, single user authentication system. It’s for an admin backend, and I only need a single user account to be able to access it. I’d rather not have to create a “Users” database. Since there is only a single user it could even be JUST a password
(no need for a username). A javascript alert window would be a nice place to enter this info.
I’ve seen it before on vendors “Review” servers…how best to implement this?
Thanks!
For each page that needs authentication, you could use the session to see if the user was authenticated or not, and if not, redirect him to the authentication page.
For example, if you had an admin.php page that needed authentication, you could begin with:
Then, authenticate.php can be a simple script that asks for the password. If the password is correct (
if ($_POST['password'] == "secret")), it simply sets$_SESSION['authenticated'] = true.