-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsettings.php
69 lines (61 loc) · 2.42 KB
/
settings.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Set airport</title>
<link rel="stylesheet" href="css.css">
<script src="https://kit.fontawesome.com/dd348bbd0a.js" crossorigin="anonymous"></script>
<link href="https://fonts.googleapis.com/css?family=Fira+Sans&display=swap" rel="stylesheet">
</head>
<body style="text-align:center;">
<h1>Choose an airport</h1>
<?php
if(array_key_exists('icao', $_POST)) {
$icao = htmlspecialchars($_POST['icao']);
echo "<font color=white>Airport to find : ".$icao."<br/>";
$airport_file = fopen("aptlist", "r") or die("Unable to open airport file!");
$found = false;
while ((!feof($airport_file)) and (!$found)) {
$line = fgets($airport_file);
$aux = explode("\t", $line);
$found = ($aux[0] == $icao);
}
fclose($airport_file);
if (!$found) echo "Unknown airport !";
else {
echo "Airport found !";
unlink('settings');
$settings = fopen("settings", "w");
fwrite($settings, $line);
fclose($settings);
header("Location: base.php");
}
}
?>
<form method="post">
<select id="airport" onChange="update()">
<option value="LFRB">Brest Bretagne</option>
<option value="VHHH">Hong Kong International Airport</option>
<option value="VTSG">Krabi International Airport</option>
<option value="LFLL">Lyon Saint-Exupery</option>
<option value="VMMC">Macau International Airport</option>
<option value="LFRS">Nantes Atlantique</option>
<option value="KJFK">New York JFK</option>
<option value="LFPG">Paris-Charles de Gaulle</option>
<option value="LFPB">Paris-Le Bourget</option>
<option value="LFPO">Paris-Orly</option>
<option value="WMKP">Penang International Airport</option>
</select>
<input type="hidden" name="icao" id="value">
<button> Set airport </button> <input type="button" onclick="location.href='base.php';" value=" Cancel " />
</form>
<script type="text/javascript">
function update() {
var select = document.getElementById('airport');
var option = select.options[select.selectedIndex];
document.getElementById('value').value = option.value;
}
update();
</script>
</body>
</html>