you use
include 'login.php' AND $_SERVER['PHP_SELF']
<?php
// in a page that needs login, the original page
// you use
// if not logged in
include 'login.php';
////////////////////////////////
// in the login.php with login <form>
// you use this
// this will go to original page after SUBMIT
// and of course at the original page
// will be an include of 'login.php' again (if not logged in)
// for testing Submitted data from <form>
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input>
<submit>
</form>
say somebody surf to 'index.php'
PHP_SELF will be 'index.php'
and the login.php will be only like a subroutine in 'index.php'
which is included, UNTIL user is successfully logged in.
When is, rest of 'index.php' will be displayed
And if original page is 'members.php', PHP_SELF and the action
will to go back to 'members.php'
.