From f9b855c241ac7273399d1d405b63071b86b87faa Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Fri, 10 Aug 2018 21:40:45 +0200 Subject: [PATCH] nieuws: user reply form on melding page --- nieuws.inc.php | 1 + nieuws/index.php | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/nieuws.inc.php b/nieuws.inc.php index 7133474..524109d 100644 --- a/nieuws.inc.php +++ b/nieuws.inc.php @@ -10,6 +10,7 @@ function showdate($parts) global $monthname; return implode(' ', array_filter([ intval($parts[3]), $parts[2] > 0 ? $monthname[intval($parts[2])] : '', $parts[1], + count($parts) > 6 ? "$parts[4]:$parts[5]" : '', ])); } diff --git a/nieuws/index.php b/nieuws/index.php index cf57dbc..c90034f 100644 --- a/nieuws/index.php +++ b/nieuws/index.php @@ -1,11 +1,61 @@ Reacties'."\n"; + $pagelink = $Page.$Args; + + if ($_POST) { + try { + @mkdir($pagelink); + $target = $pagelink.'/'.date('YmdHis').':'.$User['name'].'.txt'; + $written = file_put_contents($target, $_POST['reply']); + if ($written === FALSE) { + throw new Exception('Fout bij opslaan'); + } + $_POST['reply'] = NULL; + } + catch (Exception $e) { + print '

Antwoord niet opgeslagen.

'."\n\n"; + } + } + + print '\n\n"; + } + return 1; } -- 2.30.0