refactor(contact-handler.php): PSR2 autoformat
This commit is contained in:
parent
b58b2357c0
commit
1dd30c2f75
@ -5,28 +5,28 @@ use PHPMailer\PHPMailer\Exception;
|
|||||||
|
|
||||||
$mail = new PHPMailer(true);
|
$mail = new PHPMailer(true);
|
||||||
|
|
||||||
$errors = '';
|
$errors = '';
|
||||||
$myEmail = getenv('ASTRO_SMTP_FROM');
|
$myEmail = getenv('ASTRO_SMTP_FROM');
|
||||||
|
|
||||||
if(empty($_POST['namezzz']) || empty($_POST['emailzzz']) || empty($_POST['message'])) {
|
if(empty($_POST['namezzz']) || empty($_POST['emailzzz']) || empty($_POST['message'])) {
|
||||||
$errors .= "\n Error: all fields are required";
|
$errors .= "\n Error: all fields are required";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($_POST['name']) && !empty($_POST['email'])) {
|
if(!empty($_POST['name']) && !empty($_POST['email'])) {
|
||||||
$errors .= "\n Error: spam";
|
$errors .= "\n Error: spam";
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = $_POST['namezzz'];
|
$name = $_POST['namezzz'];
|
||||||
$emailAddress = $_POST['emailzzz'];
|
$emailAddress = $_POST['emailzzz'];
|
||||||
$select = $_POST['select'];
|
$select = $_POST['select'];
|
||||||
$message = $_POST['message'];
|
$message = $_POST['message'];
|
||||||
$subscribe = $_POST['subscribe'];
|
$subscribe = $_POST['subscribe'];
|
||||||
|
|
||||||
if (!filter_var($emailAddress, FILTER_VALIDATE_EMAIL)) {
|
if (!filter_var($emailAddress, FILTER_VALIDATE_EMAIL)) {
|
||||||
$errors .= "\n Error: Invalid email address $emailAddress";
|
$errors .= "\n Error: Invalid email address $emailAddress";
|
||||||
}
|
}
|
||||||
|
|
||||||
if( empty($errors)) {
|
if(empty($errors)) {
|
||||||
$to = $myEmail;
|
$to = $myEmail;
|
||||||
$emailSubject = "[Formulaire Astrolabe] Nouveau message";
|
$emailSubject = "[Formulaire Astrolabe] Nouveau message";
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ $mail = new PHPMailer(true);
|
|||||||
|
|
||||||
// redirect to the 'thank you' page
|
// redirect to the 'thank you' page
|
||||||
header("Location: /thank-you/index.html");
|
header("Location: /thank-you/index.html");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@ -97,6 +97,6 @@ $mail = new PHPMailer(true);
|
|||||||
<!-- This page is displayed only if there is some error -->
|
<!-- This page is displayed only if there is some error -->
|
||||||
<?php
|
<?php
|
||||||
echo nl2br($errors);
|
echo nl2br($errors);
|
||||||
?>
|
?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user