2
It is possible to set a function for all pages without using include()
in all of them?
- Ex: I have a secret directory
../seg/staff/login/
and want to define which user with permission level less than 3 can not access them.
Could create a file seg.php
:
if($nivel < 3){
echo ("Você não possui permissão para isto.");
}
And call him too much with include("seg.php")
.
Now let’s say I have 70 pages. Is there any possibility I can define this in some .htacess
or another without having to put require("")
, include("")
, etc. in all files?
I see a lot of people suffering to do basic things by not knowing or even not interested in using some
framework
development, people, we do not need to suffer with the development of basic things in the nail, there are already many people working to make it ready for us, I suggest you take a look atLaravel
, or any other Development FrameworkPHP
...you will get this, and thousands of other problems solved easily...– Kenny Rafael
@Kennyrafael Blz never really went after framework I will try to take a look at it. Thank you for the feedback
– user50712
At best, if you only have PHP files in the directory, that’s only and only pure PHP, then you will only have one
<?php
by file, this way you can use your Editor/IDE to replace all<?php
for<?php include("seg.php");
, this way all files in the directory will have theinclude("seg.php")
. Now, if you join PHP with HTML and have more than one possibly have more than one<?php
, then you’ll have a problem.– Inkeliz