if (!$rules) { throw new Exception('You must read, and agree to, the Rules and Terms of Service'); } if ($captcha != $_SESSION['number']) { throw new Exception('You failed to match the captcha to the correct number'); } if (Activation::getByUsernameEmailCount($username, $email) > 0) { header('Location: index.php?e=4'); exit; } if (User::getByUsernameEmailCount($username, $email) > 0) { throw new Exception('That username or email already exists. If you have forgotten your password, please use the resend password link'); } // if we get here, we can add the user. $password = getPassword(); $a = new Activation(); $a->username = $username; $a->email = $email; $a->password = md5($password); $a->nation = $nation; $a->IP = $_SERVER['REMOTE_ADDR']; $a->referrerId = $t->referrerId; $a->time = time(); $id = $a->create();