Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if( empty( $_POST['register'] ) === false ) {
- $errors = array();
- $username = clean( $_POST['username'] );
- $password = encrypt( $_POST['password'] );
- if( !$_POST['username'] || !$_POST['password'] ) {
- $errors[] = 'You left a field blank';
- }
- if( strlen($username) > 30 ) {
- $errors[] = 'Your username cannot exceed 30 characters.';
- }
- $query = mysql_query( "SELECT username FROM users WHERE username = '$username'" );
- $count = mysql_num_rows( $query );
- if($count > 0 ) {
- $errors[] = 'That username is already taken. Please choose another one.';
- }
- if( $errors ) {
- foreach( $errors as $disperrors ) {
- echo $disperrors.'<br />';
- }
- echo 'Click <a href="register.php">here</a> to go back.';
- die();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement