Limmat/admin/authentication.php

42 lines
1.2 KiB
PHP
Raw Normal View History

2025-01-07 03:45:35 +01:00
<?php
if(isset($_SESSION['auth']))
{
if(isset($_SESSION['loggedInUserRole'])){
$role = validate($_SESSION['loggedInUserRole']);
$id = validate($_SESSION['loggedInUserID']);
if($role != 'admin'){
logoutSession();
redirect('../index.php', 'Zugriff verweigert', 'danger');
}
$query = "SELECT id, status, userid FROM tbl_admins WHERE id='$id'";
$result = mysqli_query($conn, $query);
if($result) {
if(mysqli_num_rows($result) == 0){
logoutSession();
redirect('../index.php', 'Zugriff verweigert', 'danger');
}
else{
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
if($row['status'] == 'disabled'){
logoutSession();
redirect('../index.php', 'Das Konto ist deaktiviert', 'danger');
}
}
}
else{
logoutSession();
redirect('../index.php', 'technischer Fehler', 'danger');
}
}
else
{
redirect('../index.php', 'Zugriff verweigert', 'danger');
}
}
else
{
redirect('../index.php', 'Bitte melde dich zuerst an', 'warning');
}
?>