-
Notifications
You must be signed in to change notification settings - Fork 0
/
location.php
150 lines (131 loc) · 4.6 KB
/
location.php
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
include './db-connect.php';
$db = DBConnector::dbConnection();
#$result1 = $db->query('CREATE TABLE Persons3 ( PersonID int, LastName varchar(255));');
#$results = $db->query('INSERT INTO Persons3 (PersonID, LastName) VALUES (2, 'abcd');');
$results = $db->query('SELECT * from tab3;');
?>
<!DOCTYPE html>
<html>
<head>
<title>Place searches</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<link rel="stylesheet" href="css/main.css">
<!--<button type="button" onclick="initMap()">Found Homeless? Click Here</button> -->
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 95%;
width: 100%;
border: 3px ;
top:3%;
left:3%;
right:3%;
bottom: 10px;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 96%;
margin: 0;
background-image: url(images/hero-bg.jpg);
padding: 0;
border: 1px;
}
button {
top: 2em;
background-color: #FFFFFF00; /* Green */
text-align: 40px;
border: 3px solid white;
color: white;
width: 35%;
height: 10%;
font-size: 25px;
position: relative;
left:35%;
}
</style>
<script src="https://code.jquery.com/jquery.js"></script>
<script type="text/javascript">
// This example requires the Places library. Include the libraries=places
// parameter when you first load the API. For example:
// <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places">
function myFunction() {
confirm("Thank you for your support. This location has been Marked");
}
var map;
var infowindow;
var pos = {
lat: 0,
lng: 0
};
function initMap() {
var pyrmont = {lat: 20, lng: -30};
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 20, lng: -90},
zoom:3
});
map.setOptions({ minZoom: 3, maxZoom: 15 });
infoWindow = new google.maps.InfoWindow;
// Try HTML5 geolocation.
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var pos = {
lat: position.coords.latitude,
lng: position.coords.longitude
};
infoWindow.setPosition(pos);
infoWindow.setContent('Your Location');
var marker = new google.maps.Marker({
position: pos,
map: map
});
infoWindow.open(map);
map.setCenter(pos);
infowindow = new google.maps.InfoWindow();
var service = new google.maps.places.PlacesService(map);
}, function() {
handleLocationError(true, infoWindow, map.getCenter());
});
} else {
// Browser doesn't support Geolocation
handleLocationError(false, infoWindow, map.getCenter());
}
var infowindow1 = null;
<?php
foreach($results as $row) {
?>
var x = '<?php echo $row[0]; ?>';
var y = '<?php echo $row[1]; ?>';
var z = '<?php echo $row[2]; ?>';
//addMarker(loc);
var uluru = {lat: parseFloat(y), lng: parseFloat(x)};
var setcontentvalue = z;
var image = 'https://maps.google.com/mapfiles/kml/shapes/library_maps.png';
var marker1 = new google.maps.Marker({
map: map,
position: uluru,
icon: image,
});
infowindow1 = new google.maps.InfoWindow({
content: '<?php echo $row[2]; ?>'
});
google.maps.event.addListener(marker1, 'click', (function(marker1, z) {
return function() {
infoWindow.setContent(z);
infoWindow.open(map, marker1);
}
})(marker1, z));
<?php
}
?>
}
</script>
</head>
<body>
<div id="map" style="width:75em;height:37em;"></div>
<script src="https://maps.googleapis.com/maps/api/js?key=ENTERGOOGLEKEYw&libraries=places&callback=initMap" async defer></script>
<button input class="button button-primary" onclick="myFunction()"><a style="color:white" href="final.php" title="Confirmation">CHECK IN</a></button>
</body>
</html>