以動感下載系統為例:
開啟檔案SoftDown.Asp 在:
if request.QueryString("ID")="" then
response.write "不能連接或沒有指定下載軟體"
response.end
end if
的上面或是下面加上下列程式碼
dim strReferer,domain,splDomain,isHttp
isHttp=false
'本站下載系統網址列表,不要帶http://
domain="sron.net,61.156.14.223,61.156.14.227"
splDomain=split(domain,",")
strReferer=Request.ServerVariables("HTTP_REFERER")
for iii = 0 to ubound(splDomain)
if instr(strReferer,trim(splDomain(iii)))>0 then isHttp=True
next
if isnull(strReferer) or isHttp=false then
Response.Write "下載連結來自其他網站,這是不允許的,<a href=""./"">請進入本站頁面後再進行下載。</a>"
CloseDatabase
response.end
end if
本站下載系統網址列表就是訪問你下載頻道網址裡的域名,例如你的下載頻道可以用多個網址來訪問,所以這裡用逗號隔開