-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewsletter.php
27 lines (27 loc) · 923 Bytes
/
newsletter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
session_start();
if(isset($_POST['nl-submit'])){
$_SESSION['email']=strtolower($_POST['nl-email']);
header('Location:/#newsletter');
exit();
};
if(isset($_SESSION['email'])){
echo 'a';
$email=$_SESSION['email'];
if(!empty($email) and filter_var($email, FILTER_VALIDATE_EMAIL)){
$headers='Content-type: text/html; charset=utf-8'.'\r\n'.
'Return-Path: [email protected]'.'\r\n'.
'Reply-To: [email protected]'.'\r\n'.
'Errors-To: [email protected]'.'\r\n'.
"To: {$email}".'\r\n'.
'From: [email protected]';
mail($email,"Merci de t'être inscrit...",'hello',$headers);
// add email to database and change special chars to &;
echo '<script>alert("a verification email have been sent to {$email}.");</script>';
}
else{
echo("<script>alert('empty');</script>");
};
unset($_SESSION['email']);
}
?>