From 98d726fc4ea656c1a6b8ded5c337234a63c1a71d Mon Sep 17 00:00:00 2001 From: Paradox Date: Mon, 28 Dec 2009 14:47:57 -0500 Subject: [PATCH] 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 --- .../Expanded/db.conf.php.dist | 2 +- contrib/registration_form/Expanded/index.php | 58 +++++++------- contrib/registration_form/simple/index.php | 77 +++++++------------ 3 files changed, 58 insertions(+), 79 deletions(-) diff --git a/contrib/registration_form/Expanded/db.conf.php.dist b/contrib/registration_form/Expanded/db.conf.php.dist index c82aa00ad25..05d0ee1e7b0 100644 --- a/contrib/registration_form/Expanded/db.conf.php.dist +++ b/contrib/registration_form/Expanded/db.conf.php.dist @@ -15,4 +15,4 @@ $title2 = "Some Server"; // End config. -?> \ No newline at end of file +?> diff --git a/contrib/registration_form/Expanded/index.php b/contrib/registration_form/Expanded/index.php index 0547d1acf1e..c3abef3bea6 100644 --- a/contrib/registration_form/Expanded/index.php +++ b/contrib/registration_form/Expanded/index.php @@ -122,17 +122,17 @@ Username:
help
Password:
help -
-
-
-

+
+
+
+


Email: -
help
-Original - -TBC - -WOTLK
-
+
help
+Original - +TBC - +WOTLK
+
New question
help

@@ -144,8 +144,8 @@ Password: '; function error_s ($text) { - echo("

" . $text); - echo("

Go back...

"); + echo("

" . $text); + echo("

Go back...

"); }; $user_chars = "#[^a-zA-Z0-9_\-]#"; @@ -153,13 +153,13 @@ $email_chars = "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[ $con = @mysql_connect($ip, $user, $pass); if (!$con) { - error_s("Unable to connect to database: " . mysql_error()); + error_s("Unable to connect to database: " . mysql_error()); }; if (!empty($_POST)) { if ((empty($_POST["username"]))||(empty($_POST["password"]))||(empty($_POST["email"]))||(empty($_POST["expansion"])) ) { error_s("You did not enter all the required information."); - exit(); + exit(); } else { $username = strtoupper($_POST["username"]); $password = strtoupper($_POST["password"]); @@ -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(); }; @@ -204,9 +204,9 @@ if (!empty($_POST)) { $password = mysql_real_escape_string($password); $email = mysql_real_escape_string($email); $qry = @mysql_query("select username from " . mysql_real_escape_string($r_db) . ".account where username = '" . $username . "'", $con); - if (!$qry) { - error_s("Error querying database: " . mysql_error()); - }; + if (!$qry) { + error_s("Error querying database: " . mysql_error()); + }; if ($existing_username = mysql_fetch_assoc($qry)) { foreach ($existing_username as $key => $value) { $existing_username = $value; @@ -217,11 +217,11 @@ if (!empty($_POST)) { error_s("That username is already taken."); exit(); }; - unset($qry); + unset($qry); $qry = @mysql_query("select email from " . mysql_real_escape_string($r_db) . ".account where email = '" . $email . "'", $con); - if (!$qry) { - error_s("Error querying database: " . mysql_error()); - }; + if (!$qry) { + error_s("Error querying database: " . mysql_error()); + }; if ($existing_email = mysql_fetch_assoc($qry)) { foreach ($existing_email as $key => $value) { $existing_email = $value; @@ -231,16 +231,16 @@ if (!empty($_POST)) { error_s("That email is already in use."); exit(); }; - unset($qry); + 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 . "','" . $expansion . "')"; - if (isset($_POST['AnimCaptcha'])) + if (isset($_POST['AnimCaptcha'])) { if (is_numeric($_POST['AnimCaptcha'])) { if ( $_POST['AnimCaptcha'] == $_SESSION['answer']) { - $qry = @mysql_query($register_sql, $con); + $qry = @mysql_query($register_sql, $con); } else { @@ -250,15 +250,15 @@ if (!empty($_POST)) { } else { - error_s("

Enter Numbers or (+/-) only. No alphabetical characters accepted.

Try again

"); + error_s("

Enter Numbers or (+/-) only. No alphabetical characters accepted.

Try again

"); exit(); } } if (!$qry) { - error_s("Error creating account: " . mysql_error()); - }; + error_s("Error creating account: " . mysql_error()); + }; echo("Account successfully created."); - exit(); + exit(); }; } else { echo($page); diff --git a/contrib/registration_form/simple/index.php b/contrib/registration_form/simple/index.php index 849b7898ced..f1758f9e998 100644 --- a/contrib/registration_form/simple/index.php +++ b/contrib/registration_form/simple/index.php @@ -1,18 +1,6 @@ @@ -30,9 +18,12 @@ Username: Password:

Email: -
-
TBC
-
WOTLK


+
+
+Original - +TBC - +WOTLK
+


@@ -40,8 +31,8 @@ Email: '; function error_s ($text) { - echo("

" . $text); - echo("

Go back...

"); + echo("

" . $text); + echo("

Go back...

"); }; $user_chars = "#[^a-zA-Z0-9_\-]#"; @@ -49,17 +40,18 @@ $email_chars = "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[ $con = @mysql_connect($ip, $user, $pass); if (!$con) { - error_s("Unable to connect to database: " . mysql_error()); + error_s("Unable to connect to database: " . mysql_error()); }; 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(); + 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,26 +88,13 @@ 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); $qry = @mysql_query("select username from " . mysql_real_escape_string($r_db) . ".account where username = '" . $username . "'", $con); - if (!$qry) { - error_s("Error querying database: " . mysql_error()); - }; + if (!$qry) { + error_s("Error querying database: " . mysql_error()); + }; if ($existing_username = mysql_fetch_assoc($qry)) { foreach ($existing_username as $key => $value) { $existing_username = $value; @@ -126,11 +105,11 @@ if (!empty($_POST)) { error_s("That username is already taken."); exit(); }; - unset($qry); + unset($qry); $qry = @mysql_query("select email from " . mysql_real_escape_string($r_db) . ".account where email = '" . $email . "'", $con); - if (!$qry) { - error_s("Error querying database: " . mysql_error()); - }; + if (!$qry) { + error_s("Error querying database: " . mysql_error()); + }; if ($existing_email = mysql_fetch_assoc($qry)) { foreach ($existing_email as $key => $value) { $existing_email = $value; @@ -140,15 +119,15 @@ if (!empty($_POST)) { error_s("That email is already in use."); exit(); }; - unset($qry); + 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()); - }; + if (!$qry) { + error_s("Error creating account: " . mysql_error()); + }; echo("Account successfully created."); - exit(); + exit(); }; } else { echo($page);