php - how to detect username and password than login to different page -
<?php if (isset($_post["loginbtn"])){ $euser = $_post["emp_username"]; $epassw = $_post["emp_password"]; $check_user = mysql_query("select * employee emp_username = '".$euser."' , emp_password= '".$epassw."'"); if ($row=mysql_fetch_assoc($check_user)){ $_session["loggedin"] = "true"; $_session["eid"] = $row["emp_id"]; // keeps member id in session header("location: profile.php"); // proceeds profile page }else{ ?> <script type = "text/javascript"> alert("invalid username or password"); </script> <?php } } ?>
i think need if condition inside block code:
if (isset($_post["loginbtn"])) { $euser = $_post["emp_username"]; $epassw = $_post["emp_password"]; $check_user = mysql_query("select * employee emp_username = '".$euser."' > , emp_password= '".$epassw."'"); if ($row=mysql_fetch_assoc($check_user)) { $_session["loggedin"] = "true"; $_session["eid"] = $row["emp_id"]; // keeps member id in session if (in_array($row["position"], array("ceo", "manager", "...")) { header("location: profile.php"); // proceeds profile page } } } else { ?> alert("invalid username or password");
Comments
Post a Comment