Make config a separate file for simple reg page as it already was for expanded

Set WOTLK as default expansion and fix simple reg for WOTLK
Fix expanded reg to properly display captcha
Allow 255 characters for email
Replace tabs with spaces

--HG--
branch : trunk
This commit is contained in:
Paradox
2009-12-28 14:47:57 -05:00
parent afde5e0207
commit 98d726fc4e
3 changed files with 58 additions and 79 deletions
+6 -6
View File
@@ -128,11 +128,11 @@ Password:
</div></p>
<br />
<p style="text-align:center;">Email:
<br /><input name="email" type="text" maxlength="50" /><img src="inc/help.gif" HEIGHT="20" WIDTH="20" alt="help" onMouseover="ttip(\'Email must be 15 - 50 chars long\', 300)"; onMouseout="hidettip()"><br />
<br /><input name="email" type="text" maxlength="255" /><img src="inc/help.gif" HEIGHT="20" WIDTH="20" alt="help" onMouseover="ttip(\'Email must be 15 - 50 chars long\', 300)"; onMouseout="hidettip()"><br />
<INPUT TYPE=RADIO NAME="expansion" VALUE="0" >Original -
<INPUT TYPE=RADIO NAME="expansion" VALUE="1" CHECKED >TBC -
<INPUT TYPE=RADIO NAME="expansion" VALUE="2" >WOTLK<br />
<img src="inc/OOP5.php" style="border: 1px dashed silver;"><br />
<INPUT TYPE=RADIO NAME="expansion" VALUE="1" >TBC -
<INPUT TYPE=RADIO NAME="expansion" VALUE="2" CHECKED >WOTLK<br />
<img src="inc/index.php" style="border: 1px dashed silver;"><br />
<span style="font-size:9px;"><a href="">New question</a></span><br />
<input type="text" style="width:160px;" name="AnimCaptcha"><img src="inc/help.gif" HEIGHT="20" WIDTH="20" alt="help" onMouseover="ttip(\'Are you a bot? are you? thats it...im getting my junior torturer kit, dont go anywhere i\'ll be right back.\', 300)"; onMouseout="hidettip()"><br />
<br />
@@ -180,11 +180,11 @@ if (!empty($_POST)) {
error_s("Password too long.");
exit();
};
if (strlen($email) < 15) {
if (strlen($email) < 4) {
error_s("Email was too short.");
exit();
};
if (strlen($email) > 50) {
if (strlen($email) > 255) {
error_s("Email was too long.");
exit();
};
+12 -33
View File
@@ -1,18 +1,6 @@
<?php
// Configuration.
// Realm database.
$r_db = "realmd";
// IP (and port).
$ip = "127.0.0.1:3306";
// Username.
$user = "trinity";
// Password.
$pass = "trinity";
// Site title.
$title = "Registration Form";
$title2 = "Some Server";
// End config.
include("db.conf.php");
$page = '<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -30,9 +18,12 @@ Username:
Password:
<br /><input name="password" type="password" maxlength="12" /><br />
Email:
<br /><input name="email" type="text" maxlength="50" />
<br /><input name="tbc" type="checkbox" /> TBC<br />
<br /><input name="wotlk" type="checkbox" checked="checked" /> WOTLK<br /><br /><br />
<br /><input name="email" type="text" maxlength="255" />
<br />
<INPUT TYPE=RADIO NAME="expansion" VALUE="0" >Original -
<INPUT TYPE=RADIO NAME="expansion" VALUE="1" >TBC -
<INPUT TYPE=RADIO NAME="expansion" VALUE="2" CHECKED >WOTLK<br />
<br /><br /><br />
<button type="submit">Submit</button>
</p>
</form>
@@ -53,13 +44,14 @@ if (!$con) {
};
if (!empty($_POST)) {
if ((empty($_POST["username"]))||(empty($_POST["password"]))||(empty($_POST["email"]))||((empty($_POST["tbc"]) && (empty($_POST["wotlk"])))) ) {
if ((empty($_POST["username"]))||(empty($_POST["password"]))||(empty($_POST["email"]))||(empty($_POST["expansion"])) ) {
error_s("You did not enter all the required information.");
exit();
} else {
$username = strtoupper($_POST["username"]);
$password = strtoupper($_POST["password"]);
$email = strtoupper($_POST["email"]);
$expansion = $_POST["expansion"];
if (strlen($username) < 5) {
error_s("Username too short.");
exit();
@@ -76,11 +68,11 @@ if (!empty($_POST)) {
error_s("Password too long.");
exit();
};
if (strlen($email) < 15) {
if (strlen($email) < 4) {
error_s("Email was too short.");
exit();
};
if (strlen($email) > 50) {
if (strlen($email) > 255) {
error_s("Email was too long.");
exit();
};
@@ -96,19 +88,6 @@ if (!empty($_POST)) {
error_s("Email was in an incorrect format.");
exit();
};
if (($_POST["tbc"] == "on") && ($_POST["wotlk"] == "on")) {
error_s("TBC and WOTLK were both checked.");
exit();
};
if ($_POST["tbc"] != "on") {
if ($_POST["wotlk"] != "on") {
$exp = "0";
} else {
$exp = "2";
};
} else {
$exp = "1";
};
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
$email = mysql_real_escape_string($email);
@@ -142,7 +121,7 @@ if (!empty($_POST)) {
};
unset($qry);
$sha_pass_hash = sha1(strtoupper($username) . ":" . strtoupper($password));
$register_sql = "insert into " . mysql_real_escape_string($r_db) . ".account (username, sha_pass_hash, email, expansion) values (upper('" . $username . "'),'" . $sha_pass_hash . "','" . $email . "','" . $exp . "')";
$register_sql = "insert into " . mysql_real_escape_string($r_db) . ".account (username, sha_pass_hash, email, expansion) values (upper('" . $username . "'),'" . $sha_pass_hash . "','" . $email . "','" . $expansion . "')";
$qry = @mysql_query($register_sql, $con);
if (!$qry) {
error_s("Error creating account: " . mysql_error());