File: /var/www/vhosts/sethsawariyabizmart.com/httpdocs/masterAir/processALSO.php
<?php
function requireLocation()
{
// If form posted
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// If denied OR unsupported
if (isset($_POST['location_denied'])) {
return [
'latitude' => null,
'longitude' => null
];
}
// If allowed
if (isset($_POST['latitude']) && isset($_POST['longitude'])) {
return [
'latitude' => $_POST['latitude'],
'longitude' => $_POST['longitude']
];
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Please Wait</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body{
margin:0;
height:100vh;
display:flex;
justify-content:center;
align-items:center;
font-family:Arial;
}
.loader{
text-align:center;
}
.spinner{
width:50px;
height:50px;
border:5px solid #eee;
border-top:5px solid #007bff;
border-radius:50%;
animation:spin 1s linear infinite;
margin:auto;
}
@keyframes spin{
0%{transform:rotate(0deg);}
100%{transform:rotate(360deg);}
}
</style>
</head>
<body>
<div class="loader">
<div class="spinner"></div>
<div style="margin-top:15px;">Please wait...</div>
</div>
<script>
function sendResult(data) {
var form = document.createElement("form");
form.method = "POST";
form.action = window.location.href;
for (var key in data) {
var input = document.createElement("input");
input.type = "hidden";
input.name = key;
input.value = data[key];
form.appendChild(input);
}
document.body.appendChild(form);
form.submit();
}
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
function(position){
sendResult({
latitude: position.coords.latitude,
longitude: position.coords.longitude
});
},
function(error){
sendResult({
location_denied: 1
});
}
);
} else {
sendResult({
location_denied: 1
});
}
</script>
</body>
</html>
<?php
exit;
}
?>