Made profile.php redirect back to homepage if accessed by typing into URL rather than logging in.