X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/0243f370ae2e2188ea9bec4d859b5ee8f0c17817..0cc6251412d85492cbd0af0d50176d3c70c25311:/widget/nieuws/replies.php diff --git a/widget/nieuws/replies.php b/widget/nieuws/replies.php index 06af5d3..54e552a 100644 --- a/widget/nieuws/replies.php +++ b/widget/nieuws/replies.php @@ -1,17 +1,16 @@ Reacties'."\n"; -$pagelink = $Page.$Args; if ($_POST) { try { - @mkdir($pagelink); - $target = $pagelink.'/'.date('YmdHis').':'.$User->login.'.html'; $html = nl2br(htmlspecialchars($_POST['reply'])); - $html = "

$html

\n"; - $written = file_put_contents($target, $html); - if ($written === FALSE) { + $html = "

$html

"; + $query = $Db->prepare('INSERT INTO comments (page, message, author) VALUES (?, ?, ?)'); + $query->execute([ $Page, $html, $User->login ]); + if (!$query->rowCount()) { throw new Exception('Fout bij opslaan'); } $_POST['reply'] = NULL; @@ -21,19 +20,18 @@ if ($_POST) { } } +$query = $Db->prepare('SELECT * FROM comments WHERE page = ? ORDER BY created'); +$query->execute([$Page]); + print '