shows table of avaiable Stations
This commit is contained in:
@@ -7,4 +7,23 @@
|
|||||||
|
|
||||||
echo file_get_contents("html/header.html");
|
echo file_get_contents("html/header.html");
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="table-div">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Name</th>
|
||||||
|
<th scope="col">Standort</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
load_stations_table($con);
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
<?php echo file_get_contents("html/footer.html"); ?>
|
<?php echo file_get_contents("html/footer.html"); ?>
|
||||||
@@ -63,3 +63,14 @@ function add_user($con, $username, $user_id, $user_group, $password, $salt) {
|
|||||||
handle_pdo_exception($e);
|
handle_pdo_exception($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_stations($con) {
|
||||||
|
try {
|
||||||
|
$stmt = $con->prepare("SELECT name, standort FROM Station");
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->setFetchMode(PDO::FETCH_ASSOC);
|
||||||
|
return $stmt;
|
||||||
|
} catch(PDOException $e) {
|
||||||
|
handle_pdo_exceptio($e);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,3 +33,13 @@ function generate_password_hash($password, $salt) {
|
|||||||
$pword = $password . $salt;
|
$pword = $password . $salt;
|
||||||
return hash('sha3-512', $pword);
|
return hash('sha3-512', $pword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function load_stations_table($con) {
|
||||||
|
$stmt = get_stations($con);
|
||||||
|
foreach($stmt->fetchAll() as $row) {
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td>" . $row['name'] . "</td>";
|
||||||
|
echo "<td>" . $row['standort'] . "</td>";
|
||||||
|
echo "</tr>";
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user