Page 1 of 1

Redirecting certain users

Posted: Tue Mar 23, 2004 12:03 am
by squirto28
:?

I have 3 different users and when they log in they are to be taken to a different main menu.
for instance
homepage.com/mainmenu1.php
homepage.com/mainmenu2.php
homepage.com/mainmenu3.php

For instance userlevel field in my database table usertable takes on values from 1-3.

Any suggestions on how to accomplish this???

Posted: Tue Mar 23, 2004 2:46 am
by CoderGoblin
The following code would move the user.

Code: Select all

<?
switch $userlevel {
  case (1):
    header("Location:homepage.com/mainmenu1.php");
    exit;
    break;
  case (2):
    header("Location:homepage.com/mainmenu2.php");
    exit;
    break;
  case (3):
    header("Location:homepage.com/mainmenu3.php");
    exit;
    break;
  default:
    header("Location:homepage.com/errorpage.php");
    exit;
}
?>
It should be noted that header may not be used if you have already output anything. I would recommend you look up header in http://www.php.net for more details.