<?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');






$data = findQuery('SELECT * FROM tbl_challenge WHERE status=0 AND CURDATE() between challenge_startdate and challenge_enddate');





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



if ($checking) {
    $showdistrict_assembly = $checking[0]['showdistrict_assembly'];

    $Appversionnumber = $checking[0]['version'];
    $Appstorehider    = $checking[0]['hideforappstore'];
    $hideforappstore  = 0;

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

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






if ($data) {
    for ($i = 0;$i < count($data);$i++) {
        $message = 'true';

        $data2[] = [


            'id'                    => $data[$i]['id'],
            'challenge_image'       => 'https://kozhikodechcentre.in//Challenge/upload/' . $data[$i]['challenge_image'],
            'showdistrict_assembly' => $showdistrict_assembly,


            ];
    }
} else {
    $message = 'false';
    $data2[] = [



                        'showdistrict_assembly' => $showdistrict_assembly,


                        ];
}

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

return;

?>

