well, it is in its own php page, but it is not a complete php page. in others words, it is missing the basic HTML tags that make a full page.
To do it more manually, create a login page that has the login form and authenticate user behavior, on it.
then copy the login form to your header page, and make the action post to the login page, this way the server behavior is not in the header file.