X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/7985438060a98d20e0e2057600a21f4de9b673c7..75cbd3cb3b7e08963686ca81976c086fd531a8b8:/widget/nieuws/replies.php?ds=sidebyside diff --git a/widget/nieuws/replies.php b/widget/nieuws/replies.php index 06af5d3..13533c9 100644 --- a/widget/nieuws/replies.php +++ b/widget/nieuws/replies.php @@ -1,17 +1,17 @@ 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->query('INSERT INTO comments (page, message, author) VALUES (?, ?, ?)', [ + $Page, $html, $User->login + ]); + if (!$query->rowCount()) { throw new Exception('Fout bij opslaan'); } $_POST['reply'] = NULL; @@ -21,19 +21,17 @@ if ($_POST) { } } +$query = $Db->query('SELECT * FROM comments WHERE page = ? ORDER BY created', [$Page]); + print '