-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontact.php
303 lines (265 loc) · 11.9 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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<?php
session_start();
include("scripts/identifiants.php");
$nbr_non_vus = mysql_query("SELECT COUNT(*) AS nbre FROM mp WHERE destinataire='".$_SESSION['pseudo']."' AND vu='0' AND (efface='0' OR efface='2')")or die(mysql_error());
$nbre_non_vus = mysql_fetch_assoc($nbr_non_vus);
// OPTIONS - PLEASE CONFIGURE THESE BEFORE USE!
$yourEmail = "[email protected]"; // the email address you wish to receive these mails through
$yourWebsite = "Mozilla Tunisia Membre"; // the name of your website
$thanksPage = ''; // URL to 'thanks for sending mail' page; leave empty to keep message on the same page
$maxPoints = 4; // max points a person can hit before it refuses to submit - recommend 4
$requiredFields = "name,email,comments"; // names of the fields you'd like to be required as a minimum, separate each field with a comma
// DO NOT EDIT BELOW HERE
$error_msg = null;
$result = null;
$requiredFields = explode(",", $requiredFields);
function clean($data) {
$data = trim(stripslashes(strip_tags($data)));
return $data;
}
function isBot() {
$bots = array("Indy", "Blaiz", "Java", "libwww-perl", "Python", "OutfoxBot", "User-Agent", "PycURL", "AlphaServer", "T8Abot", "Syntryx", "WinHttp", "WebBandit", "nicebot", "Teoma", "alexa", "froogle", "inktomi", "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory", "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot", "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz");
foreach ($bots as $bot)
if (stripos($_SERVER['HTTP_USER_AGENT'], $bot) !== false)
return true;
if (empty($_SERVER['HTTP_USER_AGENT']) || $_SERVER['HTTP_USER_AGENT'] == " ")
return true;
return false;
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if (isBot() !== false)
$error_msg .= "No bots please! UA reported as: ".$_SERVER['HTTP_USER_AGENT'];
// lets check a few things - not enough to trigger an error on their own, but worth assigning a spam score..
// score quickly adds up therefore allowing genuine users with 'accidental' score through but cutting out real spam :)
$points = (int)0;
$badwords = array("adult", "beastial", "bestial", "blowjob", "clit", "cum", "cunilingus", "cunillingus", "cunnilingus", "cunt", "ejaculate", "fag", "felatio", "fellatio", "fuck", "fuk", "fuks", "gangbang", "gangbanged", "gangbangs", "hotsex", "hardcode", "jism", "jiz", "orgasim", "orgasims", "orgasm", "orgasms", "phonesex", "phuk", "phuq", "pussies", "pussy", "spunk", "xxx", "viagra", "phentermine", "tramadol", "adipex", "advai", "alprazolam", "ambien", "ambian", "amoxicillin", "antivert", "blackjack", "backgammon", "texas", "holdem", "poker", "carisoprodol", "ciara", "ciprofloxacin", "debt", "dating", "porn", "link=", "voyeur", "content-type", "bcc:", "cc:", "document.cookie", "onclick", "onload", "javascript");
foreach ($badwords as $word)
if (
strpos(strtolower($_POST['comments']), $word) !== false ||
strpos(strtolower($_POST['name']), $word) !== false
)
$points += 2;
if (strpos($_POST['comments'], "http://") !== false || strpos($_POST['comments'], "www.") !== false)
$points += 2;
if (isset($_POST['nojs']))
$points += 1;
if (preg_match("/(<.*>)/i", $_POST['comments']))
$points += 2;
if (strlen($_POST['name']) < 3)
$points += 1;
if (strlen($_POST['comments']) < 15 || strlen($_POST['comments'] > 1500))
$points += 2;
// end score assignments
foreach($requiredFields as $field) {
trim($_POST[$field]);
if (!isset($_POST[$field]) || empty($_POST[$field]))
$error_msg .= "Please fill in all the required fields and submit again.\r\n";
}
if (!preg_match("/^[a-zA-Z-'\s]*$/", stripslashes($_POST['name'])))
$error_msg .= "The name field must not contain special characters.\r\n";
if (!preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])(([a-z0-9-])*([a-z0-9]))+' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i', strtolower($_POST['email'])))
$error_msg .= "That is not a valid e-mail address.\r\n";
if (!empty($_POST['url']) && !preg_match('/^(http|https):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i', $_POST['url']))
$error_msg .= "Invalid website url.\r\n";
if ($error_msg == NULL && $points <= $maxPoints) {
$subject = "Automatic Form Email";
$message = "You received this e-mail message through your website: \n\n";
foreach ($_POST as $key => $val) {
$message .= ucwords($key) . ": " . clean($val) . "\r\n";
}
$message .= "\r\n";
$message .= 'IP: '.$_SERVER['REMOTE_ADDR']."\r\n";
$message .= 'Browser: '.$_SERVER['HTTP_USER_AGENT']."\r\n";
$message .= 'Points: '.$points;
if (strstr($_SERVER['SERVER_SOFTWARE'], "Win")) {
$headers = "From: $yourEmail\n";
$headers .= "Reply-To: {$_POST['email']}";
} else {
$headers = "From: $yourWebsite <$yourEmail>\n";
$headers .= "Reply-To: {$_POST['email']}";
}
if (mail($yourEmail,$subject,$message,$headers)) {
if (!empty($thanksPage)) {
header("Location: $thanksPage");
exit;
} else {
$result = 'Your mail was successfully sent.';
$disable = true;
}
} else {
$error_msg = 'Your mail could not be sent this time. ['.$points.']';
}
} else {
if (empty($error_msg))
$error_msg = 'Your mail looks too much like spam, and could not be sent this time. ['.$points.']';
}
}
function get_data($var) {
if (isset($_POST[$var]))
echo htmlspecialchars($_POST[$var]);
}
?>
<!DOCTYPE html>
<title>Mozilla Tunisia | Home</title>
<head>
<meta http-equiv="Content-Language" content="fr,en" />
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr">
<link rel="stylesheet" href="styles/elegant-press.css" type="text/css" />
<script src="scripts/elegant-press.js" type="text/javascript"></script>
<!--[if IE]><style>#header h1 a:hover{font-size:75px;}</style><![endif]-->
<link href="tab/css/tabzilla.css" rel="stylesheet" />
<script src="tab/js/tabzilla.js"></script>
</head>
<body>
<a href="http://www.mozilla.org/" id="tabzilla">mozilla</a>
<div class="main-container">
<header>
<h1><a href="index.php">Mozilla Tunisia</a></h1>
<p id="tagline"><strong>Mozilla Tunisia Member</strong></p>
</header>
</div>
<div id="login-box" class="ten columns phone-three pull-one-phone pull-two">
<?php echo'<a href="./profil.php?m='.intval($_SESSION['id']).'">'.stripslashes(htmlspecialchars($_SESSION['prenom'])).' '.stripslashes(htmlspecialchars($_SESSION['nom'])).'</a>';
if (isset($_SESSION['pseudo'])) // Si le membre est connecté
{
?>
[<a href="deconnexion.php">Sign Out</a>]
<?php
}
else
{?>
<a href="connexion.php">Sign In</a>
<?php } ?>
</div>
<div class="main-container">
<div id="sub-headline">
<!--<div class="tagline_left"><p id="tagline2">Tel: 123 333 4444 | Mail: <a href="mailto:[email protected]">[email protected]</a></p></div>-->
<div class="tagline_right">
<form action="#" method="post">
<fieldset>
<legend>Site Search</legend>
<input type="text" value="Search Our Website…" onfocus="if (this.value == 'Search Our Website…') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search Our Website…';}"/>
<input type="submit" name="go" id="go" value="Search" />
</fieldset>
</form>
</div>
<br class="clear" />
</div>
</div>
<div class="main-container">
<div id="nav-container">
<nav>
<ul class="nav">
<li><a href="index.php">Home</a></li>
<li><a href="membre.php">Membre</a></li>
<!--<li><a href="portfolio.html">Portfolio</a></li>
<li><a href="gallery.html">Gallery</a></li>-->
<li><a href="./events/">Events</a></li>
<li><a href="./calendar/all">Calendrier</a></li>
<li class="active"><a href="contact.php">Contact</a></li>
<?php if (isset($_SESSION['pseudo'])) // Si le membre est connecté
{ ?>
<li><a href="./mp.php">Messages(<?php echo $nbre_non_vus['nbre'];?>)</a>
<ul>
<li><a href="./mp.php">Boite de réception</a>
<li><a href="./mp.php?action=ecrire">Nouveau Message</a></li>
<li><a href="./mp.php?action=LireMpRecu">Message Envoyer</a></li>
<li><a href="./mp.php?action=Corbeil">Message Supprimer</a></li>
</ul>
</li>
<?php }?>
</ul>
</nav>
<div class="clear"></div>
</div>
</div>
<div class="main-container">
<div class="container1">
<div id="breadcrumb">
<ul>
<li class="first">You Are Here</li>
<li>»</li>
<li><a href="index.php">Homepage</a></li>
<li>»</li>
<li class="current"><a href="contact.php">Contact</a></li>
</ul>
</div>
<br />
<br />
<div class="box">
<div class="content">
<h1>Headline: Contact Us</h1>
<?php
if ($error_msg != NULL) {
echo '<p class="error">ERROR: '. nl2br($error_msg) . "</p>";
}
if ($result != NULL) {
echo '<p class="success">'. $result . "</p>";
}
?>
<form action="<?php echo basename(__FILE__); ?>" method="post">
<noscript>
<p><input type="hidden" name="nojs" id="nojs" /></p>
</noscript>
<br />
<p>
<input type="text" name="name" id="name" value="<?php get_data("name"); ?>" size="22" />
<label for="name"><small>Name (required)</small></label>
</p>
<p>
<input type="text" name="email" id="email" value="<?php get_data("email"); ?>" size="22" />
<label for="email"><small>Mail (required)</small></label>
</p>
<p>
<textarea name="comments" id="comments" rows="10"><?php get_data("comments"); ?></textarea>
<label for="comments" style="display:none;"><small>Comment (required)</small></label>
</p>
<p>
<input name="submit" type="submit" id="submit" value="Submit Form" <?php if (isset($disable) && $disable === true) echo ' disabled="disabled"'; ?> />
<input name="reset" type="reset" id="reset" tabindex="5" value="Reset Form" />
</p>
</form>
</div>
<div class="sidebar">
<div id="featured">
<ul>
<li>
<h5>Widget</h5>
<p><iframe width="220" height="350" src="http://maps.google.com/maps?q=701+first+ave+sunnyvale+ca&ie=UTF8&hl=en&hq=&hnear=701+1st+Ave,+Sunnyvale,+California+94089&z=14&ll=37.41696,-122.02531&output=embed"></iframe><br /><small><a href="http://maps.google.com/maps?q=701+first+ave+sunnyvale+ca&ie=UTF8&hl=en&hq=&hnear=701+1st+Ave,+Sunnyvale,+California+94089&z=14&ll=37.41696,-122.02531&source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small></p>
</li>
</ul>
</div>
<div class="subnav">
<h5>Follow Us!</h5>
<ul>
<li><a href="#">Facebook</a></li>
<li><a href="#">Twitter</a></li>
<li><a href="#">Linkedin</a></li>
</ul>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<div class="main-container">
</div>
<div style="position:fixed;left:30px;top:90%;" title="Clickez pour signaler un problème">
<a href="404/bug.php"><img src="images/bug.png" alt="Logo" /></a>
</div>
<footer>
<table>
<tr>
<td><img src="images/logo.png" alt="Logo" /></td>
<td><p class="tagline_left">Copyright © 2012 - All Rights Reserved - <a href="http://mozilla-tunisia.org">Mozilla Tunisia</a></p></td>
</tr>
</table>
<!--<p class="tagline_right">Design by <a href="http://www.priteshgupta.com/" title="Pritesh Gupta" target="_blank" >PriteshGupta.com</a></p>-->
<br class="clear" />
</footer>
<br />
<br />
<!-- Free template distributed by http://freehtml5templates.com -->
</div>
</body>
</html>