Update login.php

Split the query to give a more specific error message. Added json_encodes for Android use. Closed the connection at the end.