📄 index.php

Size: 1,143 bytes
Path: /home/islandholiday/public_html/admin/index.php
Modified: 2025-01-11 18:17:21
<?php ob_start(); ob_flush(); //session_set_cookie_params('','/','localhost',true,true);
    session_start();
    spl_autoload_register('splAutoLoader');

function splAutoLoader($className){
    $path="panel/assets/classes/"; //path to classes folder
    $extensation = ".classes.php"; //file extensation for the files in classes folder
    $fullpath = $path.$className.$extensation;

    if (!file_exists($fullpath)) {
        return false;
    }

    include_once $fullpath;

}
include_once "panel/assets/includes/functions.includes.php";
session_regenerate_id(true);

#===================check if login sessions are set===========
if (isset($_SESSION['HTTP_USER_AGENT']) && isset($_SESSION['userNumber']) && isset($_SESSION['userRole']) && isset($_SESSION['SESSION-KEY'])) {
    # ====the check for validity 
        $login = new Login();
        $login_check = $login->checkLogin($_SESSION['HTTP_USER_AGENT'],$_SESSION['userNumber'],$_SESSION['SESSION-KEY']);
        if ($login_check['success']==1) {
            header("Location:panel/");
        }else{
            header("Location:Login/");
        }

}else{
    session_unset();
    session_destroy();

    header("Location:Login/");
}
?>