// function to get current filename from a url made by sarfraz ahmed.
function get_url_filename()
{
$filename = array_pop(explode("/",$_SERVER['REQUEST_URI']));
$ext = substr($filename,strpos($filename,"."));
if (substr($ext,4))
{
if (substr($ext,4,1)=="?")
{
$ext = substr($ext,0,4);
}
else
{
$ext = substr($ext,0,5);
}
}
$filename = substr($filename,0,strpos($filename,"."));
return $filename . $ext;
}