I have a php file which I will be using as exclusively as an include. Therefore I would like to throw an error instead of executing it when it's accessed directly by typing in the URL instead of being included.
Basically I need to do a check as follows in the php file:
if ( $REQUEST_URL == $URL_OF_CURRENT_PAGE ) die ("Direct access not premitted");
Is there an easy way to do this?
Add this to the page that you want to only be included
die('Direct access not permitted');
then on the pages that include it add
Hope it helps!!
PHP is compiled to byte code before ...READ MORE
You could use the copy() function :
// Will ...READ MORE
The following should help
realpath — Returns canonicalized ...READ MORE
$source = 'Source_file_location'
First you have to go to ...READ MORE
Named route is used to give specific ...READ MORE
This is simple you just need to ...READ MORE
Named routing is another amazing feature of ...READ MORE
Add this to the page that ...READ MORE
You can try this:
$query="SELECT * FROM CountryInfo ...READ MORE
Already have an account? Sign in.