Example #1
0
    header("Location: " . $websiteUrl);
    die;
}
$errors = array();
$success_message = "";
//Forms posted
//----------------------------------------------------------------------------------------------
if (!empty($_POST) && $emailActivation) {
    $email = $_POST["email"];
    $username = $_POST["username"];
    //Perform some validation
    //Feel free to edit / change as required
    if (trim($email) == "") {
        $errors[] = lang("ACCOUNT_SPECIFY_EMAIL");
    } else {
        if (!isValidemail($email) || !emailExists($email)) {
            //Check to ensure email is in the correct format / in the db
            $errors[] = lang("ACCOUNT_INVALID_EMAIL");
        }
    }
    if (trim($username) == "") {
        $errors[] = lang("ACCOUNT_SPECIFY_USERNAME");
    } else {
        if (!usernameExists($username)) {
            $errors[] = lang("ACCOUNT_INVALID_USERNAME");
        }
    }
    if (count($errors) == 0) {
        //Check that the username / email are associated to the same account
        if (!emailusernameLinked($email, $username)) {
            $errors[] = lang("ACCOUNT_USER_OR_EMAIL_INVALID");
Example #2
0
 $errors = array();
 $email = trim($post["email"]);
 $username = trim($post["username"]);
 $password = trim($_POST["password"]);
 $confirm_pass = trim($post["passwordc"]);
 if (minMaxRange(5, 25, $username)) {
     $errors[] = lang("ACCOUNT_USER_CHAR_LIMIT", array(5, 25));
 }
 if (minMaxRange(8, 50, $password) && minMaxRange(8, 50, $confirm_pass)) {
     $errors[] = lang("ACCOUNT_PASS_CHAR_LIMIT", array(8, 50));
 } else {
     if ($password != $confirm_pass) {
         $errors[] = lang("ACCOUNT_PASS_MISMATCH");
     }
 }
 if (!isValidemail($email)) {
     $errors[] = lang("ACCOUNT_INVALID_EMAIL");
 }
 //End data validation
 if (count($errors) == 0) {
     //Construct a user object
     $user = new User($username, $password, $email, 1);
     //Checking this flag tells us whether there were any errors such as possible data duplication occured
     if (!$user->status) {
         if ($user->username_taken) {
             $errors[] = lang("ACCOUNT_USERNAME_IN_USE", array($username));
         }
         if ($user->email_taken) {
             $errors[] = lang("ACCOUNT_EMAIL_IN_USE", array($email));
         }
     } else {