Ran into structure. The entry point is the index.php file, where the

index.php

define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR); require APPPATH.'bootstrap'.EXT; 

Then, each time the files are connected: bootstrap.php

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

Is this a kind of protection against the fact that we could not connect the bootstrap.php file directly?

-If we connect the file other.php in the bootstrap.php file so we have to declare the variable in the bootstrap.php file in the same way and check the presence in other.php ?

-How are there other ways of similar protection (I heard that you can not access files in a specific location, tell me)?

thank

    1 answer 1

    • Yes, this is such a protection from connecting scripts
    • The connected php file must have in the 1st line <?php defined('SYSPATH') or die('No direct script access.');?>
    • You can also restrict access to files inside folders using .htaccess.
    • Thanks for the htaccess tip - zloctb
    • one
      and nothing more is needed. Checking constants is a long-standing practice. And by itself, Kohana is well done in terms of routing and just will not give up the system files. - kemerov4anin