inital commit
This commit is contained in:
27
templates/template_4/site/newsletter.php
Normal file
27
templates/template_4/site/newsletter.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
function parseInput($data) {
|
||||
$data = trim($data);
|
||||
$data = stripslashes($data);
|
||||
$data = htmlspecialchars($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['email'])) {
|
||||
$to_email = 'noreply@createwebsites.pl';
|
||||
$user_email = parseInput($_POST['email']);
|
||||
$subject = "a user is asking for a newsletter";
|
||||
$body = "<p>a user (<a href=\"mailto:$user_email\">$user_email</a>) is asking for a newsletter</p>";
|
||||
$header.= "MIME-Version: 1.0\r\n";
|
||||
$header.= "Content-Type: text/html; charset=ISO-8859-1\r\n";
|
||||
$header.= "X-Priority: 1\r\n";
|
||||
|
||||
if ( mail($to_email, $subject, $body, $header)) {
|
||||
echo("success");
|
||||
} else {
|
||||
echo("fail");
|
||||
}
|
||||
} else {
|
||||
echo ("email cannot be empty");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user