%@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"
%>
<%
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 & "
请指定软件ID"
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();"
end if
sub main()
if ComeUrl="" then
FoundErr=True
ErrMsg=ErrMsg & "
本站软件做了防盗链处理,请从本站的软件下载页面进入下载本软件!而不要直接在浏览器的地址栏输入下载地址。"
else
if left(ComeUrl,instrrev(ComeUrl,"/"))<>left(cUrl,instrrev(cUrl,"/")) then
FoundErr=True
ErrMsg=ErrMsg & "
请勿非法盗链或下载本站软件!"
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 & "
找不到指定的软件!"
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 & "
找不到有效下载地址!"
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 & "
你还没注册?或者没有登录?这个软件要求至少是本站的注册用户才能下载!
"
ErrMsg=ErrMsg & " 如果你还没注册,请赶紧点此注册吧!
"
ErrMsg=ErrMsg & " 如果你已经注册但还没登录,请赶紧点此登录吧!
"
else
if UserLevel>rsSoft("SoftLevel") then
FoundErr=True
ErrMsg=ErrMsg & "
对不起,你的权限不够,不能下载此软件!
"
else
if ChargeType=1 and rsSoft("SoftPoint")>0 then
if UserPoint
对不起,下载本软件需要消耗 " & rsSoft("SoftPoint") & " 点!"
ErrMsg=ErrMsg &"而你目前只有 " & UserPoint & " 点可用。点数不足,无法下载本软件。请与我们联系进行充值。"
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 & "
对不起,本软件为收费下载,而您的有效期已经过期,所以无法下载本软件。请与我们联系进行充值。
"
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
%>