that should be it ... ? Backend done?
parent
5bc6c441b7
commit
d120adbf19
|
@ -3,11 +3,13 @@ $pdo = new PDO('mysql:host=%DB_SERVER%;dbname=%DB_NAME%', '%DB_USERNAME%', '%DB_
|
||||||
$statement = $pdo->prepare("SELECT * FROM posts WHERE board_id=:bid ORDER BY post_time asc");
|
$statement = $pdo->prepare("SELECT * FROM posts WHERE board_id=:bid ORDER BY post_time asc");
|
||||||
$statement->execute(array("bid"=>$id));
|
$statement->execute(array("bid"=>$id));
|
||||||
foreach($statement->fetchAll() as $ROW) {
|
foreach($statement->fetchAll() as $ROW) {
|
||||||
|
|
||||||
|
// get post creator
|
||||||
$statement = $pdo->prepare("SELECT * FROM users WHERE id=:uid");
|
$statement = $pdo->prepare("SELECT * FROM users WHERE id=:uid");
|
||||||
$statement->execute(array("uid"=>$ROW[user_id]));
|
$statement->execute(array("uid"=>$ROW[user_id]));
|
||||||
|
|
||||||
$post_creator = $statement->fetch();
|
$post_creator = $statement->fetch();
|
||||||
|
|
||||||
|
// get post content and make sure it doesn't mess with the website
|
||||||
$post_title = htmlspecialchars($ROW['title']);
|
$post_title = htmlspecialchars($ROW['title']);
|
||||||
$post_creator_name = htmlspecialchars($post_creator['name']);
|
$post_creator_name = htmlspecialchars($post_creator['name']);
|
||||||
$post_time = htmlspecialchars($ROW['post_time']);
|
$post_time = htmlspecialchars($ROW['post_time']);
|
||||||
|
@ -17,6 +19,9 @@ foreach($statement->fetchAll() as $ROW) {
|
||||||
$newlines = array("\r\n", "\n\r", "\r", "\n"); // two-character newlines first to prevent placing two line breaks instead of one
|
$newlines = array("\r\n", "\n\r", "\r", "\n"); // two-character newlines first to prevent placing two line breaks instead of one
|
||||||
$post_content = str_replace($newlines, "<br />", $post_content);
|
$post_content = str_replace($newlines, "<br />", $post_content);
|
||||||
|
|
||||||
|
// post id of the original post this is a reply to, negative numbers mean no reply
|
||||||
|
$reply_to = $ROW['reply_to'];
|
||||||
|
|
||||||
echo "<section>
|
echo "<section>
|
||||||
<h1>$post_title</h1>
|
<h1>$post_title</h1>
|
||||||
<article>
|
<article>
|
||||||
|
|
Loading…
Reference in New Issue