//get variables $user = set_post('user', ''); $password = set_post('password', ''); //check if ready if (!isset($_POST['user']) && !isset($_POST['password'])) { return false; } //variables not set yet //error checking $terror = false; //if an error occurred if (empty($user)) { notices_set('Please provide an email or username', 'error'); $terror = true; } if (!password_is_valid($password)) { notices_set('Invalid password - Passwords must be at least ' . REQ_PASSWORD_LENGTH, 'error'); $terror = true; } //last error check if ($terror) { //exit script echo notices_get(); //show errors return false; } //login if (do_login($user, $password)) { do_redirect(); } else { echo notices_get();
if (!isset($_POST['email1']) || !isset($_POST['email2']) || !isset($_POST['password1']) || !isset($_POST['password2'])) { return false; } //variables not set yet //error checking $terror = false; //if an error occurred if (!email_is_valid($email1) || !email_is_valid($email2)) { notices_set('Invalid email address', 'error'); $terror = true; } if ($email1 != $email2) { notices_set('Emails do not match', 'error'); $terror = true; } if (!password_is_valid($password1) || !password_is_valid($password2)) { notices_set('Invalid password - Passwords must be at least ' . REQ_PASSWORD_LENGTH, 'error'); $terror = true; } if ($password1 != $password2) { notices_set('Passwords do not match', 'error'); $terror = true; } //check if user exists already $sql = sql_query(" SELECT id FROM `users` WHERE email='{$email1}' LIMIT 1 "); if (sql_count($sql) > 0) { notices_set('Email already in use, please use a different email or reset your password', 'error'); $terror = true; } //last error check if ($terror) {