In the table with users there is a type column in which there are only 2 types of admin and user, the handler code presented below checks if it is an admin then redirect to the admin.php page, if another type is different from the first one to the user.php page. log + pass admin redirect is but if the type user gives an error:
No contact!
Warning: session_start (): Cannot send session cache limiter - headers already sent (D: \ OSPanel \ domains \ regrole \ do_login.php: 24) in D: \ OSPanel \ domains \ regrole \ do_login.php on line 14
Warning: Cannot modify header information - headers already by (output started at D: \ OSPanel \ domains \ regrole \ do_login.php: 24) in D: \ OSPanel \ domains \ regrole \ do_login.php on line 22
include('connect.php'); if(isset($_POST["submit"])){ $email=$_POST["txtemail"]; $pass=$_POST["txtpass"]; $query=mysqli_query($con,"SELECT email,pass,type FROM users"); while($row=mysqli_fetch_array($query)){ $db_email=$row["email"]; $db_pass=$row["pass"]; $db_type=$row["type"]; if($email==$db_email && $pass==$db_pass){ session_start(); $_SESSION["email"]=$db_email; $_SESSION["type"]=$db_type; if($_SESSION["type"]=='admin'){ header("Location:admin.php"); } else header("Location:user.php"); }else echo("Нет контакта!"); } }