Solved

How can I re-direct unauthorised visitors?

Posted on 2003-10-27
3
196 Views
Last Modified: 2006-11-17
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
0
Comment
Question by:08718712060
3 Comments
 
LVL 2

Accepted Solution

by:
errows earned 250 total points
ID: 9627840
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
 

Author Comment

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

Stu
0
 

Expert Comment

by:icb01co1
ID: 9642125
Dont sessions annoy search engines?? Is there another way around this problem?
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
hasing a url 16 28
php convert date format 3 21
how to use 2 SELECT statements with prepared statements 19 30
showing loader for php/mysql/ajax live search 13 26
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question