converted login related codes to PDO