<?php
// Session শুরু
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

// Database তথ্য
$SERVER   = "localhost";
$USERNAME = "root";
$PASSWORD = "";
$DB       = "shop";

// Database connect
$con = mysqli_connect($SERVER, $USERNAME, $PASSWORD, $DB);

// Connection check
if (!$con) {
    die("<div class='text-danger text-center h5'>
        Oops, Unable to connect with database!
    </div>");
}

// Login check
if (isset($_GET['action']) && $_GET['action'] == 'is_logged_in') {

    $query  = "SELECT IS_LOGGED_IN FROM admin_credentials LIMIT 1";
    $result = mysqli_query($con, $query);

    if ($result && mysqli_num_rows($result) > 0) {

        $row = mysqli_fetch_assoc($result);
        echo $row['IS_LOGGED_IN'];

    } else {

        echo "setup";
    }
}
?>