<?php
include("../../db.php");
error_reporting(E_ALL);
header("Access-Control-Allow-Origin: * ");

    $status = 0;
    $msg    = '';
    $data   = array();

  	    $record = $db->getRows("select * from security ORDER BY id DESC");
  	    
  	    if(count($record) > 1){
	        $status = 1;
  	        $msg = "Data found.";
  	        foreach($record as $datas){
                if($datas['image'] == ""){
                    $image = "";
                } else {
                    $image = "https://$_SERVER[HTTP_HOST]/uploads/security/$datas[image]";
                }
                array_push($data,["id"=>"$datas[id]", "name"=>"$datas[name]", "mobile"=>"$datas[mobile]", "address"=>"$datas[address]", "image"=>"$image", "visit_time"=>"$datas[visit_time]"]);
  	        }
  	    }
  	    else {
  	        $msg    = "No record found.";
  	    }
    


    echo json_encode(array('status' => $status, 'msg'=>$msg, 'data'=>$data));
?>