Changed checklogin function to no longer use header(Location: )