for external inputs like $_GET['username'] you should check whether it was properly passed in before referencing it:

if (!isset($_GET['username'])) {
  print 'ERROR: Invalid input';
  exit;
}