Update login.php Add new function getUserData and comments

replace direct calls to database to look for user data by a new function getUserData (it's improve code lisibility and maintenance)

added some comments to explain new internal functions