adzie Posted January 10, 2008 Share Posted January 10, 2008 Hi people, I'd like to a further user level to the login script but i'm hitting a brick wall and was hoping someone might have some more insight.. I'd like another user level called trainee.. but would like the admins and supervisors to be able to see the same profiles as the trainee, for example below, the admins can see the supervisors pages thanks for your help $username = $_POST['username']; $password = $_POST['password']; $sql = "select * from members where name='$username' and pass='$password'"; $rs = mysql_query($sql,$conn); $num = mysql_numrows($rs); $row = mysql_fetch_array($rs); if($num != 0) { if($row['admin'] == 1) { session_start(); if($row['supervisor'] == 1) { $_SESSION['supervisor'] = 1; } $_SESSION['online'] = 1; $_SESSION['admin'] = 1; $_SESSION['office'] = $row[4]; $_SESSION['id'] = $row[0]; header("Location: index.php"); exit; } else if($row['supervisor] == 1) { session_start(); $_SESSION['online'] = 1; $_SESSION['supervisor'] = 1; $_SESSION['office'] = $row[4]; $_SESSION['id'] = $row[0]; header("Location: index.php"); exit; } else { session_start(); $_SESSION['online'] = 1; $_SESSION['id'] = $row[0]; header("Location: index.php"); exit; } Quote Link to comment Share on other sites More sharing options...
cunoodle2 Posted January 10, 2008 Share Posted January 10, 2008 Couldn't you just nest another if statement in the above to allow the admin to view their profile? Or create a new if statement and basically just say...if trainee OR admin then you can view all this... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.