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");?>

My question is how can I disable direct access using php not .htaccess

299 Like 38 Dislike
Previous php-forum Next php-forum
Other php-forum

Do not allow posting of whitespace
Currently the script below works if the user does not type a name/message, but if i create a whitesp

Character Set Setup
Whats the best character set to use if you want every character to work, and also how do you make yo

code help - pagination
Hi all, I have this code, basically a user logs into my site and they get this page.

The pro

How to use Substr
I want to check for the word CATEGORY: inside a string which can be CATEGORY: ITEM
and remove the

include
Hi I have this way of licensing my PHP application, and I want to know if you guys can answer some q

Preg_match question
I want to use preg_match to make sure a string is always 6 characters long and only contains 0-9 and

Slow data retrieval which requires improvement..please help
I am working on a Help Desk Ticketing system and have a page called MY TICKETS which shows all ticke

Limiting checkboxes?
Hi guys,

I have this code: Code: if(isset($_POST['selected'])) {
foreach($_POST['selec

parse error
Parse error: syntax error, unexpected '[', expecting ')' in /Users/admin/Sites/phptest/array.php on

Logic question
im wondering what's the best method to do the above list:

it is for alliance @ MMORPG game

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