2020-03-08 16:15:23 +01:00
|
|
|
<?php
|
|
|
|
%REQUIRE_LOGIN%
|
2020-03-08 15:03:30 +01:00
|
|
|
$pdo = new PDO('mysql:host=localhost;dbname=web', 'webstuff', 'Schei// auf Pa$$w0rter!');
|
|
|
|
$error = false;
|
|
|
|
$error_message = "";
|
|
|
|
if (!$error) {
|
2020-03-08 15:29:36 +01:00
|
|
|
$statement = $pdo->prepare("SELECT * FROM posts WHERE board_id=:bid ORDER BY post_time asc");
|
|
|
|
$statement->execute(array("bid"=>$id));
|
2020-03-08 15:03:30 +01:00
|
|
|
foreach($statement->fetchAll() as $ROW) {
|
2020-03-08 15:29:36 +01:00
|
|
|
$error = false;
|
|
|
|
$error_message = "";
|
|
|
|
if (!$error) {
|
|
|
|
$statement = $pdo->prepare("SELECT * FROM users WHERE id=:uid");
|
|
|
|
$statement->execute(array("uid"=>$ROW[user_id]));
|
2020-03-08 16:51:03 +01:00
|
|
|
$post_user = $statement->fetch();
|
2020-03-08 15:29:36 +01:00
|
|
|
}
|
|
|
|
if (!$result) {
|
|
|
|
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2];
|
|
|
|
}
|
2020-03-08 15:23:34 +01:00
|
|
|
echo "<section>";
|
2020-03-08 15:55:19 +01:00
|
|
|
echo "<h1>$ROW[title]</h1>";
|
2020-03-08 15:23:34 +01:00
|
|
|
echo "<article>";
|
|
|
|
echo "<header>";
|
|
|
|
echo "<div>";
|
2020-03-08 16:51:03 +01:00
|
|
|
echo "<p class='beige'>$post_user[name] <time datetime='$ROW[post_time]'>$ROW[post_time]</time></p>";
|
2020-03-08 15:23:34 +01:00
|
|
|
echo "</div>";
|
|
|
|
echo "</header>";
|
|
|
|
echo "<div class='postcontent'>";
|
|
|
|
echo "<p>$ROW[content]</p>";
|
|
|
|
echo "</div>";
|
|
|
|
echo "</article>";
|
|
|
|
echo "</section>";
|
2020-03-08 15:03:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!$result) {
|
|
|
|
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2];
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|