moved DOCTYPE location for error messages

The DOCTYPE has been moved to a latter location
so that when error messages are generated, such
as when the permissions are wrong, it won't also
generate messages about session_start() and cookies.