I understand that this question has been asked multiple times, however I need further clarification and a straight forward answer from someone that can help me please!
On my website which I host through weebly.com, I have a simple login page with a simple HTML script that is basically used to direct traffic to a desired page once they input the correct username and password credentials for their account.
Think of it like this:
Login Page (user enters credentials)
Crew Centre (redirected to this page if they log in successfully)
The reason why I am asking for a solution here is because I have an issue with users at the moment who are just bookmarking the Crew Centre instead of going through and logging in each time via the login page. Is there a way of forcing them to log in?
Does anyone know a HTML script (I would be happy to consider java-script also) that would work to block and redirect users who don’t log in first? I’m after a script that would restrict users who don’t come from a specific page (in this case its the Login page) and as a result they get redirected to a page which I will make saying “You must login first to access this feature.
I just want to reinforce that I’m not after anything secure at all, just something that is simple, this is just for feel and experience.
If anyone requires further clarification on my question, just let me know!
Thank you everyone!
I’m assuming you’re using JavaScript on the login page to check the credentials. If that’s the case, you could set a “signed in” cookie in the same JavaScript, then check for that cookie on the Crew Centre page.
You’ll need to make the cookie go away somehow, too. Either set a short timeout or put JavaScript on the Crew Centre page to remove it.
Here’s some example code: