NationStates Jolt Archive


PHP help

E-n-g-l-a-n-d
25-04-2005, 19:05
I have made a website, complete with a login/logout function. How can i stop people from just typing the address into the url bar for the members page, and automatically redirect them?

Many thanks

Rob (E-N-G-L-A-N-D)
Iztatepopotla
25-04-2005, 19:27
Include a function at the top of each page to see if they are logged in, and if not redirect them to the log-in page.
Pure Metal
25-04-2005, 19:29
well this isn't PHP help, but...
if your ISP supports any kind of security you should be able to configure a password-protected folder into which you put your home page (and have a login button on the index page)
this way, all the parts of the site you want to keep protected are in the protected folder and even if people navigate straight to a page within that folder, it will still require a password.

i do this by going to my ISP's control panel for the domain i'm working on, select security settings, and set up a protected folder (one i've already created and uploaded to the server). then i upload a users.txt as the members list (with the syntax username=password) to the private folder. then go back to the control panel, link the users.txt with the protected folder and thats it :)
its simple, basic and not very sophisticated protection, but it works for every page/file within the protected folder. i suppose it depends whether your ISP has any similar facilities

hope that helps