redo fixes to update.php / contact.php & fix typos in join.php
This commit is contained in:
parent
ec2d3fdd77
commit
1e2da98a5a
|
@ -13,6 +13,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
||||||
$points = (int)0;
|
$points = (int)0;
|
||||||
|
|
||||||
$badwords = file(SPAMWDS);
|
$badwords = file(SPAMWDS);
|
||||||
|
$requiredFields = array("name", "email", "comments");
|
||||||
|
|
||||||
foreach ($badwords as $word)
|
foreach ($badwords as $word)
|
||||||
if (
|
if (
|
||||||
|
@ -52,7 +53,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
||||||
|
|
||||||
$message = "You received this e-mail message through your fanlisting: \n\n";
|
$message = "You received this e-mail message through your fanlisting: \n\n";
|
||||||
foreach ($_POST as $key => $val) {
|
foreach ($_POST as $key => $val) {
|
||||||
$message .= ucwords($key) . ": " . clean($val) . "\r\n";
|
$message .= ucwords($key) . ": " . cleanUp($val) . "\r\n";
|
||||||
}
|
}
|
||||||
$message .= "\r\n";
|
$message .= "\r\n";
|
||||||
$message .= 'IP: '.$_SERVER['REMOTE_ADDR']."\r\n";
|
$message .= 'IP: '.$_SERVER['REMOTE_ADDR']."\r\n";
|
||||||
|
|
4
join.php
4
join.php
|
@ -69,7 +69,7 @@ if (isset($_POST['submit'])) {
|
||||||
$error_msg .= "That name is not valid. Your name must contain letters only, and must be less than 15 characters. \r\n";
|
$error_msg .= "That name is not valid. Your name must contain letters only, and must be less than 15 characters. \r\n";
|
||||||
if ($clean['dispemail'] != "yes" && $clean['dispemail'] != "no")
|
if ($clean['dispemail'] != "yes" && $clean['dispemail'] != "no")
|
||||||
$error_msg .= "You didn't choose whether or not you'd like to show your e-mail address on the member list. \r\n";
|
$error_msg .= "You didn't choose whether or not you'd like to show your e-mail address on the member list. \r\n";
|
||||||
if ($clean['fave'] != "" && (!preg_match("/^[a-zA-Z0-9-'\s]*$/", $clean['face']) || strlen($clean['fave']) > 20))
|
if ($clean['fave'] != "" && (!preg_match("/^[a-zA-Z0-9-'\s]*$/", $clean['fave']) || strlen($clean['fave']) > 20))
|
||||||
$error_msg .= "Your chosen \"favourite\" is not valid. It must contain letters and numbers only, and must be less than 20 characters. \r\n";
|
$error_msg .= "Your chosen \"favourite\" is not valid. It must contain letters and numbers only, and must be less than 20 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($clean['email'])))
|
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($clean['email'])))
|
||||||
$error_msg .= "The email address you have used is not valid. \r\n";
|
$error_msg .= "The email address you have used is not valid. \r\n";
|
||||||
|
@ -175,7 +175,7 @@ if (!isset($_POST['submit']) || $show_form == true) {
|
||||||
if (isset($_POST['country'])) $country = $_POST['country']; else $country = NULL;
|
if (isset($_POST['country'])) $country = $_POST['country']; else $country = NULL;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form action="join.php?p=process" method="post"><p>
|
<form action="join.php" method="post"><p>
|
||||||
<label>Name *</label><br /> <input type="text" id="name" name="name" value="<?php get_data("name"); ?>" /> <br />
|
<label>Name *</label><br /> <input type="text" id="name" name="name" value="<?php get_data("name"); ?>" /> <br />
|
||||||
<label>E-mail *</label><br /> <input type="text" id="email" name="email" value="<?php get_data("email"); ?>" /> <br />
|
<label>E-mail *</label><br /> <input type="text" id="email" name="email" value="<?php get_data("email"); ?>" /> <br />
|
||||||
<label>Display E-mail?</label><br />
|
<label>Display E-mail?</label><br />
|
||||||
|
|
91
update.php
91
update.php
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
if (isset($_GET['p'])) { $page = $_GET['p']; } else { $page = ""; }
|
$show_form = true;
|
||||||
|
$error_msg = NULL;
|
||||||
|
|
||||||
switch ($page) {
|
if (isset($_POST['submit'])) {
|
||||||
case "process":
|
|
||||||
require_once('prefs.php');
|
require_once('prefs.php');
|
||||||
if (isset($captcha) && $captcha == "yes") {
|
if (isset($captcha) && $captcha == "yes") {
|
||||||
session_start();
|
session_start();
|
||||||
|
@ -35,33 +35,59 @@ switch ($page) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$exploits = "/(content-type|bcc:|cc:|document.cookie|onclick|onload)/i";
|
if (isBot() !== false)
|
||||||
foreach ($_POST as $key => $val) {
|
$error_msg .= "No bots please! UA reported as: ".$_SERVER['HTTP_USER_AGENT'] . "\r\n";
|
||||||
$clean[$key] = cleanUp($val);
|
|
||||||
|
|
||||||
if (filesize(SPAMWDS) > 0 && (checkTXTfile(SPAMWDS, $val, "spamword") === true)) {
|
if (substr_count($_POST['comments'], 'http://') > 1)
|
||||||
echo "<p>Your application contains words in the spam list, that means you're not allowed to join at this time. \n</p>";
|
$error_msg .= "Too many URLs; we've assumed you're spam and 'lost' your application. Please try again without any extra URLs if you're a geniune person :)\r\n";
|
||||||
exit(include('footer.php'));
|
|
||||||
|
$exploits = "/(content-type|bcc:|cc:|document.cookie|onclick|onload|javascript|alert)/i";
|
||||||
|
if (filesize(SPAMWDS) > 0) $spamlist = file(SPAMWDS);
|
||||||
|
|
||||||
|
foreach ($_POST as $key => $val) {
|
||||||
|
if (isset($spamlist)) {
|
||||||
|
foreach ($spamlist as $spamword) {
|
||||||
|
if (preg_match("/(".trim($spamword).")/i", $val)) {
|
||||||
|
$error_msg .= "Your updated info contains words in the spam list, please go back and remove references to obvious 'spam' material.\r\n";
|
||||||
}
|
}
|
||||||
if (preg_match($exploits, $val)) {
|
|
||||||
echo "<p>No meta injection, please. \n</p>";
|
|
||||||
exit(include('footer.php'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (preg_match($exploits, $val))
|
||||||
|
$error_msg .= "No meta injection, please.\r\n";
|
||||||
|
|
||||||
|
if (preg_match("/(<.*>)/i", $val))
|
||||||
|
$error_msg .= "No HTML, please.\r\n";
|
||||||
|
|
||||||
|
$clean[$key] = cleanUp($val);
|
||||||
|
}
|
||||||
if ((filesize(MEMBERS) > 0 && checkTXTfile(MEMBERS, breakEmail(strtolower($clean['email'])), "email") === true) || (filesize(NEWBIES) > 0 && checkTXTfile(NEWBIES, breakEmail(strtolower($clean['email'])), "email") === true)) {
|
if ((filesize(MEMBERS) > 0 && checkTXTfile(MEMBERS, breakEmail(strtolower($clean['email'])), "email") === true) || (filesize(NEWBIES) > 0 && checkTXTfile(NEWBIES, breakEmail(strtolower($clean['email'])), "email") === true)) {
|
||||||
if (empty($clean['name']) || empty($clean['email'])) {
|
// set default values for empty/unset fields
|
||||||
echo "<p>Name and e-mail are required fields. Please <a href='javascript:history.back(1)'>go back</a> and try again.\n</p>";
|
if (empty($clean['dispemail']))
|
||||||
exit(include('footer.php'));
|
$clean['dispemail'] = "no";
|
||||||
} elseif (!ereg("^[A-Za-z' -]",$clean['name']) || strlen($clean['name']) > 15) {
|
|
||||||
echo "<p>That name is not valid. Your name must contain letters only, and must be less than 15 characters. Please <a href='javascript:history.back(1)'>go back</a> and try again.\n</p>";
|
if (!isset($favefield) || $favefield == "no" || !isset($clean['fave']))
|
||||||
exit(include('footer.php'));
|
$clean['fave'] = NULL;
|
||||||
} elseif (!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$", strtolower($clean['email']))) {
|
|
||||||
echo "<p>Your old e-mail address is not valid. Please <a href='javascript:history.back(1)'>go back</a> and try again.\n</p>";
|
// let's do some security and spam checks
|
||||||
exit(include('footer.php'));
|
if (empty($clean['name']) || empty($clean['email']) || empty($clean['country']))
|
||||||
} elseif (!empty($clean['newemail']) && !ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$", strtolower($clean['newemail']))) {
|
$error_msg .= "Name, e-mail and country are required fields. \r\n";
|
||||||
echo "<p>Your new e-mail address is not valid. Please <a href='javascript:history.back(1)'>go back</a> and try again.\n</p>";
|
if (!preg_match("/^[a-zA-Z-'\s]*$/", $clean['name']))
|
||||||
exit(include('footer.php'));
|
$error_msg .= "That name is not valid. Your name must contain letters only, and must be less than 15 characters. \r\n";
|
||||||
}
|
if ($clean['dispemail'] != "yes" && $clean['dispemail'] != "no")
|
||||||
|
$error_msg .= "You didn't choose whether or not you'd like to show your e-mail address on the member list. \r\n";
|
||||||
|
if ($clean['fave'] != "" && (!preg_match("/^[a-zA-Z0-9-'\s]*$/", $clean['fave']) || strlen($clean['fave']) > 20))
|
||||||
|
$error_msg .= "Your chosen \"favourite\" is not valid. It must contain letters and numbers only, and must be less than 20 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($clean['email'])))
|
||||||
|
$error_msg .= "The email address you have used is not valid. \r\n";
|
||||||
|
if (!empty($clean['newemail']) && !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($clean['newemail'])))
|
||||||
|
$error_msg .= "The new email address you have used is not valid. \r\n";
|
||||||
|
if (!empty($clean['url']) && !preg_match('/^(http|https):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i', $clean['url']))
|
||||||
|
$error_msg .= "The website url you provided is not valid. Please remove and try again or fix the URL.\r\n";
|
||||||
|
if ($clean['country'] == "null" || (filesize(COUNTRIES) > 0 && checkTXTfile(COUNTRIES, $clean['country'], "country") === false))
|
||||||
|
$error_msg .= "Please select a valid country. \r\n";
|
||||||
|
|
||||||
|
if ($error_msg == NULL) {
|
||||||
|
$show_form = false;
|
||||||
|
|
||||||
$subject = "Update member at $title";
|
$subject = "Update member at $title";
|
||||||
|
|
||||||
|
@ -90,13 +116,14 @@ switch ($page) {
|
||||||
} else {
|
} else {
|
||||||
echo "<h1>Oops!</h1> \n <p>Your updated information could not be sent this time, please contact the fanlisting owner.</p>";
|
echo "<h1>Oops!</h1> \n <p>Your updated information could not be sent this time, please contact the fanlisting owner.</p>";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "<p>You're not a member! Only current members can update their information.</p> \n";
|
echo "<p>You're not a member! Only current members can update their information.</p> \n";
|
||||||
include('footer.php');
|
include('footer.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
default:
|
if (!isset($_POST['submit']) || $show_form == true) {
|
||||||
require_once('prefs.php');
|
require_once('prefs.php');
|
||||||
include_once('header.php');
|
include_once('header.php');
|
||||||
?>
|
?>
|
||||||
|
@ -106,7 +133,14 @@ switch ($page) {
|
||||||
|
|
||||||
<p>(Name, Old E-mail and Country are required fields.)</p>
|
<p>(Name, Old E-mail and Country are required fields.)</p>
|
||||||
|
|
||||||
<form action="update.php?p=process" method="post"><p>
|
<?php
|
||||||
|
if ($error_msg != NULL) {
|
||||||
|
echo "<p><strong style='color: red;'>ERROR:</strong><br />";
|
||||||
|
echo nl2br($error_msg) . "</p>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<form action="update.php" method="post"><p>
|
||||||
<label>Name *</label><br /> <input type="text" id="name" name="name" /> <br />
|
<label>Name *</label><br /> <input type="text" id="name" name="name" /> <br />
|
||||||
<label>Old E-mail *</label><br /> <input type="text" id="email" name="email" /> <br />
|
<label>Old E-mail *</label><br /> <input type="text" id="email" name="email" /> <br />
|
||||||
<label>New E-mail</label><br /> <input type="text" id="newemail" name="newemail" /> <br />
|
<label>New E-mail</label><br /> <input type="text" id="newemail" name="newemail" /> <br />
|
||||||
|
@ -129,7 +163,6 @@ switch ($page) {
|
||||||
</p></form>
|
</p></form>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
include('footer.php');
|
include('footer.php');
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue