2021-04-09 19:21:53 +00:00
|
|
|
<?php
|
2023-09-29 18:48:52 +00:00
|
|
|
session_start();
|
2021-04-09 19:21:53 +00:00
|
|
|
include("config.php");
|
2022-05-02 22:33:31 +00:00
|
|
|
// Returns numbers in string format as needed for file names
|
|
|
|
function clipNumber($number, $length)
|
|
|
|
{
|
|
|
|
$number = abs($number) . "";
|
|
|
|
while (strlen($number) < $length)
|
|
|
|
{
|
|
|
|
$number = "0" . $number;
|
|
|
|
}
|
|
|
|
return $number;
|
|
|
|
}
|
2021-04-09 19:21:53 +00:00
|
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<link rel="stylesheet" type="text/css" href="style.css"/>
|
|
|
|
</head>
|
2022-05-02 22:33:31 +00:00
|
|
|
<body id="infobody">
|
2021-04-09 19:21:53 +00:00
|
|
|
<?php
|
2023-09-29 18:48:52 +00:00
|
|
|
if (!isset($_GET['minor']))
|
2021-04-09 19:21:53 +00:00
|
|
|
{
|
|
|
|
echo "No tile selected";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-09-29 18:48:52 +00:00
|
|
|
$tile = $_GET['minor'];
|
2022-05-02 22:33:31 +00:00
|
|
|
preg_match_all('/([we])(\d{3})([sn])(\d{2})/m', $tile, $matches, PREG_SET_ORDER, 0);
|
|
|
|
$we = $matches[0][1];
|
|
|
|
$lon = (int)$matches[0][2];
|
|
|
|
$sn = $matches[0][3];
|
|
|
|
$lat = (int)$matches[0][4];
|
|
|
|
if ($we == "w")
|
|
|
|
{
|
|
|
|
$lon *= -1;
|
|
|
|
}
|
|
|
|
if ($sn == "s")
|
|
|
|
{
|
|
|
|
$lat *= -1;
|
|
|
|
}
|
2021-04-09 19:21:53 +00:00
|
|
|
// Connect to DB
|
|
|
|
$con = new mysqli($SQL_SERVER, $SQL_USER, $SQL_PASSWORD, $SQL_DATABASE, $SQL_PORT);
|
|
|
|
if ($con->connect_error)
|
|
|
|
{
|
|
|
|
quit();
|
|
|
|
}
|
2023-09-29 18:48:52 +00:00
|
|
|
echo '<div id="tablecontainer">';
|
|
|
|
$stmt = $con->prepare("SELECT status.name AS status FROM secondLevel JOIN status ON secondLevel.status_id = status.id WHERE secondLevel.name = ?");
|
2022-05-02 22:33:31 +00:00
|
|
|
$stmt->bind_param("s", $tile);
|
|
|
|
$stmt->execute();
|
|
|
|
$result = $stmt->get_result();
|
|
|
|
$ret = $result->fetch_all(MYSQLI_ASSOC);
|
2023-09-29 18:48:52 +00:00
|
|
|
$curStatus = Null;
|
|
|
|
foreach ($ret as $row)
|
2022-05-03 10:56:28 +00:00
|
|
|
{
|
2023-09-29 18:48:52 +00:00
|
|
|
$curStatus = $row["status"];
|
2022-05-03 10:56:28 +00:00
|
|
|
}
|
2023-10-26 10:18:59 +00:00
|
|
|
echo '<form method="post" action="api.php" target="api">
|
2023-09-29 18:48:52 +00:00
|
|
|
<label>Update Area</label> ' . $_GET['minor'] . '<br/>';
|
|
|
|
if(!isset($_SESSION["token"]))
|
2021-04-09 19:21:53 +00:00
|
|
|
{
|
2023-09-29 18:48:52 +00:00
|
|
|
echo '<input type="text" name="auth" placeholder="Token"/><br/>';
|
2021-04-09 19:21:53 +00:00
|
|
|
}
|
2023-09-29 18:48:52 +00:00
|
|
|
echo '<input type="hidden" name="action" value="set"/>
|
|
|
|
<input type="hidden" name="area" value="' . $_GET["minor"] . '"/>
|
|
|
|
<select name="status">';
|
|
|
|
$sql = "SELECT name FROM status ORDER BY priority";
|
|
|
|
$ret = $con->query($sql)->fetch_all(MYSQLI_ASSOC);
|
|
|
|
if ($ret != False)
|
2022-05-10 11:11:37 +00:00
|
|
|
{
|
2023-09-29 18:48:52 +00:00
|
|
|
foreach($ret as $row)
|
2022-05-10 11:11:37 +00:00
|
|
|
{
|
2023-09-29 18:48:52 +00:00
|
|
|
echo '<option value="' . $row["name"] . '"';
|
|
|
|
if ($row["name"] == $curStatus)
|
2022-05-10 11:11:37 +00:00
|
|
|
{
|
2023-09-29 18:48:52 +00:00
|
|
|
echo ' selected';
|
2022-05-10 11:11:37 +00:00
|
|
|
}
|
2023-09-29 18:48:52 +00:00
|
|
|
echo '>' . $row["name"] . '</option>';
|
2022-05-10 11:11:37 +00:00
|
|
|
}
|
|
|
|
}
|
2023-09-29 18:48:52 +00:00
|
|
|
echo '</select>
|
|
|
|
<input type="submit" value="Update"/>
|
|
|
|
</form>';
|
2023-01-23 11:53:49 +00:00
|
|
|
echo '</div>';
|
2021-04-09 19:21:53 +00:00
|
|
|
}
|
|
|
|
?>
|
2023-10-26 10:18:59 +00:00
|
|
|
<br/><br/>
|
|
|
|
<div>
|
|
|
|
<iframe id="api" name="api" style="border: 0px;" src=""/>
|
|
|
|
</div>
|
2021-04-09 19:21:53 +00:00
|
|
|
</body>
|
|
|
|
</html>
|