logic and database connection done for profile and login