you could use houdinis way or alternatively another possibility is to do this.
function userlevel(){
//if submit/login is pressed
if(isset($_POST['Submit'])){
$username = $_POST['username'];
$password = $_POST['password'];
$sql = ("select * from users where username = '".$username."' and password = '".$password."')";
$query = mysql_query($sql) or die (mysql_error()."".);
$result = mysql_fetch_array($query);
$level = $result['level']
switch ($level){
case 1:
//if level 1 user send to admin control page
header ('Location: admin.php');
break;
case 2:
//if intermediate user
header ('Location: intermediate.php');
break
case 3:
//if normal user
header ('Location: public.php');
break;
default:
//if level unknown send user to unknown page
header ('Location: unknownlevel.php');
break;
}
}
//i presume you know about includes etc.... if not look below
//in your template page put this at the top
//NOTE this code will only work if checklevel.php is in the same folder as the template page.
<?php include_once('checklevel.php'); ?>
//then somwhere in your page use this
<?php userlevel(); ?>
// What i done when i used this method was to have the coding for each users page in each case statement and then call this function in a blank page to fill a template page with all the content for the relevant user.
[/code]
Its a bit cheeky as you can effectively put 4 users pages in the one switch without having to have 4 pages server side as it will only display one in the template so therefore saves you a bit of time i think for editing as you only need to edit the html in each case depending on whose page you wish to edit.
PHEW!!! lol i hope this helps you
🙂
Regards Pinky.