RE: [PHP] open a new html page

From: Date: Wed, 05 Jun 2002 14:06:54 +0000
Subject: RE: [PHP] open a new html page
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-100704@lists.php.net to get a copy of this message
[snip] is there a simple way to automatically load a new page according to a choice made by a user. If one persons logs in they go to one page, If another peson logs in they go to another page? [/snip] Use a switch statement as below; //start session session_start(); session_register("emailid"); session_register("level"); $dbuser = mysql_fetch_object($dbresult); $emailid = $dbuser->email; $level = $dbuser->accesslevel; //send the user to a page based on their user level switch($level) { case "author": header("Location: myart.php"); exit; break; case "editor": header("Location: editor.php"); exit; break; case "approve": header("Location: approve.php"); exit; break; case "schedule": header("Location: sched.php"); exit; break; case "admin": header("Location: admin.php"); exit; break; default: header("Location: loginfail.php"); exit; } Each type of user is sent to a particular page based on their $level. HTH! Jay

« previous php.general (#100704) next »