THT Community

Full Version: 1.2.1 Username Bug
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Wewt. i found a bug....

When a user enters their username in registration:
meh_asdf would be accepted....

cPanel does not allow _ and likely other symbols in usernames... Im not sure what else is not allowed by cPanel.

cPanel does make the account however and truncates it without the symbol.
Yeah, I noticed/forgot about that. :p
Now all you got to do is add a little amount of code to strip those from the username and provide an error
Duh. -----WORDS TO MAKE MY POST LONGER SO MYBB WILL ACCEPT IT...
Find in includes/ajax.php:
Code:
        else {
            //If the first character is a number, then complain.
            if(is_numeric(substr($main->getvar['user'], 0, 1))) {
                echo 0;
                return;
            }
        }

Add below:
Code:
        if(!preg_match("/^([0-9a-zA-Z])+$/",$main->getvar['user'])) {
            echo 0;
            return;
        }