website/public/post.html
2021-04-13 10:17:35 +02:00

32 lines
No EOL
658 B
HTML

<?php
include "internal/header.php";
include "internal/footer.php";
if(isset($_GET["template"])){
$title = "[TITLE]";
$content = "[CONTENT]";
$date = "DATE NOT SHOWN IN PREVIEW";
$id = "0";
} else{
$id = $conn->real_escape_string($_GET["id"]);
$result = $conn->query("SELECT * FROM posts WHERE id=$id");
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
} else {
die("Post not found");
}
$title = $row["title"];
$content = $row["content"];
$date = $row["date"];
$id = $row["id"];
}
getHeader($title, "");
?>
<p>
<?php echo($content); ?>
</p>
<?php
getFooter();