It looks like you are trying to conditionally include one of two pages in the body of another... but the two pages have session setting and redirects that can only be done above the page.
The solution is to use WebAssist Plugins instead of traditional require statements to include the page contents. That should fix the problem.