-
Notifications
You must be signed in to change notification settings - Fork 2
/
contact.php
59 lines (53 loc) · 1.51 KB
/
contact.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
55
56
57
58
59
<?php
$contact = new User;
if (isset($_POST['submit'])) {
//echo "<pre>";print_r($_POST);echo "</pre>";
echo $name = $contact->secure($_POST['f1']);
echo$phone = $contact->secure($_POST['f2']);
echo$email = $contact->secure($_POST['f3']);
echo$message = $contact->secure($_POST['f5']);
$subj = $contact->secure($_POST['f1']);
if (!empty($name)&&!empty($phone)&&!empty($email)&&!empty($country)&&!empty($message)) {
if (!$contact->EmailValidate($email)) {
echo "failed email";
header("Location: ../contact-us.php?message=invalidemail");
exit();
}elseif (!$contact->NamesValidate($name)) {
header("Location: contact-us.php?message=invalidenames");
exit();
echo "failed name";
}elseif (!$contact->NamesValidate($country)) {
# code...
header("Location: contact-us.php?message=invalidcountry");
exit();
}
/*elseif (!$contact->ValidateMobile($phone)) {
echo "failed phone";
}*/
else{
$subject = 'Silent Pips Contact Us';
$to='[email protected]';
$message = ''.$subj.'
Names: '.$name.'
Email: '.$email.'
Phone: '.$phone.'
Country: '.$country.'
'.$message;
$headers = "From: Silentpipsfx.com Contact"." <".$email.">";
if(mail($to, $subject, $message,$headers)){
header("Location: contact-us.php?message=done");
exit();
}else{
header("Location: contact-us.php?message=failed");
exit();
}
}
}else{
header("Location: contact-us.php?message=emptyfield");
exit();
}
}else{
header("Location: contact-us.php?message=error");
exit();
}
?>