Is there, in any way, possible to detect if a PHP file is browsed by the browser itself and not by include?
I'm using PHP to process some code and then write it in another page in which this PHP is included (using the PHP include()). I don't want it to be browsed by itself and I want it to be accessed only if it is included (again, using the PHP include())
I wanted to achieve something like this:
if (browser is not opened by include){
header("Location: /forbidden");
die();
}
else {//do nothing}
Now, is it possible for me to achieve what I want?