<?php
class router
{
    public static function redirect($location)
    {
        $links = [
            "home" => "modules/mail/all",
            "login" => "user/profile/login",
            "admin_home" => "modules/mail/all",
            "profile" => "user/profile",
            "usermail" => "user/mail/inbox"
        ];

        if (isset($location)) {

            if ($_SERVER['REQUEST_URI'] == "/" . SUBFOLDER . $links[$location] . "/") {
            } else {
                header("Location: /" . SUBFOLDER . $links[$location]);
                die();
            }
        } else {
            header("Location: /" . SUBFOLDER . $links["profile"]);
            die();
        }
    }
}
