How can I re-direct unauthorised visitors?

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
08718712060Asked:
Who is Participating?
 
errowsConnect With a Mentor 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
0
 
08718712060Author Commented:
Great,
Its easy when you know how but a quick learning curve. Good fun though :-)
Cheers for your help.

Stu
0
 
icb01co1Commented:
Dont sessions annoy search engines?? Is there another way around this problem?
0
All Courses

From novice to tech pro — start learning today.