Jump to content

File Restriction


Baving

Recommended Posts

Is there any way in which php files can be disabled from being viewed from a browser but will still work if they are included on another file like include("admin/blah.php");

If you try and acess the folder or files within it you would get the page cannot be displayed message.

I have tried this CHMOD but can't seem to get it to work, so I am wondering if there is a script you can use.
Link to comment
Share on other sites

you can have the "admin/blah.php" file look like this:

[code]<?php

if(isset($admin_include_code) && $admin_include_code=="123"){

//rest of the file here

}else{
die("This file cannot be accessed directly.");
}

?>[/code]


And every time you want to include the file you do:

[code]<?php

$admin_include_code="123";
include("admin/blah.php");

?>[/code]



Hope it helps :)

Orio.
Link to comment
Share on other sites

[quote author=redarrow link=topic=108795.msg438079#msg438079 date=1158767770]
I always thort even if a varable had nothink in it that it is set anyway am i right sorry to but in.
[/quote]

[code]$var = null;[/url] and [code]$var = '';[/code] and [code]$var = false;[/code] will be set (obviously variables that are not empty will be set too).[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.