-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.php
More file actions
92 lines (59 loc) · 2.8 KB
/
Copy pathprocess.php
File metadata and controls
92 lines (59 loc) · 2.8 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php session_start();
if(!$_POST) exit;
if (!defined("PHP_EOL")) define("PHP_EOL", "\r\n");
$name = $_POST['name'];
$email = $_POST['email'];
$message = htmlspecialchars($_POST['message']);
//sumbission data
$ipaddress = $_SERVER['REMOTE_ADDR'];
$dateTime = new DateTime('now', new DateTimeZone('Europe/Stockholm'));
$date = $dateTime->format('d/m/Y');
$time = $dateTime->format('H:i:s');
if (isset($_POST['verify'])) :
$posted_verify = $_POST['verify'];
$posted_verify = md5($posted_verify);
else :
$posted_verify = '';
endif;
// Important Variables
$session_verify = $_SESSION['verify'];
if (empty($session_verify)) $session_verify = $_COOKIE['verify'];
if(!isEmail($email)) {
echo '<font color="#343642">Error: You have entered an invalid e-mail address.</font>';
exit();
} else if($session_verify != $posted_verify) {
echo '<font color="#343642">Error: the verification code you entered is incorrect.</font>';
exit();
}
if($error == '') {
// Configuration options.
//Send to address
$address = "timothy.dubois@chalmers.se,bensved@chalmers.se";
// Configuration option.
// i.e. The standard subject will appear as, "You've been contacted by John Doe."
// Example, $e_subject = '$name . ' has contacted you via Your Website.';
$e_subject = 'Veritas Website contact from ' . $name . '.';
// Configuration option.
// You can change this if you feel that you need to.
// Developers, you may wish to add more fields to the form, in which case you must be sure to add them here.
$e_body = "We have been contacted by $name through the Veritas Website contact form." . PHP_EOL . PHP_EOL;
$e_content = "<p><strong>Name: </strong> {$name} </p>
<p><strong>Email Address: </strong> {$email} </p>";
$e_content .= "<p><strong>Message: </strong> {$message} </p>" . PHP_EOL . PHP_EOL;
$e_footer = "<p>This message was sent from the IP Address: {$ipaddress} on {$date} at {$time}</p>";
$msg = wordwrap($e_body . $e_content . $e_footer,70);
$headers = "From: Veritas <noreply@veritas.software>" . PHP_EOL;
$headers .= "Reply-To: $email" . PHP_EOL;
$headers .= "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-type: text/html; charset=iso-8859-1" . PHP_EOL;
if(mail($address, $e_subject, $msg, $headers)) {
// Email has sent successfully, echo a success page.
echo "<p>Thanks for your message <strong>$name</strong>.<br>We'll get back to you as soon as possible.</p>";
} else {
echo 'ERROR!';
}
}
function isEmail($email) { // Email address verification, do not edit.
return(filter_var($email, FILTER_VALIDATE_EMAIL));
}
?>