Simple Password Protection +User Settings -Database

I have a page I want to give a small number of people access to and also populate that page with the person’s name and userid. (So I need to get some individual settings.)

Because it’s just one page and not super sensitive I didn’t want to create a complicated login. I realized I don’t even need a database. Just store all the info in a simple array, post the login info to the file where this array lives, verify and return the necessary settings if the login information checks out.

First, here is a simple structure for the array to store login info and settings:

Then just check the credentials that have been posted and get and return the proper settings on success. Below is an example of how you could do something like that:

There could be something I’m overlooking and I am sure this is not bullet proof but it was a quick, 15-minute fix and doesn’t require a database.

One of the final steps merges some default information with the actual login information and returns it as a setting variable so you could log login sessions.