<?php
session_start();

if (!isset($_SESSION['role'])) {
    echo "Unauthorized access";
    exit;
}

switch ($_SESSION['role']) {
    case 'student':
        header("Location: /rs_lab/student/student_dashboard.php");
        break;

    case 'teacher':
        header("Location: /rs_lab/teacher/dashboard.php");
        break;

    case 'school':
        header("Location: /rs_lab/school/dashboard.php");
        break;

    case 'institution':
        header("Location: /rs_lab/institution/dashboard.php");
        break;

    default:
        echo "Invalid role";
}
exit;