adib16
adib16

Reputation: 1697

restrict access on php file from all except one file

I have this file structure .

index.php
includes
        functions.php

in the index.php file i call functions.php use ajax.i want to block access to functions.php from all except from index.php .if someone know directory name of functions.php and want to access to this file the error occur .I want to do this with .htaccess file.

Upvotes: 0

Views: 71

Answers (1)

Aziz Saleh
Aziz Saleh

Reputation: 2707

I think the best way to do it is to:

  1. In your index.php before echoing javascript, construct a one time key.
  2. Send that key to your functions.php, if key is valid then process.

I wouldn't rely on referral URL or anything less secure.

Upvotes: 2

Related Questions