N
N
Ninazu2015-04-24 09:03:51
PHP
Ninazu, 2015-04-24 09:03:51

How to disable direct access to the script?

How to correctly prohibit access to .php files from the address bar, with the ability to set
Allow exceptions

/index.php
/login.php
/xml_rpc/server.php
/system/contact/view_all/
/system/home/index/

Deny

/system/home/*.php
/system/controllers/contact_controller.php

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
Leonid Sysoletin, 2015-04-24
@sysoletin

Configure mod_rewrite so that one script responds to all requests, which will implement the desired logic.
And so I will join the previous speaker, the system in which the solution of such problems is required, most likely, is not very well designed.

G
Gregory, 2015-04-24
@difiso

As Leonid Sysoletin said , set up mod_rewrite, and in that one script that processes all requests, write something like define('SOMEVARIABLE', 'VALUEOFSOMEVARIABLE');
A in all other scripts, write something like the following at the very beginning

<?php defined('SOMEVARIABLE') or die('No direct script access.');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question