start checking login after including db.php Before including phpmailer After including phpmailer after including User.php after url