You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
226 lines
7.3 KiB
226 lines
7.3 KiB
<!doctype html>
|
|
<html lang="en">
|
|
|
|
<!-- 主頁header -->
|
|
<?php
|
|
/*--- 處理session ----*/
|
|
include "include-session-security.php"; #確認session
|
|
|
|
include "include-header.php";
|
|
|
|
?>
|
|
<!-- * 主頁header -->
|
|
|
|
<style>
|
|
.form-select {
|
|
display: block;
|
|
width: 100%;
|
|
padding: 0.375rem 2.25rem 0.375rem 0.75rem;
|
|
-moz-padding-start: calc(0.75rem - 3px);
|
|
font-size: 1rem;
|
|
font-weight: 400;
|
|
line-height: 1.5;
|
|
color: #212529;
|
|
background-color: #fff;
|
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
|
|
background-repeat: no-repeat;
|
|
background-position: right 0.75rem center;
|
|
background-size: 16px 12px;
|
|
border: 1px solid #ced4da;
|
|
border-radius: 0.25rem;
|
|
transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
|
|
-webkit-appearance: none;
|
|
-moz-appearance: none;
|
|
appearance: none;
|
|
}
|
|
</style>
|
|
<body>
|
|
|
|
<!-- loader -->
|
|
<div id="loader">
|
|
<div class="spinner-border text-primary" role="status"></div>
|
|
</div>
|
|
<!-- * loader -->
|
|
|
|
<!-- App Header -->
|
|
<div class="appHeader bg-primary text-light">
|
|
<!--
|
|
<div class="left">
|
|
<a href="javascript:;" class="headerButton goBack">
|
|
<ion-icon name="chevron-back-outline"></ion-icon>
|
|
</a>
|
|
</div>
|
|
-->
|
|
<div class="pageTitle">目前所在經緯度</div>
|
|
<!--
|
|
<div class="right">
|
|
<a href="tel:+886 12345678901" class="headerButton">
|
|
<ion-icon name="call-outline"></ion-icon>
|
|
</a>
|
|
</div>
|
|
-->
|
|
</div>
|
|
<!-- * App Header -->
|
|
|
|
<!-- App Capsule -->
|
|
<div id="appCapsule">
|
|
|
|
<div class="section full mt-2">
|
|
<!-- <div class="section-title">請輸入帳號、密碼!</div> -->
|
|
<p id="msg"></p>
|
|
<div class="wide-block pt-2 pb-2">
|
|
|
|
<form action="app-browser_gpslocation-save.php" method="post" enctype="multipart/form-data">
|
|
|
|
<!-- 以下是要傳遞的資料 -->
|
|
<input type="hidden" value="<?php echo $token; ?>" name="token" />
|
|
<!-- <input type="hidden" name="pid" value="pid12345" /> -->
|
|
<!-- <input type="hidden" name="source_flag" value="web" /> -->
|
|
<!-- 以上是要傳遞的資料 -->
|
|
|
|
<div class="section-title">緯度</div>
|
|
<div class="form-group boxed">
|
|
<div class="input-wrapper">
|
|
<input type="text" class="form-control" name="latitude-input" id="latitude-input" readonly >
|
|
<i class="clear-input">
|
|
<ion-icon name="close-circle"></ion-icon>
|
|
</i>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section-title">經度</div>
|
|
<div class="form-group boxed">
|
|
<div class="input-wrapper">
|
|
<input type="text" class="form-control" name="longitude-input" id="longitude-input" readonly >
|
|
<i class="clear-input">
|
|
<ion-icon name="close-circle"></ion-icon>
|
|
</i>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section-title">選擇地點</div>
|
|
<div class="custom-control custom-radio custom-control-inline">
|
|
<input type="radio" id="checkin-input1" name="checkin-input" class="custom-control-input" value="1" checked>
|
|
<label class="custom-control-label" for="checkin-input1">到場</label>
|
|
</div>
|
|
<div class="custom-control custom-radio custom-control-inline">
|
|
<input type="radio" id="checkin-input2" name="checkin-input" class="custom-control-input" value="2">
|
|
<label class="custom-control-label" for="checkin-input2">離站</label>
|
|
</div>
|
|
|
|
<div class="form-group boxed">
|
|
<select name="address-select" id="address-select" class="form-select" >
|
|
<option value="">自行輸入地址</option>
|
|
</select>
|
|
<input type="text" class="form-control" name="address-self" id="address-self">
|
|
</div>
|
|
|
|
<div class="mt-1">
|
|
<button type="submit" class="btn btn-primary btn-lg btn-block">
|
|
上傳打卡
|
|
</button>
|
|
</div>
|
|
|
|
</form>
|
|
<?php
|
|
if(!empty($_GET['errno'])){
|
|
if($_GET['errno']==1){
|
|
echo "帳號或密碼錯誤";
|
|
}else if($_GET['errno']==2){
|
|
echo "請輸入帳號密碼";
|
|
}else if($_GET['errno']==3){
|
|
echo "非法訪問,請輸入帳號和密碼";
|
|
}else if($_GET['errno']==4){
|
|
echo "無使用權限";
|
|
}
|
|
}
|
|
?>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<!-- * App Capsule -->
|
|
|
|
<script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<!-- 主頁頁尾 -->
|
|
<?php
|
|
include "include-footer.php";
|
|
mysqli_close($link); #代表結束連線
|
|
?>
|
|
<!-- * 主頁頁尾 -->
|
|
|
|
<!-- 主頁頁尾按鈕 -->
|
|
<?php
|
|
# include "include-bottom-menu.php";
|
|
?>
|
|
<!-- * 主頁頁尾按鈕 -->
|
|
|
|
<!-- ///////////// Js Files //////////////////// -->
|
|
<!-- Jquery -->
|
|
<?php
|
|
include "include-jsfiles.php";
|
|
?>
|
|
<script>
|
|
$(function(){
|
|
var m = document.getElementById("msg");
|
|
var a = document.getElementById("latitude-input");
|
|
var b = document.getElementById("longitude-input");
|
|
|
|
if (navigator.geolocation) {//
|
|
navigator.geolocation.getCurrentPosition(showPosition);//有拿到位置就呼叫 showPosition 函式
|
|
} else {
|
|
m.innerHTML = "您的瀏覽器不支援 顯示地理位置 API ,請使用其它瀏覽器開啟 這個網址";
|
|
}
|
|
|
|
function showPosition(position) {
|
|
//m.innerHTML = " 緯度 (Latitude): " + position.coords.latitude +
|
|
//"<br>經度 (Longitude): " + position.coords.longitude;
|
|
a.value=position.coords.latitude;
|
|
b.value=position.coords.longitude;
|
|
|
|
var formdata = new FormData();
|
|
formdata.append('lat', $('#latitude-input').val());
|
|
formdata.append('lng', $('#longitude-input').val());
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.onreadystatechange = function(){
|
|
if(this.readyState == 4 && this.status == 200){
|
|
var data = JSON.parse(this.responseText);
|
|
var objdC = data.content;
|
|
var aopt = "";
|
|
for (var i=0; i<objdC.length; i++) {
|
|
aopt += '<option value="'+objdC[i]+'"';
|
|
if (i == 0) aopt += ' selected';
|
|
aopt += '>'+objdC[i]+'</option>';
|
|
}
|
|
$('#address-select').prepend(aopt);
|
|
}
|
|
}
|
|
xhr.open('POST', '/app/app-browser_gpslocation-find.php', true);
|
|
xhr.send(formdata);
|
|
}
|
|
|
|
if ($('#address-select').val() == "") $("#address-self").show();
|
|
else $("#address-self").hide();
|
|
|
|
$('#address-select').click(function(){
|
|
if ($(this).val() == "") {
|
|
$("#address-self").show();
|
|
//$("#address-self").focus();
|
|
} else {
|
|
$("#address-self").hide();
|
|
}
|
|
});
|
|
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|