Use the PHP program header location to jump the attention of a detail! ____php

Source: Internet
Author: User

As we all know, PHP site jump has three kinds of methods: JS, HTML META-Refresh, PHP header ("Location: $url"). But here's a very small detail that can easily lead to errors.

One time to make a jump program, the result ignores this, resulting in the jump is actually no success.


Program all source code as follows, program address: http://www.***.com/go.php

<?php

error_reporting (7);
$url = UrlDecode (Trim ($_request[' url '));
if ($url)
{
    header ("Location: $url");

} else {

    exit (' Error input,<a href= ' http://www.***.com/?f= go.php ">go back</a>");
}

When the access address is: http://www.***.com/go.php?url=http%3a%2f%2fwww.zbphp.com%2f, the Firefox browser is normal. This jump program was later copied to another website of the company, let QQ some friends test, the result many people say not open: IE kernel browser directly prompted inaccessible or can not find, chrome sometimes prompts to be reset or can't find, use Firefox test also occasionally will prompt can not find, But the refresh appears normal only once more.


Careful examination of the code is no problem. In addition, Firefox can jump, after thinking of the past to read the point is:IE browser if the output of the content byte is too small (less than 512 bytes), then it will be ignored . Then the source code by header location jump modified to JS HTML All browsers are tested through, the original even if the Firefox click Hint can not find the XXX server did not appear again, now go.php all source code:

<?php error_reporting (7); function Gheader ($url) {echo '  

For PHP jumps, I think the best way is to use js+html META. HTML Meta can ensure that visitors can also jump if JS is disabled .

If you have a better way, welcome to reply or send me email to my email admin@zbphp.com.


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.