Slowly adding database functions

started adding login call to the database, will finish soon.