require_once("userdb.php"); $config = read_config("general.json"); $siteName = $config['siteName']; $cookieURL = set_cookie_url(); $submit = $_POST['submit']; $not18 = $_COOKIE['not18']; if ($submit) { $uname = $_POST['uname']; $age = $_POST['age']; $email1 = $_POST['email1']; $email2 = $_POST['email2']; $pwd1 = $_POST['pwd1']; $pwd2 = $_POST['pwd2']; $tos = $_POST['tos']; if (!$uname || !$age || !$email1 || !$email2 || !$pwd1 || !$pwd2) { $complaint = "You must fill in all fields."; } else if (!$tos) { $complaint = "You must agree to the Terms of Service."; } else if (strlen($uname) < 4) { $complaint = "The account name must be at least 4 characters long."; } else if (strlen($uname) > 30) { $complaint = "The account name must no more than 30 characters long."; } else if (!validateUsername($ctl_sock,$uname,$complaint)) { $complaint = urldecode($complaint); # complaint set automatically } else if ($age < 18) { $complaint = "Sorry, you must be 18 or older."; setcookie("not18","true",0,"/",$cookieURL); $not18 = TRUE; } else if ($email1 != $email2) { $complaint = "Emails do not match."; $email1 = $email2 = ""; } else if (checkEmail($auth_sock,$email1,$uname,$XXX)) { $complaint = "Email address $email1 is already in use"; $email1 = $email2 = ""; } else if ($pwd1 != $pwd2) { $complaint = "Passwords do not match."; } else { createUser($ctl_sock,$uname,$pwd1,$user,$pass,$email1,$complaint); if (!$complaint) { if ($tos) { setAccountStatus($ctl_sock,$uname,"terms-of-service",$complaint); } pingUser($auth_sock,$uname,$email1,$pass,$complaint); if (!$complaint) { $message = "Account successfully created! Watch your email for a verification message, and check your spam folder if you don't see it."; $uname = $age = $email1 = $email2 = ""; } } } } ?>
|
|
|
|
if ($complaint) {
echo "
Error: $complaint $message"; } ?> if (!$not18) { ?> | |