-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeedback.php
154 lines (130 loc) · 5.55 KB
/
feedback.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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php /*
IMPORTANT: If you see this notice in your web browser when you
test your feedback form, it means that your web host does not
have PHP set up correctly, even if they tell you they have.
This is a PHP script, which means your web server must have PHP
installed for it to work. You should *never* be able to see this
notice in a browser on a website with a working PHP system,
not even when you use "View Source" in your browser.
CHFEEDBACK.PHP Feedback Form PHP Script Ver 2.17.3
Generated by thesitewizard.com's Feedback Form Wizard 2.17.4.
Copyright 2000-2015 by Christopher Heng. All rights reserved.
thesitewizard is a trademark of Christopher Heng.
Get the latest version, free, from:
http://www.thesitewizard.com/wizards/feedbackform.shtml
You can read the Frequently Asked Questions (FAQ) at:
http://www.thesitewizard.com/wizards/faq.shtml
I can be contacted at:
http://www.thesitewizard.com/feedback.php
Note that I do not have the time to respond to questions
that have already been answered in the FAQ, so *please* read
the FAQ.
LICENCE TERMS
1. You may use this script on your website, with or
without modifications, free of charge.
2. You may NOT distribute or republish this script,
whether modified or not. The script can only be
distributed by the author, Christopher Heng.
3. THE SCRIPT AND ITS DOCUMENTATION ARE PROVIDED
"AS IS", WITHOUT WARRANTY OF ANY KIND, NOT EVEN THE
IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE. YOU AGREE TO BEAR ALL RISKS AND
LIABILITIES ARISING FROM THE USE OF THE SCRIPT,
ITS DOCUMENTATION AND THE INFORMATION PROVIDED BY THE
SCRIPTS AND THE DOCUMENTATION.
If you cannot agree to any of the above conditions, you
may not use the script.
Although it is not required, I will be most grateful
if you could also link to http://www.thesitewizard.com/
Please do not remove any of the above. Don't worry.
If your web host has installed PHP correctly on their
system, neither this notice nor anything you see below
will be displayed in your visitor's web browser. */
// ------------- CONFIGURABLE SECTION ------------------------
$mailto = '[email protected]' ;
$subject = "www.nancyhawa.com - Response" ;
$formurl = "http://www.nancyhawa.com/contact.html" ;
$thankyouurl = "http://www.nancyhawa.com/thank_you.html" ;
$errorurl = "http://www.nancyhawa.com/error.html" ;
$email_is_required = 1;
$name_is_required = 1;
$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'] ;
$http_referrer = getenv( "HTTP_REFERER" );
if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (($email_is_required && (empty($email) || !preg_match('/@/', $email))) || ($name_is_required && empty($fullname)) || ($comments_is_required && empty($comments))) {
header( "Location: $errorurl" );
exit ;
}
if ( preg_match( "/[\r\n]/", $fullname ) || preg_match( "/[\r\n]/", $email ) ) {
header( "Location: $errorurl" );
exit ;
}
/*
if (strlen( $my_recaptcha_private_key )) {
$recaptcha_url = 'https://www.google.com/recaptcha/api/siteverify?' .
'secret=' . urlencode($my_recaptcha_private_key) . '&' .
'remoteip=' . urlencode($_SERVER['REMOTE_ADDR']) . '&' .
'v=' . "php_1.0" . '&' .
'response=' . urlencode($_POST['g-recaptcha-response']) ;
$recaptcha_reply = file_get_contents( $recaptcha_url );
$recaptcha_decoded = json_decode ( $recaptcha_reply, TRUE );
if ($recaptcha_decoded == NULL || (trim($recaptcha_decoded['success']) != TRUE)) {
header( "Location: $errorurl" );
exit ;
}
}
*/
if (empty($email)) {
$email = $mailto ;
}
$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.17.3" .
$headersep . 'MIME-Version: 1.0' . $headersep . $content_type ;
if ($use_envsender) {
mail($mailto, $subject, $messageproper, $headers, $envsender );
}
else {
mail($mailto, $subject, $messageproper, $headers );
}
header( "Location: $thankyouurl" );
exit ;
?>