Solved

How can I re-direct unauthorised visitors?

Posted on 2003-10-27
3
198 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to fix Datetime in MySQL? 4 47
PHP breaks when used in Wordpress template file 3 28
Undefined variable problem 5 21
ajax to record click 3 15
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…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

792 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