I hope if any one help me with this i try to login admin panel with admin or writer and block the sample user to login it , but When i use this code i have some problem `
if(isset($_SESSION['id'])) {
$sql = mysqli_query($conn, "SELECT * FROM `users` WHERE `user_id` = '$_SESSION[id]' AND `role` = 'admin' OR 'writer'");
if(mysqli_num_rows($sql) != 1) {
header("Location: ../index.php");
}else {
echo '';
}
}else {
header("Location: ../index.php");
}
this code let me to login with only admin and can't login with writer And when i try to but this ('admin' OR 'writer') this also let the sample user login to admin panel, i need help to block user login to this page
Thank
Aucun commentaire:
Enregistrer un commentaire