Home  >  Article  >  CMS Tutorial  >  How to prevent hotlinking in Imperial CMS

How to prevent hotlinking in Imperial CMS

angryTom
angryTomOriginal
2019-07-18 16:42:562936browse

How to prevent hotlinking in Imperial CMS

How does Imperial CMS prevent hot links? Let’s take flash files as an example to introduce in detail how Imperial CMS prevents hot links.

Recommended tutorial: Empire cms tutorial

1. Change the FLASH address The prefix is ​​added to the flashpath.js file. The content is as follows:

flashpathval="http://www.phome.net/flashpath/";

(Note: Modify the above directory regularly in the future, and then change the above address prefix; you can also bind the directory to a secondary Domain name, change the domain name regularly in the future.)

2. To enter the flash address in the background, just enter the following address (transfer the flash to the flashpath directory above), then enter the address As follows:

2006/dgcms.swf

3. Add the code to output flash playback in the content template: (The following is assuming that flashpath.js is placed in the root directory)

<script src="/flashpath.js"></script>
<script>
    document.write("<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.
    cab#version=6,0,29,0" 
    width="[!--width--]" height="[!--height--]">");
    document.write("<param name="movie" value=""+flashpathval+"[!--flashurl--]">");
    document.write("<param name="quality" value="high">");
    document.write("<embed src=""+flashpathval+"[!--flashurl--]" quality="high" pluginspage=
    "http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" w
    idth="[!--width--]" height="[!--height--]"></embed></object>");
</script>

Final note:

1. The above is just an example for flash, is also applicable Anti-theft for video/mp3 and other files.

2. If you have a server, you canset the flashpath.js file so that it cannot be downloaded and read. This way others won't be able to get your flash address.

 3. Compared with the method of replacing address field values ​​in batches, this method requires refreshing the page,
while this method only needs to change the prefix of the flashpath.js file and does not need to be refreshed. page

The above is the detailed content of How to prevent hotlinking in Imperial CMS. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn