This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!

Samuel Martin

+ Follow
since Feb 12, 2020
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Samuel Martin

The first thing I'd like to ask is that you be gentle with me, I haven't written any PHP in a long time.

With that out of the way, here's my problem; I need to password protect some pages on a website I'm administering. It's a Drupal 8 site but none of the available modules work for me, unfortunately, so I thought I'd just a little PHP script because what I need is fairly simple.

Here's the logic of what I want;

- If the url = (or if there's anything after that slash)

- Check if session is set

- If yes - allow access

- If no - send to login page

- If password correct - set session and allow access

It's simple because of the way the website works (I didn't set this up). There's one password and everyone who needs to know it, knows it, and if they enter it, they should get access to the whole members section.

So, this is my current script (brace yourself, it's ugly);

I've also been trying to dump out the session data but even that doesn't work. Probably because this script is just all wrong.
1 week ago