git.shiar.nl
/
minimedit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
9e9882d
)
contact: exceptional parsing and delivery for bbq
author
Mischa POSLAWSKY
<perl@shiar.org>
Tue, 7 Aug 2018 14:09:16 +0000
(16:09 +0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Tue, 7 Aug 2018 14:21:33 +0000
(16:21 +0200)
contact.php
patch
|
blob
|
history
diff --git
a/contact.php
b/contact.php
index 94d8ebe04ad680832175b4eb96f1eda275188840..c55ec0c033081af57341d891810722feb10aa547 100644
(file)
--- a/
contact.php
+++ b/
contact.php
@@
-13,10
+13,21
@@
if ($_POST) {
function mailform($input = [])
{
$source = empty($input['subject']) ? 'reactie' : $input['subject'];
function mailform($input = [])
{
$source = empty($input['subject']) ? 'reactie' : $input['subject'];
+ $rcpt = 'info@'.$_SERVER['HTTP_HOST'];
+ $subject = "Formulier {$_SERVER['HTTP_HOST']}: $source";
+
if (!$input) {
return 'Geen gegevens ontvangen. Probeer het nog eens.';
}
if (!$input) {
return 'Geen gegevens ontvangen. Probeer het nog eens.';
}
-if ($source != 'bbq') {
+
+switch ($source) {
+ case 'bbq':
+ if (empty($input['naam']) or empty($input['huis'])) {
+ return 'De bedoeling is juist dat je opgeeft wie er komt.';
+ }
+ $rcpt .= ', Heleen <heleen.terlouw.2910@gmail.com>';
+ break;
+ default:
if (empty($input['email']) or !preg_match('/.+@.+\..+/', $input['email'])) {
return 'Een geldig e-mailadres is verplicht zodat we antwoord kunnen geven.';
}
if (empty($input['email']) or !preg_match('/.+@.+\..+/', $input['email'])) {
return 'Een geldig e-mailadres is verplicht zodat we antwoord kunnen geven.';
}
@@
-25,10
+36,8
@@
if ($source != 'bbq') {
}
}
}
}
- $rcpt = 'info@'.$_SERVER['HTTP_HOST'];
- $subject = "Formulier {$_SERVER['HTTP_HOST']}: $source";
$reply = preg_match('/\A\w+@\w+\.[a-z]+\z/', @$input['email'])
$reply = preg_match('/\A\w+@\w+\.[a-z]+\z/', @$input['email'])
- ? $input['email'] :
$rcpt
;
+ ? $input['email'] :
'noreply@'.$_SERVER['HTTP_HOST']
;
$header = "From: $reply";
foreach (array(
$header = "From: $reply";
foreach (array(