72 lines
1.8 KiB
PHP
72 lines
1.8 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="pl">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Geo lokalizator</title>
|
|
<meta name="viewport"
|
|
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
<?php include_once "style.php"; ?>
|
|
|
|
<script type="text/javascript">
|
|
|
|
function showLocation(position) {
|
|
var latitude = position.coords.latitude;
|
|
var longitude = position.coords.longitude;
|
|
document.getElementById('szer').value = latitude;
|
|
document.getElementById('dl').value = longitude;
|
|
}
|
|
|
|
function errorHandler(err) {
|
|
if (err.code == 1) {
|
|
alert("Error: Access is denied!");
|
|
}
|
|
|
|
else if (err.code == 2) {
|
|
alert("Error: Position is unavailable!");
|
|
}
|
|
}
|
|
|
|
function getLocation() {
|
|
|
|
if (navigator.geolocation) {
|
|
// timeout at 60000 milliseconds (60 seconds)
|
|
var options = {timeout: 60000, enableHighAccuracy: true};
|
|
navigator.geolocation.getCurrentPosition(showLocation, errorHandler, options);
|
|
}
|
|
|
|
else {
|
|
alert("Sorry, browser does not support geolocation!");
|
|
}
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
</head>
|
|
<body>
|
|
<h1>Dodaj wpis</h1>
|
|
<form action="/save" method="POST" >
|
|
|
|
<label>Tytuł</label>
|
|
<input type="text" name="title" id="title"/>
|
|
|
|
|
|
<label>Treść </label>
|
|
<textarea name="desc" id="desc"></textarea>
|
|
|
|
|
|
<label>Szerokość geo</label>
|
|
<input type="text" name="szer" id="szer"/>
|
|
|
|
|
|
<label>Długość geo</label>
|
|
<input type="text" name="dl" id="dl"/>
|
|
|
|
|
|
<input type="button" onclick="getLocation();" value="Get Location"/>
|
|
|
|
<button type="submit" name="submit">Wyślij</button>
|
|
</form>
|
|
<a href="/list">List</a>
|
|
</body>
|
|
</html>
|