How can the PHP code be improved to ensure that users with "Admin" rights are directed to the correct section?

The PHP code can be improved by checking the user's role when they log in and redirecting users with "Admin" rights to the correct section. This can be done by adding a conditional statement that checks the user's role before redirecting them.

// Check if user is logged in and has "Admin" rights
if(isset($_SESSION['role']) && $_SESSION['role'] == 'Admin') {
    header("Location: admin_section.php");
    exit();
} else {
    header("Location: regular_section.php");
    exit();
}