Try this ...
<?php
$url = substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
echo $url;
?>
It should only display the script name ... such as ...
if you enter it with, http.... index.php?id=1234&otherstuff=64564
It will display as "index.php"
(at least I think it will work).
================
But the real answer to your question is to use PHP SESSION.
When a log-in is successful, you set a session variable with the login script,
and when you return back to any other script, you can check for it.
There is nothing in the URL .. it's all done with SESSIONs.