How to disable direct access to a file


Posted on 16th Feb 2014 07:03 pm by admin

Suppose I've 2 Files. 1.php & 2.php

I don't want anybody to access 2.php directly from browser. Eg: http://localhost/2.php but I want 2.php show up in 1.php like:
Line number On/Off | Expand/Contract<?phpinclude("2.php");?>
Did you know?Explore Trending and Topic pages for more stories like this.

My question is how can I disable direct access using php not .htaccess
No comments posted yet

Your Answer:

Login to answer
299 Like 38 Dislike
Previous forums Next forums
Other forums

problem with sql querry in php script
Hello guys,

What I want to do is I want to read out a csv file and then but te conent ot the

DOMDocument parsing
Hello, I am parsing an xml file from an API which I have converted into a DOMDocument in php. This i

printing links
Hi every1

i am connecting to a table in sql and the looping through with a while ($ var = my

Passing JS to PHP
So I have the following
Code: <?php
getdetails(?><script type="text/

Using CSS to format MySQL query
Hi,

If i want to have a news page on my site, which displays all records of a table in descen

Deleting a record php
Attempting to setup delete a record page. The below code I put together doesn't seem to work.

how to load a Sys file with system load and call images?
normally you need register the module as a service with CreateService, and start the service

how can i display php source code snippets ?
I am outputting some pho code .. and I want to display the source code so people can copy and paste

POST into Array problem
Hi Chaps,

I have a repeat region, displaying rows of data: jobid, fromtable, translatorcharge

Wierd if else problem
Hi guys,

this probably aint wierd for you, but it seems like php is playin up to me. may b i

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash