diff options
author | Paradox <iamparadox@netscape.net> | 2009-12-28 14:47:57 -0500 |
---|---|---|
committer | Paradox <iamparadox@netscape.net> | 2009-12-28 14:47:57 -0500 |
commit | 98d726fc4ea656c1a6b8ded5c337234a63c1a71d (patch) | |
tree | 68e6d9a66191139b9209c1df1460cdb6cd0832e4 | |
parent | afde5e02074be4848c6646f5d2c39647d68550b4 (diff) |
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
-rw-r--r-- | contrib/registration_form/Expanded/db.conf.php.dist | 2 | ||||
-rw-r--r-- | contrib/registration_form/Expanded/index.php | 58 | ||||
-rw-r--r-- | 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: <br /><input name="username" type="text" maxlength="14" /><img src="inc/help.gif" HEIGHT="20" WIDTH="20" alt="help" onMouseover="ttip(\'username must be 5 - 14 chars long\', 300)"; onMouseout="hidettip()"><br /> Password: <br /><input name="password" type="password" maxlength="12" onkeyup="runPassword(this.value, \'mypassword\');" /><img src="inc/help.gif" HEIGHT="20" WIDTH="20" alt="help" onMouseover="ttip(\'Password must be 6 - 12 chars long\', 300)"; onMouseout="hidettip()"> -<div style="width: 100px;text-align:center;"> - <div id="mypassword_text" style="font-size: 10px;"></div> - <div id="mypassword_bar" style="font-size: 1px; height: 2px; width: 0px; border: 1px solid white;"></div> - </div></p> +<div style="width: 100px;text-align:center;"> + <div id="mypassword_text" style="font-size: 10px;"></div> + <div id="mypassword_bar" style="font-size: 1px; height: 2px; width: 0px; border: 1px solid white;"></div> + </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 /> -<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 /> +<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" >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 /> @@ -144,8 +144,8 @@ Password: </html>'; function error_s ($text) { - echo("<p style=\"background-color:black;color:yellow;font-family:verdana;\">" . $text); - echo("<br /><br /><a style=\"color:orange;\" href=\"" . $_SERVER["SCRIPT_NAME"] . "\">Go back...</a></p>"); + echo("<p style=\"background-color:black;color:yellow;font-family:verdana;\">" . $text); + echo("<br /><br /><a style=\"color:orange;\" href=\"" . $_SERVER["SCRIPT_NAME"] . "\">Go back...</a></p>"); }; $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("<p><b>Enter Numbers or (+/-) only. No alphabetical characters accepted.</b></p><p><a href=''>Try again</a></p>"); + error_s("<p><b>Enter Numbers or (+/-) only. No alphabetical characters accepted.</b></p><p><a href=''>Try again</a></p>"); 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 @@ <?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> @@ -40,8 +31,8 @@ Email: </html>'; function error_s ($text) { - echo("<p style=\"background-color:black;color:yellow;font-family:verdana;\">" . $text); - echo("<br /><br /><a style=\"color:orange;\" href=\"" . $_SERVER["SCRIPT_NAME"] . "\">Go back...</a></p>"); + echo("<p style=\"background-color:black;color:yellow;font-family:verdana;\">" . $text); + echo("<br /><br /><a style=\"color:orange;\" href=\"" . $_SERVER["SCRIPT_NAME"] . "\">Go back...</a></p>"); }; $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); |