Well, if you use $_SERVER["SCRIPT_NAME"] it will return something like /directory_1/directory_2/script.php3
If you only want the last past, script.php3 you can use this little code :
<?
$scp = $_SERVER["SCRIPT_NAME"];
$pds = strrpos($scp, "/");
$url = substr($scp, $pds + 1);
?>
If you want everything from the [url]http://[/url] to the .php*, you can use this :
$url = "http://" . $SERVER["HTTP_HOST"] . $SERVER["SCRIPT_NAME"];
It is what you want ?