Here is what i did, and it worked just fine.... (and i used $PHP_SELF)
this is the first file, like the one someone would call with out being logged in:
<?php
session_start();
$username = $_SESSION["username"];
$password = $_SESSION["password"];
if(!$username || !$password) {
echo "<B>Redirecting To Logon Page</B>";
echo "<meta http-equiv=\"refresh\" content=\"2;url=login.php?page=$PHP_SELF\">";
} else {
echo "<b>Welcome, $username!</b>";
}
?>
and here the logon page, that will redirect them page to that page above ^
<?php
session_start();
$_SESSION["username"] = "brian";
$_SESSION["password"] = "brian";
if(!$page) {
echo "<b>WELCOME, $url</b>";
} else {
echo "<b>Redirecting To Previous Page</b>";
echo "<meta http-equiv=\"refresh\" content=\"2;url=$page\">";
}
?>
this is obviously very simple, but this same method will always work, no matter how hard the method