1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Special Character in Username

Discussion in 'General PHP and MySQL Discussions' started by veemon, Oct 17, 2015.

  1. veemon

    veemon Member

    Hey there!
    I implented a new site with a login script I found in this forum and everything worked nicely, until someone with a special character (♥) tried to login.
    I absolutely can't seem to find the error here.
    The $username shows it correctly if I echo it and it's correctly displayed in the database as well.
    The problem seems to be when getting the $data.
    When dumping it I noticed that it would just return a false boolean when I tried logging in with the ♥ character.
    Thanks in advance for any help!

    Here is the script:
            $startTime microtime(true);
    $username $_POST['username'];
    $password $_POST['password'];
    $db XenForo_Application::getDb();
    $data $db->fetchOne('
                FROM xf_user_authenticate AS auth
                INNER JOIN xf_user AS user ON
                    (user.user_id = auth.user_id)
                WHERE user.username = ?
    $id $db->fetchOne('SELECT user_id FROM xf_user WHERE username = ?'$username);
    $auth XenForo_Authentication_Abstract::createDefault();
    $check $auth->authenticate($username$password);
    $check) {
            } else {

Share This Page