Dedecms software download anti-theft chain processing scheme

Source: Internet
Author: User
Keywords Dedecms anti-theft chain

Use Dedecms to set up a resource class download site, the server's bandwidth will often be illegal hotlinking information on the Internet, make their own web site access and download are very slow, seriously affect the normal users of the site download and experience, to continue to seek and improve the download mechanism, become very important, We can use a small piece of code to easily achieve dedecms software download anti-theft chain function.

OK, let's show you how to do that.

1, landing your http://www.aliyun.com/zixun/aggregation/8984.html "> website Management background--> system--> system settings--> software channel settings

Change the link display to: Require access to the Download address List page, as shown in the download screenshot:

2, modify the/plus/download.php file,

Probably found on line 43rd:

$row = $dsql->getone ("Select $vname from". $cu->channelinfos[' addtable ']. " ' WHERE aid= ' $aid ');

Add the following code to the above:

Increase anti-theft chain function 20140604
if (!strstr ($_server[' http_referer '), $arcurl))
{
echo "<script language= ' JavaScript ' >location=\" $arcurl \ ";</script>";
}

Upload and overwrite download.php files, test the anti-theft chain successfully.

The use of this code is to determine the user's http_referer information, if not from the content page, then automatically jump to the download content page, such as:

Hotlinking Address: Http://www.ithov.com/plus/download.php?open=2&id=24590&uhash=6e6564f227b465493ab74eed

The user clicks the link to automatically jump to the download content page:

Http://www.ithov.com/book/website/server/24590.shtml

In addition, if the students have the conditions, you can also use the Httpaccesskeymodule module to achieve a higher level of anti-theft chain effect, if you want a more in-depth understanding of the Httpaccesskeymodule module, the details can be read in the Nginx anti-theft chain Module Httpaccesskeymodule Configuration and use of the guide.

Attached download.php part of the Code for reference:

channelfields)) {showmsg (' Get document info failed! ', '-1 '); Exit (); $vname = '; foreach ($cu-&gt;channelfields as $k =&gt; $v) {if ($v [' type ']== ' Softlinks ') {$vname = $k; break;}}//Increase anti-theft chain feature 20140604 if (! Strstr ($_server[' http_referer '), $arcurl)) {echo "";} $row = $dsql-&gt;getone ("Select $vname from". $cu-&gt;channelinfos[' addtable ']. " ' WHERE aid= ' $aid '); Include_once (dedeinc.) /taglib/channel/softlinks.lib.php '); $ctag = '; $downlinks = Ch_softlinks ($row [$vname], $ctag, $cu, ", TRUE); Require_once (dedetemplate.) /plus/download_links_templet.htm '); Exit ();} ......
Related Article

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.