forked from allenshih1/database
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathairport_management.php
More file actions
60 lines (60 loc) · 1.76 KB
/
airport_management.php
File metadata and controls
60 lines (60 loc) · 1.76 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
57
58
59
60
<?php require_once("header.php"); ?>
<h1>機場管理</h1>
<?php
if(isset($_SESSION['isAuth']) && $_SESSION['isAdmin'])
{
require_once("db.php");
$sql = "SELECT * FROM Airport";
$airports = $db->prepare($sql);
$airports->execute();
?>
<table style="width:800px">
<tr>
<td> abbr </td>
<td> name </td>
<td> country </td>
<td> longitude </td>
<td> latitude </td>
<td> timezone </td>
</tr>
<?php
while($airport = $airports->fetchObject())
{
?>
<tr>
<td> <?= $airport->abbr ?> </td>
<td> <?= $airport->name ?> </td>
<td> <?= $airport->country ?> </td>
<td> <?= $airport->longitude ?> </td>
<td> <?= $airport->latitude ?> </td>
<td> <?= $airport->timezone ?> </td>
<form action="edit_airport.php" method="post">
<input type="hidden" name="id" value="<?= $airport->id ?>">
<input type="hidden" name="abbr" value="<?= $airport->abbr ?>">
<input type="hidden" name="name" value="<?= $airport->name ?>">
<input type="hidden" name="country" value="<?= $airport->country ?>">
<input type="hidden" name="longitude" value="<?= $airport->longitude ?>">
<input type="hidden" name="latitude" value="<?= $airport->latitude ?>">
<input type="hidden" name="timezone" value="<?= $airport->timezone ?>">
<td> <button type="submit"> 編輯 </button></td>
</form>
<form action="delete_airport_func.php" method="post">
<input type="hidden" name="id" value="<?= $airport->id ?>">
<td> <button type="submit"> 刪除 </button></td>
</form>
</tr>
<?php } ?>
</table>
<a href="add_airport.php"> <button type="button">新增</button></a>
<?php
} else if(isset($_SESSION['isAuth'])){
?>
permission denied
<?php
} else {
?>
please login first
<?php
}
?>
<?php require_once("footer.php"); ?>