-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmit.php
More file actions
46 lines (37 loc) · 1.15 KB
/
Copy pathsubmit.php
File metadata and controls
46 lines (37 loc) · 1.15 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
<?php
// if the url field is empty, but the message field isn't
if(isset($_POST['url']) && $_POST['url'] == '' && $_POST['message'] != ''){
// my email address here
$youremail = 'lba_2@yahoo.com';
$body = "Submitted from my portfolio page:
Name: $_POST[name]
E-Mail: $_POST[email]
Message: $_POST[message]";
// Use the submitters email if they supplied one
// (and it isn't trying to hack my form).
// Otherwise send from my email address.
if( $_POST['email'] && !preg_match( "/[\r\n]/", $_POST['email']) ) {
$headers = "From: $_POST[email]";
} else {
$headers = "From: $youremail";
}
// finally, send the message
mail($youremail, 'Contact Form', $body, $headers );
}
// otherwise, let the spammer think that they got their message through
// uncomment these lines to redirect instead of displaying HTML
//header('Location: http://www.mysite.com/thankyou.html');
//exit('Redirecting you to http://www.mysite.com/thankyou.html');
echo 'Thank you!';
?>
<!-- <!DOCTYPE HTML>
<html lang="en">
<head>
<title>Thanks!</title>
<meta charset="utf-8">
</head>
<body>
<h1>Thanks</h1>
<p>We'll get back to you as soon as possible.</p>
</body>
</html> -->