PHP Novice Ask a function
I was looking at the source of a little doubt, first there is such a function
function Submitcheck ($var = "") {
if (empty ($_post)) {
return false;
}
if ($_server[' request_method ') = = ' POST ' && (Empty ($_server[' http_referer ') | |
Preg_replace ("/https?:\ /\/([^\:\/]+). */i "," \\1 ", $_server[' http_referer ']) = = Preg_replace ("/([^\:]+). */"," \\1 ", $_server[' Http_host '])) {
return true;
}
else{
return false;
}
}
What is this function for, a simple answer, thank you.
Also, the return value of this function is Boolean, but why do I find such a call in the following: Submitcheck (' islogin ') = = ' yes ' and can be run
------Solution--------------------
You sent two of the same questions at a sudden?
------Solution--------------------
Submitcheck is looking at the delivery of the post through the non-null, and the source of access is the server (the running server of the program),
Then, the function results return true, otherwise the return false--is a function that prevents hotlinking.
Although the return value of the function is Boolean, the PHP engine is compiled with a composite view, so the Submitcheck (' islogin ') = = ' Yes ' can run, but it should not achieve the desired effect.
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.