-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
54 lines (44 loc) · 1.31 KB
/
index.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
$errors = '';
$send ='';
if (isset($_POST['submit'])){ # Receibe the data
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$country = $_POST['country'];
if ($_POST['country'] != ""){ // Honey Pot
exit;
}
if (!empty($name)){
$name = trim($name);
$name = filter_var($name, FILTER_SANITIZE_STRING);
} else {
$errors .= 'Please, write your Name. <br />';
}
if (!empty($email)){
$email = filter_var($email, FILTER_SANITIZE_EMAIL);
if (!filter_var($email, FILTER_VALIDATE_EMAIL)){
$errors .= "Please, insert a correct Email. <br />";
}
} else {
$errors .= "Please, write your Email. <br />";
}
if (!empty($message)){
$message = htmlspecialchars($message);
$message = trim($message);
$message = stripcslashes($message);
} else {
$errors .= "Please, write your Message. <br />";
}
if (!$errors) {
$send_to = 'your email';
$subjet = 'Email from my website';
$from = 'From: $name \n';
$user_email = 'Email: $email \n';
$message_text = 'Message: $message';
# mail($send_to, $subjet, $from, $user_email, $message_text);
$send = true;
}
}
require 'index.view.php';
?>