Say good-bye to hotlinking ... _php Foundation

Source: Internet
Author: User

The first page randomly produces a number (0-15)-"Dechex" () saved in session

Then the URL to use this tag for operation, you can calculate, but to be able to reverse the line ~

The second page detects if there is a tag, inverse it, and then takes the variable out

Advantages: (Must visit the site URL to be effective ~)

Disadvantage: (Save to the local page link all invalid, hotlinking invalidation)

---------------------------------------------

<?php
Ob_start ();
Session_Start ();
if (Isset ($_session[key])) {//have key

$key =$_session[key]; Get the key.
$str =$_server[query_string]; Get Encrypted data
$decryptstr =decrypt ($str, $key); Use the key to unlock the data (note that this is your inverse algorithm)
....//(decompose data into a variable)./..//(breaking down into variables)..//
}else{//No Key
$key =dechex (rand (0,15)); Create a key
If your page is already the last page and you do not allow hotlinking links
echo "Your link is not from this site!" Visit this page after you visit the site ... ";
Exit ();
}
?>
HTML content ........ (Here is a lot of links ...)

<?php
$htmlcontent =ob_get_contents (); Get all HTML content
...//Replace all connection parameters Href=url? The data being replaced (a set of regular) (a group of the same), or the same as the other.
Ob_end_flush (); Output HTML content (href= already encrypted data)
?>

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.