Kiedy chcę się zalogować z nazwą użytkownika zaczynającą się od małej litery, logowanie nie działa. Jest włączone rozpoznawanie wielkości znaków.
Kodowanie w bazie ustawione jest na utf8_general_ci ,więc wielkość znaków nie powinna być brana pod uwagę, a jednak jest.
Przy MySQLi nie ma tego problemu. Loguje się bez rozpoznawania wielkości znaków.
Próbowałem innych kodowań m.in utf8_bin , ale też nic nie pomaga. Problem występuje tylko przy korzystaniu z PDO.
Co może być tego przyczyną?
'dsn' => 'mysql:host=localhost;dbname=various' , 'user' => 'root' , 'password' => '' ); public function __construct() { try { $this->db = new PDO($this->config['dsn'], $this->config['user'] , $this->config['password']); } catch (Exception $error) { } } public function login($username,$password) { $stmt = $this->db->prepare('SELECT id,username,password,email,salt,role FROM users WHERE username=:username'); $stmt->bindValue(':username', $username); $stmt->execute(); while ($row = $stmt-> fetch()) { $this->user_id = $row['id']; $this->username = $row['username']; $this->password = $row['password']; $this->email = $row['email']; $this->salt = $row['salt']; $this->role = $row['role']; } $stmt->closeCursor(); if ($username == $this->username AND $this->compare($password, $this->password, $this->salt)) { $_SESSION['user_id'] = $this->user_id; $_SESSION['auth'] = TRUE; $_SESSION['username'] = $this->username; $_SESSION['role'] = $this->role; return true; } return false; }