inital commit
This commit is contained in:
28
templates/template_4/site/contact.php
Normal file
28
templates/template_4/site/contact.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
function parseInput($data) {
|
||||
$data = trim($data);
|
||||
$data = stripslashes($data);
|
||||
$data = htmlspecialchars($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['email']) && isset($_POST['content'])) {
|
||||
$to_email = 'noreply@createwebsites.pl';
|
||||
$user_email = parseInput($_POST['email']);
|
||||
$content = parseInput($_POST["content"]);
|
||||
$subject = "a user has completed the contact form";
|
||||
$body = "<p>a user (<a href=\"mailto:$user_email\">$user_email</a>) has completed the contact form:</p><p>\"$content\"</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 and content cannot be empty");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user