<?php

//$_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT']
if ($_SESSION['admin_login'] != 'true' || !ISSET($_SESSION['user_num'])){
    session_start();
    session_destroy();
    $extra="../index";
    $host=$_SERVER['HTTP_HOST'];
    $uri=rtrim(dirname($_SERVER['PHP_SELF']),'/\\');
    echo '<script type="text/javascript">';
    echo "window.location.href='http://$host$uri/$extra'";
    echo '</script>';
} else {
    $user_id = $_SESSION['userId'];
    $qry = mysqli_query($_app_conn_db, "SELECT * FROM my_admin where id = '$user_id'");
    $dataCount = mysqli_num_rows($qry);
    if($dataCount > 0) {

    } else {
        session_start();
        session_destroy();
        $extra="../login";
        $host=$_SERVER['HTTP_HOST'];
        $uri=rtrim(dirname($_SERVER['PHP_SELF']),'/\\');
        echo '<script type="text/javascript">';
        echo "window.location.href='http://$host$uri/$extra'";
        echo '</script>';
    }
}
?>