alternatif olarak bunu da kullanbilirsin
if(preg_match("/dosyaismi\.php/i", $_SERVER['PHP_SELF'])) 
    die("erişim engellendi");