Login Redirect for Usergroups

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Assured99
Forum Commoner
Posts: 81
Joined: Wed Jul 12, 2006 11:48 am
Location: California

Post by Assured99 »

ok I understand case sensitivity but heres the thing This code worked fine untill i added this code to the redirect.php

Code: Select all

switch ($_SESSION['group1']) { 
    case 'Users': 
        header("Location: http://www.assuredmedical.com/login/sorry.php"); 
        break; 
     case 'Employees': 
        header("Location: http://www.assuredmedical.com/login/emp ... ployee.php"); 
		break;
     case 'Patients': 
        header("Location: http://www.assuredmedical.com/login/patient/patient.php"); 
     	break;
	 case 'Referrals': 
        header("Location: http://www.assuredmedical.com/login/ref ... ferral.php"); 
		break;
     case 'Administrators': 
        header('Location: http://www.assuredmedical.com/secure/ad ... npage.php'); 
        break; 
     default: 
        header('Location: http://www.assuredmedical.com/login/sorry.php'); 
        break; 
}
?>
Could i use this same code to protect each of the redirected pages????
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

What stopped working?
User avatar
Assured99
Forum Commoner
Posts: 81
Joined: Wed Jul 12, 2006 11:48 am
Location: California

Post by Assured99 »

Sory for the delay,

The Script stopped protecting the protected pages
(the pages with specific user access)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I would verify that the session var you are switching on is being set properly and that the value is of the type and format that you expect.
NiGHTFiRE
Forum Contributor
Posts: 156
Joined: Sun May 14, 2006 10:36 am
Location: Sweden

Post by NiGHTFiRE »

You could just do on all the pages,

Code: Select all

if(!isset($_SESSION['group'])) {
exit them
}
Post Reply