<?php
header('content-type:application/json');
if (isset($_GET['url'])) {
    include($_SERVER['DOCUMENT_ROOT'] . "/API/connection/business-conn.php");
    $url = isset($_GET['url']) ? $_GET['url'] : '';
    $check = mysqli_query($business_conn, "SELECT UniqueId FROM businesses_account WHERE Domain='$url'");
    $affected_row = mysqli_affected_rows($business_conn);
    if ($affected_row > 0) {
        $statusCode = 200;
        $time = time() + 10;
        while ($spec = mysqli_fetch_assoc($check)) {
        $_SESSION['UniqueId'] = $spec["UniqueId"];
        }
        $res = mysqli_query($business_conn, "UPDATE businesses_account set LastLogin='$time' WHERE Domain='$url'");
    } else {
        $statusCode = 1063;
    }
    $resultData = array('code' => $statusCode, 'uniqueid' => $_SESSION['UniqueId']);
    echo json_encode($resultData);
}
