Addel logining from database

Setuped logining from database by SQL query.