Search code examples
phpphpbb

phpBB - login NOT case sensitive


How can you make the username case insensitive, and give the possibility to login with both email and username?

can't seem to find anything under administration.. is it possible to change in the cms?


Solution

  • Well, change the login query to

    $emailOrUser = mysql_real_escape_string($_POST['emailorusername']);
    $password = mysql_real_escape_string(phpBB_password_hash_function($_POST['password']));
    
    $loggedIn = mysql_query("...
                            where (email = '" . $emailOrUser . "' or lowercase(username) = '" . strtolower($emailOrUser) . "') 
                            and (password = '" . $password . "')");
    

    Or if you can't or don't want to program, take a look here since it's a freely downloadable mod for phpBB that lets you login with email.

    You can also change the user table to a case-insensitive collation, but that might produce unexpectable results, just as my query. I don't know whether phpBB lets you create two accounts if the casing differs (user vs USER, are that two different valid accounts?).