<?php
include($_SERVER['DOCUMENT_ROOT'] . "/attendance/attendance-mobile-api/connection/business_conn.php");
header('content-type:application/json');

$PassKey = $_GET['PassKey'];
$DeviceName = $_GET['DeviceName'];
$BusinessId = $_GET['BusinessId'];



$query = mysqli_query($conn, "SELECT * FROM businesses_account WHERE Businessid='$BusinessId'");
while ($spec = mysqli_fetch_assoc($query)) {
$businessname = $spec['BusinessName'];
$businessid = $spec['BusinessId'];
$_SESSION['UniqueId'] = $spec["UniqueId"];
}
$UniqueId = $_SESSION['UniqueId'];

$sql = "SELECT * FROM businesses_devices_for_attendance WHERE BusinessId='$BusinessId' AND pass_key = '$PassKey'";
$query = $conn->query($sql);
if ($query->num_rows < 1) {
    $resultData = array('status' => false, 'message' => 'This device has already been registered, please use another!');
}else{
    $resultData = array('status' => true, 'businessname' => $businessname, 'results' => "Data");
   
}
echo json_encode($resultData);
