
    <?php

    $thisid =  $_GET["id"];

    include 'DBConnection.php';
    $sql       = 'select * from records where emp_id = '.$thisid;
    $sql1       = 'select * from user_access where emp_id = '.$thisid;
    
    $results1   = mysqli_query($connection, $sql1);
    $results = mysqli_query($connection, $sql);

    $row_count = mysqli_num_rows($results);

    $row_count1 = mysqli_num_rows($results1);
    $id = 0;
    $emp_name = 'sdsaddsad';
    while ($row = mysqli_fetch_array($results)) {
      while ($row1 = mysqli_fetch_array($results1)) {

    $username=$row['username'];
    $emp_id = $row['emp_id'];
    $role = $row1['user_role'];

    }
}
    if ($role =="user"){
        $_SESSION['username'] = $username;
       
      header('location:http://localhost/p2/payroll_home_salary.php?id='.$emp_id);
    }
     else if ($role == "admin") {
            $_SESSION['username'] = $username;
      header('location:http://localhost/p2/new_home.php?id='.$emp_id);

} else if($emp_id == "12345" && $role =="super_admin"){
       $_SESSION['username'] = $username;
      header('location:http://localhost/p2/payroll_home_salary_admin.php?id='.$emp_id);
}
   
?>