Php beginners ask a function solution

Source: Internet
Author: User
A beginner in php asks a question when I look at the source code of a function. First, there is a function functionSubmitCheck ($ var = & quot ;) {if (empty ($ _ POST) {returnfalse;} if ($ _ SERVER ['request _ method'] = 'post php novice asks a function
When I look at the source code, I have a question: 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? just give me a simple answer. thank you.
Also, the return value of this function is Boolean, but why do I find this call below: submitcheck ('islogin') = 'yes', and it can be run?

------ Solution --------------------
Did you send two identical questions at once?
------ Solution --------------------
SubmitCheck indicates that the content transmitted through POST is not empty, and the source of access is the local server (the running server of the program ),
If the function returns true, otherwise false is returned, which is a function to prevent leeching.

Although the return value of the function is Boolean, the PHP engine is compound during compilation. Therefore, submitcheck ('islogin') = 'yes' can run. However, it should not be able to achieve the expected results.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.