Modify simple registration form to add the option for WOTLK. Will do same for more advanced form later.

--HG--
branch : trunk
This commit is contained in:
p0wer
2009-12-27 19:04:13 -06:00
parent 0aef7ea793
commit 942ea8433e
+15 -6
View File
@@ -31,7 +31,8 @@ Password:
<br /><input name="password" type="password" maxlength="12" /><br /> <br /><input name="password" type="password" maxlength="12" /><br />
Email: Email:
<br /><input name="email" type="text" maxlength="50" /> <br /><input name="email" type="text" maxlength="50" />
<br /><input name="tbc" type="checkbox" checked="checked" /> TBC<br /><br /><br /> <br /><input name="tbc" type="checkbox" /> TBC<br />
<br /><input name="wotlk" type="checkbox" checked="checked" /> WOTLK<br /><br /><br />
<button type="submit">Submit</button> <button type="submit">Submit</button>
</p> </p>
</form> </form>
@@ -52,7 +53,7 @@ if (!$con) {
}; };
if (!empty($_POST)) { if (!empty($_POST)) {
if ((empty($_POST["username"]))||(empty($_POST["password"]))||(empty($_POST["email"]))||(empty($_POST["tbc"])) ) { if ((empty($_POST["username"]))||(empty($_POST["password"]))||(empty($_POST["email"]))||((empty($_POST["tbc"]) && (empty($_POST["wotlk"])))) ) {
error_s("You did not enter all the required information."); error_s("You did not enter all the required information.");
exit(); exit();
} else { } else {
@@ -95,10 +96,18 @@ if (!empty($_POST)) {
error_s("Email was in an incorrect format."); error_s("Email was in an incorrect format.");
exit(); exit();
}; };
if ($_POST['tbc'] != "on") { if (($_POST["tbc"] == "on") && ($_POST["wotlk"] == "on")) {
$tbc = "0"; error_s("TBC and WOTLK were both checked.");
exit();
};
if ($_POST["tbc"] != "on") {
if ($_POST["wotlk"] != "on") {
$exp = "0";
} else { } else {
$tbc = "1"; $exp = "2";
};
} else {
$exp = "1";
}; };
$username = mysql_real_escape_string($username); $username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password); $password = mysql_real_escape_string($password);
@@ -133,7 +142,7 @@ if (!empty($_POST)) {
}; };
unset($qry); unset($qry);
$sha_pass_hash = sha1(strtoupper($username) . ":" . strtoupper($password)); $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 . "','" . $tbc . "')"; $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 . "')";
$qry = @mysql_query($register_sql, $con); $qry = @mysql_query($register_sql, $con);
if (!$qry) { if (!$qry) {
error_s("Error creating account: " . mysql_error()); error_s("Error creating account: " . mysql_error());