⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 download.asp

📁 这是一套基于WEB的网站管理系统
💻 ASP
字号:
<!--#include file="config.asp" -->
<%
Dim Rs,SQL,ErrMsg
Dim flashid,downid,ClassID,title
Dim DownFileName,DownAddress,PointNum,UserGroup
Dim DownloadUrl,strDownAddress,strDownloadUrl,User_Group

flashid = Newasp.ChkNumeric(Request.Querystring("id"))
downid = Newasp.ChkNumeric(Request.Querystring("downid"))
If flashid = 0 Then
	ErrMsg = ErrMsg & "<li>错误的系统参数!请输入正确的软件ID</li>"
	FoundErr=True
End If
If Not Newasp.CheckOuterUrl Then
	ErrMsg = ErrMsg & "<li>非法下载,请不要盗链本站资源!</li>"
	FoundErr=True
End If

Call BeginDownload

If FoundErr Then
	Returnerr(ErrMsg)
End If
Set NewCloud = Nothing
CloseConn

Sub BeginDownload()
	If FoundErr Then Exit Sub
	Dim GroupSetting,GroupName,gradeid,rootid

	If Trim(Newasp.membergrade) <> "" Then
		gradeid = CInt(Newasp.membergrade)
	Else
		gradeid = 0
	End If
	User_Group = 0
	GroupSetting = Split(Newasp.UserGroupSetting(gradeid), "|||")
	GroupName = GroupSetting(UBound(GroupSetting))
	If CInt(GroupSetting(31)) = 0 Then
		ErrMsg = ErrMsg & "<li>对不起!你是" & GroupName & ";不能下载本站资源。</li>"
		FoundErr=True
		Exit Sub
	End If

	SQL = "SELECT ClassID,title,DownAddress,PointNum,UserGroup FROM NC_FlashList WHERE ChannelID="& ChannelID &" And isAccept > 0 And flashid=" & flashid
	Set Rs = Newasp.Execute(SQL)
	If Rs.EOF And Rs.BOF Then
		ErrMsg = ErrMsg & "<li>对不起~!没有找到你想下载的软件。</li>"
		FoundErr=True
		Set Rs = Nothing
		Exit Sub
	Else
		ClassID = Rs("ClassID")
		title = Rs("title")
		DownAddress = Rs("DownAddress")
		PointNum = Rs("PointNum")
		UserGroup = Rs("UserGroup")
		
	End If
	Rs.Close:Set Rs = Nothing
	Set Rs = Newasp.Execute("SELECT UserGroup FROM NC_Classify WHERE ChannelID="& ChannelID &" And ClassID="& ClassID)
	If Rs("UserGroup") > gradeid Then
		ErrMsg = ErrMsg & "<li>您没有登录或者你的会员级别不够!</li><li>如果你是本站会员, 请先<a href=""../user/"">登陆</a>后再下载!</li>"
		FoundErr=True
		Set Rs = Nothing
		Exit Sub
	End If
	Set Rs = Nothing
	If downid > 0 Then
		SQL = "SELECT rootid,downid,DownloadPath,UserGroup,DownPoint FROM NC_DownServer WHERE ChannelID="& ChannelID &" And isLock=0 And downid=" & downid
		Set Rs = Newasp.Execute(SQL)
		If Rs.EOF And Rs.BOF Then
			ErrMsg = ErrMsg & "<li>注意:您所下载的文件不存在。</li>"
			FoundErr=True
			Set Rs = Nothing
			Exit Sub
		Else
			rootid = Rs("rootid")
			DownloadUrl = Trim(Rs("DownloadPath"))
			User_Group = Rs("UserGroup")
			If User_Group > gradeid Then
				ErrMsg = ErrMsg & "<li>注意:此下载服务器是会员专用;</li><li>如果你是本站会员, 请先<a href=""../user/"">登陆</a>后再下载!</li>"
				FoundErr=True
				Set Rs = Nothing
				Exit Sub
			End If
			If Rs("UserGroup") > 0 Then
				PointNum = Rs("DownPoint")
				CheckUserDownload flashid,PointNum,User_Group,GroupName
			Else
				PointNum = PointNum
			End If
		End If
		Rs.Close:Set Rs = Nothing
		DownloadUrl = Trim(DownloadUrl & DownAddress)
	Else
		DownloadUrl = Trim(DownAddress)
	End If
	If CInt(UserGroup) > 0 And User_Group = 0 Then
		If Trim(Newasp.memberName) = "" Then
			ErrMsg = ErrMsg & "<li>此文件是会员软件,非会员不能下载。 如果你是本站会员请先<a href=""../user/"">登陆</a>!</li>"
			FoundErr=True
			Exit Sub
		End If
		CheckUserDownload softid,PointNum,UserGroup,GroupName
	End If
	If FoundErr=True Then Exit Sub
	Response.Redirect (DownloadUrl)
