hi…its me again…i try to do login page for manager and user using same page…but…it didnt work…here i submit my code…
[php]
?php
if (isset($_POST[‘login’])){
if (!$_POST[‘username’] || !$_POST[‘userpassword’]) {
$display = " Please Insert User Name and Password";
}
else {
$check_user = “select * from employee where ID =
‘$_POST[username]’ && password = ‘$_POST[userpassword]’”;
$check_user_res = mysql_query($check_user) or die (mysql_error());
if (mysql_num_rows($check_user_res) < 1) //error login
{
$display = " *Invalid User Name and Password.";
}
else {
session_register(“sess_userid”);
session_register(“sessid”);
session_register(“username”);
session_register(“sessname”);
$id = mysql_result($check_user_res, 0, "id");
$name = mysql_result($check_user_res, 0, "fname");
$_SESSION['username'] = $_POST['username'];
$_SESSION['sessname'] = $name;
$_SESSION['sessid'] = $id;
$_SESSION["sess_userid"] = $id;
$sql = “select * from employee where ID = ‘$_SESSION[username]’”;
$query = mysql_query($sql) or die (mysql_error());
$result = mysql_fetch_assoc($query);
$r=$result[‘Designation’];
if ($r == manager) {
header (“Location: manager_page.php”);
}
else {
header (“Location: afterlog.php”);
}
}
}
}
?>
[/php]
it doesn’t separate the page…it only go to afterlog.php page…please help…thanks in advanced…