-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtz.php
More file actions
37 lines (29 loc) · 843 Bytes
/
Copy pathtz.php
File metadata and controls
37 lines (29 loc) · 843 Bytes
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
<?php
if($_GET && $_GET["c"]) {
require("pip.class.php");
//Change username/password
$con = mysql_connect("localhost","xxxx","xxxx");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("tz", $con);
$result = mysql_query("select path from zonemap") or die("MySQL Error:".mysql_error());
$pointLocation = new pointLocation();
$point = explode(",",$_GET["c"])[0]." ".explode(",",$_GET["c"])[1];
while($row = mysql_fetch_array($result)) {
$coords = explode("|",$row['path']);
$polygon = array();
for($i=0; $i<count($coords)-1; $i++) {
$xy = explode(",",$coords[$i]);
$polygon[$i] = $xy[0] . " " . $xy[1];
}
if($pointLocation->pointInPolygon($point, $polygon)) {
echo $row['zone'];
}
}
mysql_close($con);
}
else {
echo "Please give latitude and longitude example: tz.php?c=19.725342,-155.581056";
}
?>