-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd.php
More file actions
56 lines (48 loc) · 1.84 KB
/
add.php
File metadata and controls
56 lines (48 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
include('header.php');
$source = $_GET["source"];
?>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBwiHi6BAeRu7z44MIb8VTAxeyVe7WLvjo&sensor=true"></script>
<script>
var lat = 0.0;
var lng = 0.0;
var address = "";
function getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(storePosition);
}
else{x.innerHTML="Geolocation is not supported by this browser.";}
}
function storePosition(position)
{
lat = position.coords.latitude.toFixed(7);
lng = position.coords.longitude.toFixed(7);
console.log(lat+","+lng);
$.getJSON("revgeocode.php?latlng="+lat+","+lng, function(data) {
console.log(data);
address = data.results[0].formatted_address;
});
}
getLocation();
function setLoc(){
document.addfact.latitude.value = lat;
document.addfact.longitude.value = lng;
document.addfact.address.value = address;
document.forms["addfact"].submit();
}
</script>
<p id="factguide">The quality of the facts you enter is what makes WikiTour great. Make sure your fact is a positive and interesting contribution to the WikiTour community.</p>
<form id="addfact" name="addfact" action="submitfact.php" method="post" data-ajax="false">
<input type="hidden" name="sourcepage" value="<?php echo str_replace("_", " ", $source); ?>" />
<textarea name="facttext" maxlength="120" placeholder="Enter your fact—why will visitors here want to learn about <?php echo $source; ?>?"></textarea>
<input type="hidden" name="latitude" value="">
<input type="hidden" name="longitude" value="">
<input type="hidden" name="address" value="">
<input type="button" value="Pin fact to my location" onclick="setLoc();"/>
</form>
<div class="navbutton">
<a href="index.html" data-role="button" data-rel="back">Cancel</a>
</div>
<?php include('footer.php'); ?>