How does the define constant prevent the address bar from directly accessing the background file? define cannot be cross-page, but recently it was like this in an open source PHP Project: for example,. php: define (IN_TM, TRUE); B. php direct & lt ;? Phpif (! Defined (IN_TM) {exit (AccessDenied) ;}if ($ _ SESSION [& quot; admi define constant how to prevent the address bar from directly accessing background files
Define is not cross-page, but recently it was viewed as an open-source PHP Project. for example, a. php: directly define ('in _ TM ', TRUE );
B. php direct If (! Defined ('in _ TM '))
{
Exit ('Access Denied ');
}
If ($ _ SESSION ["admin"]! = "Silence ")
{
Include template('login.htm ');
Exit;
}.....
Include is useless! However, when I simulate this, define cannot cross-page! What other settings does it make the 'in _ TT' valid on another page?
Similar to DISCUZ, how does one prevent direct access to background files in the address bar?
------ Solution --------------------
If you can confirm that no file is explicitly embedded before judgment
Then he used auto_prepend_file in php. ini.
In fact, as long as the project can run, you only need to print the results of get_included_files to know what files are embedded.
------ Solution --------------------
This must be include, but you didn't see it.
------ Solution --------------------
However, when I simulate this, define cannot cross-page! What other settings does it make the 'in _ TT' valid on another page?
B. php
If (! Defined ('in _ TM '))
{
Exit ('Access Denied ');
}
A. php
Define ('in _ TM ', TRUE );
Include 'B. php ';
Access to B. php must be completed by accessing a. php; otherwise, Access Denied