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

Sufficient protection from bad input?
I am writing a simple script to let people upload 'pages' of their own content, be it simply a few b

need help about
i store the value of my select statement result to an array and stored it to a variable named $fname

Preg_match with an array
is there an away to use preg_match with an array?

i want to check a string with an array to s

Generate PDF
Hi guys,

I would like to know if there is a way to generate pdf when clicking on a link. In f

browse folder only
hi,
is there a way i can browse or get the directory or folder only and not the file?
i just w

php slowing my site?
Hi all,

I think that one of the reasons that my site doesn't work fast is that the code is ve

Do While statement
hi guys,

This may sound trivial but im new to php and as part of an assignmenti have to const

Displaying Site Logo/Icon on a Title tag
really need some help out here. I want to insert a Logo/Icon just like the one close to the "PH

Schedule editor
Hi,

I have a question related to Schedule editor.
If we schedule a BLS for every 30

Progress bar tracking file downloads
Hey guys, was wondering if there was a way to track how far a file has been downloaded. I know there

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