How does the define constant prevent the address bar from directly accessing background files?
Source: Internet
Author: User
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: directly define ('in _ TM ', TRUE); B. php direct & lt ;? Phpif (! Defined ('in _ TM ') {exit ('accesssdenied' 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
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.