End Sub

Function CheckUserDownload(flashid,PointNum,UserGroup,GroupName)
	If FoundErr Then Exit Function
	If CInt(Newasp.membergrade) = 999 Then Exit Function
	On Error Resume Next
	Dim CookiesID,userpoint,UserGrade,UserToday
	If CInt(Newasp.memberclass) > 0 Then
		Set Rs = Server.CreateObject("ADODB.Recordset")
		SQL = "SELECT userid,UserGrade,UserClass,ExpireTime FROM NC_User WHERE UserClass>0 And username='" & Newasp.memberName & "' And userid=" & Newasp.memberid
		Rs.Open SQL,Conn,1,3
		If Rs.BOF And Rs.EOF Then
			ErrMsg = ErrMsg & "<li>非法操作~!</li>"
			FoundErr=True
			Set Rs = Nothing
			Exit Function
		Else
			If DateDiff("D", CDate(Rs("ExpireTime")), Now()) > 0 Or Rs("UserClass") = 999 Then
				ErrMsg = ErrMsg & "<li>对不起!您的会员已到期,不能下载此软件;</li><li>如果你要下载此软件请联系管理员。</li>"
				FoundErr=True
				Set Rs = Nothing
				Exit Function
			Else
				Set Rs = Nothing
				Exit Function
			End If
		End If
		Rs.Close:Set Rs = Nothing
	End If
	CookiesID = "flashid_" & flashid
	If Trim(Request.Cookies("DownLoadFlash")) = "" Then
		Response.Cookies("DownLoadFlash")("userip") = Newasp.GetUserIP
		Response.Cookies("DownLoadFlash").Expires = Date + 1
	End If
	
	If CLng(Request.Cookies("DownLoadFlash")(CookiesID)) <> CLng(flashid) And CInt(UserGroup) > 0 Then
		Set Rs = Server.CreateObject("ADODB.Recordset")
		SQL = "SELECT userid,UserGrade,userpoint,UserToday,ExpireTime FROM NC_User WHERE username='" & Newasp.memberName & "' And userid=" & Newasp.memberid
		Rs.Open SQL,Conn,1,3
		If Rs.BOF And Rs.EOF Then
			ErrMsg = ErrMsg & "<li>非法操作~!</li>"
			FoundErr=True
			Set Rs = Nothing
			Exit Function
		Else
			userpoint = Rs("userpoint")
			UserGrade = Rs("UserGrade")
			UserToday = Rs("UserToday")
			UserToday = Split(UserToday, "|")
			If UserGrade < UserGroup  Then
				ErrMsg = ErrMsg & "<li>您的级别不够,下载此软件需要<font color=blue>"& GroupName &"</font>以上级别的会员;</li><li>如果你要下载此软件请联系管理员。</li>"
				FoundErr=True
				Set Rs = Nothing
				Exit Function
			End If
			
			If CInt(Newasp.memberclass) = 0 Then
				If userpoint < PointNum Then
					ErrMsg = ErrMsg & "<li>对不起!您的点数不足。不能下载此软件</li><li>下载本软件所需的点数:"& PointNum &"</li><li>如果你确实要下载此软件请到<a href=""../user/"">会员中心</a>充值。</li>"
					FoundErr=True
					Set Rs = Nothing
					Exit Function
				Else
					Rs("userpoint").Value = CLng(Rs("userpoint") - PointNum)
					Rs.Update
					Response.Cookies("DownLoadFlash")(CookiesID) = flashid
				End If
				
			End If
		End If
		Rs.Close:Set Rs = Nothing
	End If
End Function
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -