Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 28th, 2006, 12:36 PM
Registered User
 
Join Date: Jul 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Redirection file problem

Hey,
Im trying to make a redirection file,so that unauthorized users cannot see an administration section.
Im not quite sure how to go about it though.

Code:
<?php
session_start();
include('conn.php');


"SELECT rank FROM table_users WHERE level =<1";
{ echo "here is the admin section"; }



else {
$redirect = $_SERVER['PHP_SELF']; 
header("refresh:5; URL=../../index.php?redirect=$redirect");

?>
You can see where the code is incorrect, and hopefully get an idea of what i am trying to do, your help would be appreciated.
 
Old August 3rd, 2006, 04:20 AM
Registered User
 
Join Date: Jul 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

anyone?

 
Old August 3rd, 2006, 07:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default

A simple way to do it is if the Admin is logged in you can set a $_SESSION for the admin say the ID, then add this to the top of the pages

session_start();
if (!isset($_SESSION['AdministratorID'])) {
    header("Location:http://www.PageToRedirectTo.com");
}
 
Old August 3rd, 2006, 11:09 AM
Registered User
 
Join Date: Jul 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

no,i wanna have multiple admins thanks anyway.

 
Old August 7th, 2006, 03:47 AM
Registered User
 
Join Date: Jul 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

fixed






Similar Threads
Thread Thread Starter Forum Replies Last Post
URL Redirection Problem rch123 Need help with your homework? 0 June 18th, 2007 11:20 AM
Redirection andyw ASP.NET 2.0 Basics 2 May 29th, 2006 05:23 PM
header redirection problem ronin2307 Pro PHP 2 September 1st, 2004 07:58 PM
Header redirection problem ronin2307 Beginning PHP 1 September 1st, 2004 04:06 PM
Redirection a5xo3z1 Beginning PHP 4 June 19th, 2003 02:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.