3 require_once 'database.inc.php';
5 print '<h3>Reacties</h3>'."\n";
9 $html = nl2br(htmlspecialchars($_POST['reply']));
10 $html = "<p>$html</p>";
11 $query = $Db->prepare('INSERT INTO comments (page, message, author) VALUES (?, ?, ?)');
12 $query->execute([ $Page, $html, $User->login ]);
13 if (!$query->rowCount()) {
14 throw new Exception('Fout bij opslaan');
16 $_POST['reply'] = NULL;
18 catch (Exception $e) {
19 print '<p class=warn>Antwoord niet opgeslagen.</p>'."\n\n";
23 $query = $Db->prepare('SELECT * FROM comments WHERE page = ? ORDER BY created');
24 $query->execute([$Page]);
26 print '<ul class="replies">';
28 while ($row = $query->fetch(PDO::FETCH_OBJ)) {
29 $rowuser = new User("profile/{$row->author}");
31 printf('<strong>%s</strong> <small class=date>%s</small>',
32 $rowuser->html, showdate(preg_split('/\D/', $row->created))
34 printf("<blockquote>%s</blockquote>\n", $row->message);
39 print '<form method="post" action="">';
40 printf('<textarea id="%s" name="%1$s" cols=60 rows=3 placeholder="%s">%s</textarea>'."\n",
42 "Bericht van {$User->login}",
45 print '<input type="submit" value="Plaatsen" />'."\n";
46 print "</form></li>\n";