forked from itchy/Dialyse-Webseite
Legal and content review.
This commit is contained in:
1 parent
167dc1dfb1
commit
086db21318
14 files changed
+425
-270
No files matched your search
+8
-5
@@ -6,11 +6,12 @@ require_once __DIR__ . '/lib/Session.php';
|
||||
$session = new Session();
|
||||
|
||||
function validate($data) {
|
||||
return !empty($data['name']) && !empty($data['email']) && !empty($data['phone']) && !empty($data['message']);
|
||||
$hasContact = !empty(trim($data['email'] ?? '')) || !empty(trim($data['phone'] ?? ''));
|
||||
return !empty(trim($data['name'] ?? '')) && $hasContact && !empty(trim($data['message'] ?? ''));
|
||||
}
|
||||
|
||||
function isBot($data) {
|
||||
return !empty($data['company']) || ($data['check'] != 'send') && (time() - $data['timestamp']) <= 5;
|
||||
return !empty($data['company']) || (($data['check'] ?? '') != 'send' && (time() - (int)($data['timestamp'] ?? 0)) <= 5);
|
||||
}
|
||||
|
||||
if($_POST && count($_POST) > 0) {
|
||||
@@ -21,16 +22,18 @@ if($_POST && count($_POST) > 0) {
|
||||
if(!validate($_POST)) {
|
||||
$session->set('form', $_POST);
|
||||
$session->set('alert-class', 'alert-danger');
|
||||
$session->set('alert', 'Nicht alle Pflichtfelder ausgefüllt.');
|
||||
$session->set('alert', 'Bitte füllen Sie alle Pflichtfelder aus und geben Sie mindestens eine E-Mail-Adresse oder Telefonnummer an.');
|
||||
} else {
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
$mail = new SendMail();
|
||||
$mail->setReplyTo($_POST['email'], $_POST['name']);
|
||||
if(!empty(trim($_POST['email'] ?? ''))) {
|
||||
$mail->setReplyTo(trim($_POST['email']), trim($_POST['name']));
|
||||
}
|
||||
$mail->setTo('kontakt@dialyse-berlin.net', 'Kontaktformular');
|
||||
// $mail->setTo('dominic.zirpel@web.de', 'Kontaktformular');
|
||||
$mail->setSubject('Kontaktformular - Dialyse Homepage');
|
||||
$mail->setBody(sprintf("Name: %s %s\nTelefon: %s\nIP: %s\nE-Mail: %s\n-----------------------------\n%s", $_POST['surname'], $_POST['name'], $_POST['phone'], $ip, $_POST['email'], $_POST['message']));
|
||||
$mail->setBody(sprintf("Name: %s %s\nTelefon: %s\nIP: %s\nE-Mail: %s\n-----------------------------\n%s", $_POST['surname'] ?? '', $_POST['name'] ?? '', $_POST['phone'] ?? '', $ip, $_POST['email'] ?? '', $_POST['message'] ?? ''));
|
||||
if($mail->send()) {
|
||||
$session->remove('form');
|
||||
$session->set('alert-class', 'alert-success');
|
||||
|
||||
Reference in new issue
Block a user