X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/fd6a9af84cad3613810d7d0dbba5be5652b1a906..ce951ad9579fd96a7ba185f6d7cbd99bd37b9ec4:/contact.php diff --git a/contact.php b/contact.php index 691ff41..7ffa409 100644 --- a/contact.php +++ b/contact.php @@ -14,7 +14,8 @@ if ($_POST) { function mailform($input = []) { $source = empty($input['subject']) ? 'reactie' : $input['subject']; - $rcpt = 'info@'.$_SERVER['HTTP_HOST']; + $domain = preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']); + $rcpt = "info@$domain"; $subject = "Formulier {$_SERVER['HTTP_HOST']}: $source"; if (!$input) { @@ -22,6 +23,14 @@ function mailform($input = []) } switch ($source) { + case 'melding': + if (empty($input['login'])) { + return "Inloggen is verplicht om een melding te plaatsen."; + } + if (empty($input['body'])) { + return "Geen bericht opgegeven."; + } + break; case 'bbq': if (empty($input['naam']) or empty($input['huis'])) { return 'De bedoeling is juist dat je opgeeft wie er komt.'; @@ -38,7 +47,7 @@ switch ($source) { } $reply = preg_match('/\A\w+@\w+\.[a-z]+\z/', @$input['email']) - ? $input['email'] : 'noreply@'.$_SERVER['HTTP_HOST']; + ? $input['email'] : "noreply@$domain"; $header = "From: $reply"; foreach (array( @@ -70,6 +79,9 @@ switch ($source) { case 'bbq': print "

Bedankt voor je deelname. Tot ziens!

"; break; + case 'melding': + print "

Bedankt voor de melding. Na goedkeuring zal het hier geplaatst worden.

"; + break; default: print '

Bedankt voor uw reactie!

'; }