📄 soft_down.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
option explicit
response.buffer=true
'强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
%>
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/Conn_User.asp"-->
<!--#include file="inc/func.asp"-->
<%
dim SoftID,UrlID,ComeUrl,cUrl
dim FoundErr,ErrMsg
dim rsSoft,sqlSoft,DownloadUrl
SoftID=trim(request("SoftID"))
UrlID=trim(request("UrlID"))
if SoftID="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>请指定软件ID</li>"
else
SoftID=Clng(SoftID)
end if
if UrlID="" then
UrlID=1
else
UrlID=Clng(UrlID)
end if
ComeUrl=lcase(trim(request.ServerVariables("HTTP_REFERER")))
cUrl=lcase(trim("http://" & Request.ServerVariables("SERVER_NAME") & request.ServerVariables("SCRIPT_NAME")))
UserLogined=CheckUserLogined()
call main()
call CloseConn()
if FoundErr=True then
response.write ErrMsg
else
'能够简单的防止用户使用IE查看到文件地址,但不能防腾讯浏览器及FlashGet等软件。
response.redirect DownloadUrl
response.write "window.close();</script>"
end if
sub main()
if ComeUrl="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>本站软件做了防盗链处理,请从本站的软件下载页面进入下载本软件!而不要直接在浏览器的地址栏输入下载地址。</li>"
else
if left(ComeUrl,instrrev(ComeUrl,"/"))<>left(cUrl,instrrev(cUrl,"/")) then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>请勿非法盗链或下载本站软件!</li>"
end if
end if
if FoundErr=True then
exit sub
end if
sqlSoft="select * from Soft where SoftID=" & SoftID
Set rsSoft= Server.CreateObject("ADODB.Recordset")
rsSoft.open sqlSoft,conn,1,3
if rsSoft.bof and rsSoft.bof then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>找不到指定的软件!</li>"
else
select case UrlID
case 1
DownloadUrl=rsSoft("DownloadUrl1")
case 2
DownloadUrl=rsSoft("DownloadUrl2")
case 3
DownloadUrl=rsSoft("DownloadUrl3")
case 4
DownloadUrl=rsSoft("DownloadUrl4")
end select
if DownloadUrl="" or DownloadUrl="http://" then
Founderr=True
ErrMsg=ErrMsg & "<br><li>找不到有效下载地址!</li>"
end if
if FoundErr=True then
rsSoft.close
set rsSoft=nothing
exit sub
end if
if rsSoft("SoftLevel")<=999 then
if UserLogined<>True then
FoundErr=True
ErrMsg=ErrMsg & "<br> 你还没注册?或者没有登录?这个软件要求至少是本站的注册用户才能下载!<br><br>"
ErrMsg=ErrMsg & " 如果你还没注册,请赶紧<a href='User_Reg.asp'><font color=red>点此注册</font></a>吧!<br><br>"
ErrMsg=ErrMsg & " 如果你已经注册但还没登录,请赶紧<a href='User_Login.asp'><font color=red>点此登录</font></a>吧!<br><br>"
else
if UserLevel>rsSoft("SoftLevel") then
FoundErr=True
ErrMsg=ErrMsg & "<p align='center'><br><br><font color=red><b>对不起,你的权限不够,不能下载此软件!</b></font></p>"
else
if ChargeType=1 and rsSoft("SoftPoint")>0 then
if UserPoint<rsSoft("SoftPoint") then
FoundErr=True
ErrMsg=ErrMsg &"<p align='center'><br><br>对不起,下载本软件需要消耗 <b><font color=red>" & rsSoft("SoftPoint") & "</font></b> 点!"
ErrMsg=ErrMsg &"而你目前只有 <b><font color=blue>" & UserPoint & "</font></b> 点可用。点数不足,无法下载本软件。请与我们联系进行充值。</p>"
else
Conn_User.execute "update " & db_User_Table & " set " & db_User_UserPoint & "=" & db_User_UserPoint & "-" & rsSoft("SoftPoint") & " where " & db_User_Name & "='" & UserName & "'"
end if
elseif ChargeType=2 then
if ValidDays<=0 then
FoundErr=True
ErrMsg=ErrMsg & "<p align='center'><br><br><font color=red>对不起,本软件为收费下载,而您的有效期已经过期,所以无法下载本软件。请与我们联系进行充值。</font></p>"
end if
end if
end if
end if
end if
if FoundErr=True then
rsSoft.close
set rsSoft=nothing
exit sub
end if
rsSoft("Hits")=rsSoft("Hits")+1
if datediff("D",rsSoft("LastHitTime"),now())<=0 then
rsSoft("DayHits")=rsSoft("DayHits")+1
else
rsSoft("DayHits")=1
end if
if datediff("ww",rsSoft("LastHitTime"),now())<=0 then
rsSoft("WeekHits")=rsSoft("WeekHits")+1
else
rsSoft("WeekHits")=1
end if
if datediff("m",rsSoft("LastHitTime"),now())<=0 then
rsSoft("MonthHits")=rsSoft("MonthHits")+1
else
rsSoft("MonthHits")=1
end if
rsSoft("LastHitTime")=now()
rsSoft.update
end if
rsSoft.close
set rsSoft=nothing
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -