Make WordPress Core

Changeset 2632 for trunk/wp-register.php


Ignore:
Timestamp:
06/12/2005 11:14:52 PM (19 years ago)
Author:
matt
Message:

More user updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-register.php

    r2548 r2632  
    2727case 'register':
    2828
    29     $user_login = $_POST['user_login'];
     29    $user_login = sanitize_user( $_POST['user_login'] );
    3030    $user_email = $_POST['user_email'];
    3131       
    32     /* checking that username has been typed */
    33     if ($user_login == '') {
     32    if ( $user_login == '' )
    3433        die (__('<strong>ERROR</strong>: Please enter a username.'));
    35     }
    3634
    3735    /* checking e-mail address */
     
    4240    }
    4341
    44     /* checking the username isn't already used by another user */
    45     $result = $wpdb->get_results("SELECT user_login FROM $wpdb->users WHERE user_login = '$user_login'");
    46     if (count($result) >= 1) {
     42    if ( $result = $wpdb->get_row("SELECT user_login FROM $wpdb->users WHERE user_login = '$user_login'") )
    4743        die (__('<strong>ERROR</strong>: This username is already registered, please choose another one.'));
    48     }
    4944
    5045    $user_ip = $_SERVER['REMOTE_ADDR'] ;
     
    5247    $user_browser = $wpdb->escape($_SERVER['HTTP_USER_AGENT']);
    5348
    54     $user_login = $wpdb->escape( preg_replace('|a-z0-9 _.-|i', '', $user_login) );
     49    $user_login = $wpdb->escape( sanitize_user($user_login) ) );
    5550    $user_nickname = $user_login;
    56    $user_nicename = sanitize_title($user_nickname);
     51    $user_nicename = sanitize_title($user_nickname);
    5752    $now = gmdate('Y-m-d H:i:s');
    5853    $user_level = get_settings('new_users_can_blog');
Note: See TracChangeset for help on using the changeset viewer.