$errors[] = "Username must be at least {$user_name_min_chars} characters."; } if (preg_match('/\\s/', $user_name)) { $errors[] = 'Username should not contain spaces.'; } if ($email != $conf_email) { $errors[] = 'Your emails do not match'; } if (filter_var($email, FILTER_VALIDATE_EMAIL)) { } else { $errors[] = 'Your email is invalid'; } //create a new checkPwd object, and call various related functions. //this is based on David Powers' code from 2nd edition of PHP solutions. $check_password = new checkPassword($user_password, 8); $check_password->requireMixedCase(); $check_password->requireNumbers(2); //$check_password->requireSymbols(); $password_OK = $check_password->check(); if (!$password_OK) { $errors = array_merge($errors, $check_password->getErrors()); } if ($user_password != $conf_user_password) { $errors[] = "Your passwords don't match."; } if (!$errors) { //no errors found, registration can be inserted to DB echo "yay no errors, let's process that info now! <br />"; //for troubleshooting only $conn = dbConnect('admin'); //connect to the db, will need to write to DB so use admin user!
if (strlen($userName) < $userNameMinChars) { $errors[] = "Username must be at least {$userNameMinChars} characters."; } if (strlen($firstName) == 0) { $errors[] = "Please enter a first name."; } if (strlen($lastName) == 0) { $errors[] = "Please enter a last name."; } if (preg_match('/\\s/', $userName)) { $errors[] = 'Username should not contain spaces.'; } //create a new checkPwd object, and call various related functions. //this is based on David Powers' code from 2nd edition of PHP solutions. $checkPwd = new checkPassword($password, 6); $checkPwd->requireMixedCase(); $checkPwd->requireNumbers(1); //$checkPwd->requireSymbols(); $passwordOK = $checkPwd->check(); if (!$passwordOK) { $errors = array_merge($errors, $checkPwd->getErrors()); } if ($password != $conf_password) { $errors[] = "Your passwords don't match."; } if (!$errors) { //no errors found, registration can be inserted to DB //echo"yay no errors, let's process that info now! <br />"; //for troubleshooting only $conn = dbConnect('admin'); //connect to the db, will need to write to DB so use admin user! //create a salt using the current timestamp