Function valid for all pages

2

Is it possible to define a function for all pages without using include() in all of them?

  • Ex: I have a secret directory ../seg/staff/login/ and I want to define that user with permission level less than 3 can not access them.

Could create a seg.php file:

if($nivel < 3){
    echo ("Você não possui permissão para isto.");
}

And call it on others with include("seg.php") .

Now let's say I have 70 pages. Is there any way I can set this in some .htacess or other without having to put require("") , include("") , etc. in all files?

    
asked by anonymous 13.10.2016 / 19:17

1 answer

2

You can use the PHP "auto_prepend_file" directive, this will include your logic on all pages.

    
13.10.2016 / 20:15