|
Create a Master Ninja Account |
||
$username = strtolower($_POST['username']);
$email = $_POST['email'];
$email2 = $_POST['email2'];
$codename = $_POST['codename'];
$codename = strip_tags($codename);
$realname = $_POST['realname'];
$realname = strip_tags($realname);
$favninja = $_POST['favninja'];
$favninja = strip_tags($favninja);
$username = ereg_replace("[^a-z,A-Z,0-9,_]","",$username);
$error = "";
#### Check for necesseties ####
if (!(($username) && ($email) && ($email2) && ($codename)) && ($_POST['subbed'])) {
$error = "Not enough information. You must provide a username, ";
$error .= "a valid email address and a codename. ";
}
#### Check the username ####
if ($username) {
$sql2 = "SELECT * FROM 'users' WHERE 'username'=\"$username\"";
$result2 = mysql_query($sql2);
if ($result2) {
$error .= "That username is taken. Please select another.";
$username = "";
}
}
#### Check that the email addresses match ####
if (($email) && ($email2)) {
if ($email != $email2) $error .= "Your email addresses did not match each other. What's your problem?";
}
#### Check that the email address isn't in the DB ####
if ($email) {
$sql3 = "SELECT * FROM `users` WHERE `email`=\"$email\"";
$result3 = mysql_query($sql3);
if (mysql_num_rows($result3) > 0) {
$error .= "That email address is being used. One account per person, pal.";
$email = "";
$email2 = "";
}
}
#### Check for unique codename ####
if ($codename) {
$sql4 = "SELECT * FROM users WHERE codename=\"$codename\"";
$result4 = mysql_query($sql4);
if (mysql_num_rows($result4) > 0) {
$error .= "That codename is in use. Select another.";
$codename = "";
}
}
if ($error) echo $error;
if ((!$error) && ($_POST['subbed'])) {
include("confirm.php");
}
else {
include ("form.php");
}
?>
|
