-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeedback.html
112 lines (93 loc) · 3.22 KB
/
feedback.html
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
// ------------- CONFIGURABLE SECTION ------------------------
$mailto = 'info@klaceenglish.com' ;
$subject = "Contact Form" ;
//$fullurl = "http://www.klaceenglish.com";
$fullurl = ".";
$formurl = $fullurl . "/contact.html" ;
$thankyouurl = $fullurl . "/thankyou.html" ;
$errorurl = $fullurl . "/contact.html" ;
$email_is_required = 1;
$name_is_required = 0;
$comments_is_required = 1;
$uself = 0;
$forcelf = 0;
$use_envsender = 0;
$use_sendmailfrom = 0;
$smtp_server_win = '' ;
$use_webmaster_email_for_from = 0;
$use_utf8 = 1;
$my_recaptcha_private_key = '' ;
// -------------------- END OF CONFIGURABLE SECTION ---------------
define( 'MAX_LINE_LENGTH', 998 );
$headersep = $uself ? "\n" : "\r\n" ;
$content_nl = $forcelf ? "\n" : (defined('PHP_EOL') ? PHP_EOL : "\n") ;
$content_type = $use_utf8 ? 'Content-Type: text/plain; charset="utf-8"' : 'Content-Type: text/plain; charset="iso-8859-1"' ;
if ($use_sendmailfrom) {
ini_set( 'sendmail_from', $mailto );
}
if (strlen($smtp_server_win)) {
ini_set( 'SMTP', $smtp_server_win );
}
$envsender = "-f$mailto" ;
$fullname = isset($_POST['fullname']) ? $_POST['fullname'] : $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$message = $_POST['message'] ;
$copy = $_POST['copy'];
$http_referrer = getenv( "HTTP_REFERER" );
if (!isset($_POST['email'])) {
echo "please enter your email";
exit ;
}
if (($email_is_required && (empty($email) || !preg_match('/@/', $email))) || ($name_is_required && empty($fullname)) || ($comments_is_required && empty($comments))) {
echo "please enter your name, email and a message";
exit ;
}
if ( preg_match( "/[\r\n]/", $fullname ) || preg_match( "/[\r\n]/", $email ) ) {
echo "please enter your name, email and a message";
exit ;
}
if (strlen( $my_recaptcha_private_key )) {
$resp = recaptcha_check_answer ( $my_recaptcha_private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] );
if (!$resp->is_valid) {
echo "wrong captcha";
exit ;
}
}
if (!empty($message)) {
echo "ok";
exit ;
}
if (empty($email)) {
$email = $mailto ;
} else {
if ($copy) {
$mailto = $mailto . ', ' . $email;
}
}
$fromemail = $use_webmaster_email_for_from ? $mailto : $email ;
if (function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}
$messageproper =
"This message was sent from:" . $content_nl .
"$http_referrer" . $content_nl .
"------------------------------------------------------------" . $content_nl .
"Name of sender: $fullname" . $content_nl .
"Email of sender: $email" . $content_nl .
"------------------------- COMMENTS -------------------------" . $content_nl . $content_nl .
wordwrap( $comments, MAX_LINE_LENGTH, $content_nl, true ) . $content_nl . $content_nl .
"------------------------------------------------------------" . $content_nl ;
$headers =
"From: \"$fullname\" <$fromemail>" . $headersep . "Reply-To: \"$fullname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.16.8" .
$headersep . 'MIME-Version: 1.0' . $headersep . $content_type ;
if ($use_envsender) {
mail($mailto, $subject, $messageproper, $headers, $envsender );
}
else {
mail($mailto, $subject, $messageproper, $headers );
}
echo "ok";
exit ;
?>