How can I re-direct unauthorised visitors?

08718712060
08718712060 used Ask the Experts™
on
I am developing my 1st php solution for my own use (To manage my accounts etc). I am providing users with a username and password which I am validating by checking their data in the relevent mySql tables. This is no problem.

The problem I have is that once they succesfully log in I want to create some sort of identifier that means if they try to go straight to one of the pages without 1st logging in I want them directed back to the login screen.

This project works like a web based control panel.

Cheers in advance
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Use sessions.
When they login, set their username as a session variable.
On every page, test that session variable, if it is not set, redirect the user to the login page.

Good session tutorial:
http://www.zend.com/zend/tut/session.php

Author

Commented:
Great,
Its easy when you know how but a quick learning curve. Good fun though :-)
Cheers for your help.

Stu

Commented:
Dont sessions annoy search engines?? Is there another way around this problem?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial