-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform-process.php
More file actions
executable file
·51 lines (39 loc) · 1.02 KB
/
Copy pathform-process.php
File metadata and controls
executable file
·51 lines (39 loc) · 1.02 KB
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
<?php
$errorMSG = "";
$name = "";
$song = "";
// NAME
if (empty($_POST["name"]) || !preg_match("/^[A-Za-z .'-]+$/", $_POST['name'])) {
$errorMSG = "C'est un prénom correct? ";
} else {
$name = trim(strip_tags($_POST["name"]));
}
// SONG
if (empty($_POST["song"]) || !preg_match("/^[A-Za-z0-9 .'-]+$/", $_POST['song'])) { // || preg_match($string_exp, $_POST['song'])
$errorMSG .= "Il me semble pas que c'est une bonne chanson :(";
} else {
$song = trim(strip_tags($_POST["song"]));
}
$EmailTo = "anastasia.oudin@gmail.com";
$Subject = "New Wedding Song";
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $name;
$Body .= "\n";
$Body .= "Song: ";
$Body .= $song;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From:".$name);
// redirect to success page
if ($success && $errorMSG == ""){
echo "success";
}else{
if($errorMSG == ""){
echo "Il y a une erreur :(";
} else {
echo $errorMSG;
}
}
?>