Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HELP, EDITING: How to code a manager and staff page using one login page
07-01-2017, 09:44 PM, (This post was last modified: 07-02-2017, 09:03 AM by Kvngrajih.)
Post: #1
HELP, EDITING: How to code a manager and staff page using one login page
Am tying to create a login page, that Hotel Manager and Staff can login using the same Login page.

This my code


Quote:<?php
include "cor/session_start.php";
if (isset($_POST["LOGIN"]) && $_POST["LOGIN"] =="process"){
include "dbconnect/database.php";
include "function/cleaninjection.php";
$error = false;
//$errmsg = array();
//if ($username !=='admin') {
# code...
//}
$username = mysqli_real_escape_string ($connect,$_POST["username"]);
//$email = $_POST["email"]; $_POST['username']);

$password = mysqli_real_escape_string($connect,$_POST["password"]);


//$username = strtoupper(



if (empty($username) || empty($username)) {
$error = true;
$usernamerr = "empty Username/Email and Password";
}else{
$staff_type_check = "SELECT * FROM staffs WHERE staff_type = '$username' AND email = '$username' AND username = '$username' AND password = '$password'";
$staff_type_exit = mysqli_query($connect,$staff_type_check);
$staff_type_result = mysqli_num_rows($staff_type_exit);
//echo $staff_type_result;

if ($staff_type_result == 1){
$check_manager = "SELECT * FROM staffs WHERE staff_type = 'manager' AND email = '$username' AND username = '$username' AND password = '$password'";
$manager_exit = mysqli_query($connect,$check_manager);
$manager_result = mysqli_num_rows($manager_exit);

if ($manager_result > 0){
$username = $_SESSION['manger'];
header("Location: check.php?rdir=Welcom_manager");

}elseif{
$check_staff = "SELECT * FROM staffs WHERE staff_type = 'staff' AND username = '$username' AND email = '$email' AND password = '$password'";
$staff_exist = mysqli_query($connect,$check_staff);
$staff_result = mysqli_num_rows($staff_result);

if ($staff_result > 0){
$username = $_SESSION['staff'];
header("Location: receptionist.php?rdid=Welcom_staff");
}

}else{
echo "Sorry! you are not Qualify for this page as and admin";
}

}
}



}

if(isset($usernamerr)) echo $usernamerr."<br/>";
?>


Please help me out. I use Enum to collect the Staff_type (manager and staff)


Attached Files Thumbnail(s)
   
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)