<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Content-Type');
require_once('../lib/dbclass.php');










$checking = findQuery('SELECT * FROM `settings`');



if ($checking) {
    $Appversionnumber = $checking[0]['version'];
    $hideforappstore  = 0;

    if ($_REQUEST['version']) {
        $version = $_REQUEST['version'];

        if ($version == $Appversionnumber) {
            $hideforappstore = '0';
        } else {
            $hideforappstore = '1';
        }
    }

    $expiry  = date('Y-m-d', strtotime($checking[0]['enddate']));
    $today   = date('Y-m-d');
    $expired = 0;



    if ($expiry < $today) {
        $expired = 1;
    }



    $data2[] = [
                              'Appversionnumber' => $Appversionnumber,
                              'hide'             => $checking[0]['hide'],
                              'expired'          => $expired,
      'hideforappstore'                          => strval($hideforappstore),
                              ];

    $message = 'True';





    echo json_encode(['Status' => $message, 'data' => $data2]);

    return;
}













echo json_encode(['Status' => $message, 'data' => $data2]);

return;
?>	   
