X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/177953fe451a3e393cf9d63bc977de11544bd395..234326791b1e8177eb475bffc5956d7086cfac4e:/contact.php diff --git a/contact.php b/contact.php index 9d0b1bc..b505375 100644 --- a/contact.php +++ b/contact.php @@ -2,8 +2,8 @@ $error = NULL; if ($_POST) { global $User; - if (!empty($User)) { - $_REQUEST['login'] = $User['name']; + if ($User) { + $_REQUEST['login'] = $User->login; } $error = mailform($_REQUEST); if (!empty($error)) { @@ -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) { @@ -46,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(