www.gusucode.com > 艺术签名文章资讯网源代码 > 艺术签名文章资讯网源代码/624/soft/download.asp
<!--#include file="config.asp" --> <!--#include file="../inc/base64.asp"--> <% Dim Rs,SQL,ErrMsg,id,IsUseServer Dim softid,SoftName,downid,ClassID Dim DownFileName,PointNum,GroupSetting,UserGroup Dim DownloadUrl,User_Group,username Dim ReturnPoint,addPoint,SoftPointNum,IsOuter Dim strInstallPath,UseDownRecord If Newasp.BindDomain = "0" Then strInstallPath = Newasp.InstallDir Else strInstallPath = Newasp.SiteUrl & Newasp.InstallDir End If IsUseServer = False UseDownRecord = 0 '--是否开启返点功能,是=True,否=False ReturnPoint = False '-- 当软件不需要点数下载时返回用户的点数 addPoint = 0 softid = Newasp.ChkNumeric(Request.Querystring("softid")) downid = Newasp.ChkNumeric(Request.Querystring("downid")) id = Newasp.ChkNumeric(Request.Querystring("id")) If softid = 0 Then ErrMsg = ErrMsg & "<li>错误的系统参数!请输入正确的软件ID</li>" FoundErr=True End If If Not Newasp.CheckOuterUrl Then ErrMsg = ErrMsg & "<li>非法下载,请不要盗链本站资源!</li>" FoundErr=True End If Newasp.Checkspider() Call SoftDown If FoundErr Then Returnerr(ErrMsg) End If Set NewCloud = Nothing CloseConn Sub SoftDown() If FoundErr Then Exit Sub Dim 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)) UseDownRecord = Newasp.ChkNumeric(GroupSetting(42)) If CInt(GroupSetting(31)) = 0 Then ErrMsg = ErrMsg & "<li>对不起!你是" & GroupName & ";不能下载本站资源。</li>" FoundErr=True Exit Sub End If On Error Resume Next SQL = "SELECT ClassID,SoftName,SoftVer,PointNum,UserGroup,username,PauseDown FROM NC_SoftList WHERE ChannelID="& ChannelID &" And isAccept <> 0 And SoftID=" & SoftID 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 = CLng(Rs("ClassID")) SoftName =Trim( Rs("SoftName") &" "& Rs("SoftVer")) PointNum = CLng(Rs("PointNum")) UserGroup = CInt(Rs("UserGroup")) username = Rs("username") & "" If Rs("PauseDown") > 0 Then ErrMsg = ErrMsg & "<li>对不起!本软件暂时停止下载。</li>" FoundErr=True Exit Sub End If SoftPointNum = PointNum End If 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 IsUseServer = True SQL = "SELECT rootid,downid,DownloadPath,UserGroup,DownPoint,IsOuter 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") IsOuter = Rs("IsOuter") If User_Group > gradeid Then ErrMsg = ErrMsg & "<li>注意:此下载服务器是会员专用;</li><li>如果你是本站会员, 请先<a href=""../user/"">登陆</a>后再下载!</li><li>或者你的会员级别不够,请联系管理员...</li>" FoundErr=True Set Rs = Nothing Exit Sub End If If Rs("UserGroup") > 0 Then PointNum = Rs("DownPoint") CheckUserDownload softid,PointNum,User_Group,GroupName Else PointNum = PointNum End If End If Set Rs = Nothing If IsOuter <> 1 Then SQL = "SELECT downid,DownFileName FROM NC_DownAddress WHERE ChannelID="& ChannelID &" And softid="& softid &" And downid="& rootid &" And id=" & id Set Rs = Newasp.Execute(SQL) If Rs.EOF And Rs.BOF Then ErrMsg = ErrMsg & "<li>注意:您所下载的文件不存在。</li>" FoundErr=True Set Rs = Nothing Exit Sub Else Dim strDownFileName strDownFileName = Rs("DownFileName") & "" If Len(strDownFileName) > 0 Then strDownFileName = Left(strDownFileName,10) If InStr(1, strDownFileName, "://") > 0 Then DownloadUrl = Trim(Rs("DownFileName")) Else DownloadUrl = Trim(DownloadUrl & Rs("DownFileName")) End If End If Set Rs = Nothing End If Else IsUseServer = False SQL = "SELECT DownFileName FROM NC_DownAddress WHERE ChannelID="& ChannelID &" And softid="& softid &" And id=" & id Set Rs = Newasp.Execute(SQL) If Rs.EOF And Rs.BOF Then ErrMsg = ErrMsg & "<li>注意:您所下载的文件不存在。</li>" FoundErr=True Set Rs = Nothing Exit Sub Else DownloadUrl = Trim(Rs("DownFileName")) End If Set Rs = Nothing 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 Dim hits Set Rs = Server.CreateObject("ADODB.Recordset") SQL = "SELECT AllHits,DayHits,WeekHits,MonthHits,HitsTime FROM NC_SoftList WHERE softid="& softid Rs.Open SQL,Conn,1,3 If Not(Rs.BOF And Rs.EOF) Then hits = CLng(Rs("AllHits"))+1 Rs("AllHits").Value = hits If DateDiff("Ww", Rs("HitsTime"), Now()) <= 0 Then Rs("WeekHits").Value = Rs("WeekHits").Value + 1 Else Rs("WeekHits").Value = 1 End If If DateDiff("M", Rs("HitsTime"), Now()) <= 0 Then Rs("MonthHits").Value = Rs("MonthHits").Value + 1 Else Rs("MonthHits").Value = 1 End If If DateDiff("D", Rs("HitsTime"), Now()) <= 0 Then Rs("DayHits").Value = Rs("DayHits").Value + 1 Else Rs("DayHits").Value = 1 Rs("HitsTime").Value = Now() End If Rs.Update End If Rs.Close:Set Rs = Nothing If downid > 0 Then Set Rs = Server.CreateObject("ADODB.Recordset") SQL = "SELECT AllDownHits,DayDownHits,HitsTime FROM NC_DownServer WHERE downid="& downid Rs.Open SQL,Conn,1,3 If Not(Rs.BOF And Rs.EOF) Then hits = CLng(Rs("AllDownHits"))+1 Rs("AllDownHits").Value = hits If DateDiff("D", Rs("HitsTime"), Now()) <= 0 Then Rs("DayDownHits").Value = Rs("DayDownHits").Value + 1 Else Rs("DayDownHits").Value = 1 Rs("HitsTime").Value = Now() End If Rs.Update End If Rs.Close:Set Rs = Nothing End If Call addMemberPoint() If CInt(GroupSetting(34)) <> 0 Then RevealDownloadUrl(DownloadUrl) Else If IsOuter = 2 And NewCloud.ThunderUnionID <> "0" Then ThunderDownloadUrl(ThunderEncode(DownloadUrl)) Exit Sub ElseIf IsOuter = 3 And NewCloud.FlashGetUnionID <> "0" Then FlashGetDownloadUrl(DownloadUrl) Exit Sub ElseIf IsOuter = 4 And NewCloud.PPGouUnionID <> "0" Then PPGouDownloadUrl(DownloadUrl) Exit Sub Else Response.Redirect (DownloadUrl) End If End If End Sub Sub ThunderDownloadUrl(url) '--WEB迅雷专用连接JS文件 'Response.Write "<script src='http://pstatic.xunlei.com/js/webThunderSpecial.js'></script>" & vbNewLine '--迅雷5专用连接JS文件 Response.Write "<script src='http://pstatic.xunlei.com/js/webThunderDetect.js'></script>" & vbNewLine Response.Write "<script>OnDownloadClick('" & url & "','',location.href,'" & NewCloud.ThunderUnionID & "',false)</script>" & vbNewLine 'Response.Write "<script>window.setInterval(""window.close()"",3600);</script>" & vbCrLf End Sub Sub FlashGetDownloadUrl(url) Dim m_strFlashGetUrl,m_strDownUrl '--此处为文件实际下载地址 m_strDownUrl = url m_strFlashGetUrl = FlashgetEncode(m_strDownUrl,NewCloud.FlashGetUnionID) Response.Write "<script src=""http://ufile.kuaiche.com/Flashget_union.php?fg_uid=" & NewCloud.FlashGetUnionID & """></script>" & vbCrLf Response.Write "<script>function ConvertURL2FG(url,fUrl,uid){ try{ FlashgetDown(url,uid); }catch(e){ location.href = fUrl; }}"& vbCrLf Response.Write "function Flashget_SetHref(obj){obj.href = obj.fg;}</script>"& vbCrLf Response.Write "<script>ConvertURL2FG('" & m_strFlashGetUrl & "','" & m_strDownUrl & "'," & NewCloud.FlashGetUnionID & ")</script>" & vbCrLf 'Response.Write "<script>window.setInterval(""window.close()"",3600);</script>" & vbCrLf End Sub Sub PPGouDownloadUrl(url) Response.Write "<script language='javascript' src='"& strInstallPath &"js/ppgou.js'></script>" & vbNewLine Response.Write "<script>IPPGouDown('" & url & "','','','" & NewCloud.PPGouUnionID & "')</script>" & vbNewLine End Sub Sub CheckUserDownload(softid,PointNum,UserGroup,GroupName) If FoundErr Then Exit Sub Call GetUserTodayInfo If CInt(Newasp.membergrade) = 999 Then Exit Sub On Error Resume Next Dim CookiesID,userpoint,UserGrade,DownCooliesID,strUserToday Dim CookieSoftID,CookieDownID,UpdateUserInfo UpdateUserInfo = True 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.CheckBadstr(Newasp.memberName) & "' And userid=" & CLng(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 Sub 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 Sub End If End If Rs.Close:Set Rs = Nothing If UseDownRecord = 2 Then If ChkDownRecord(1) Then UpdateUserInfo = False Else UpdateUserInfo = True End If End If If UpdateUserInfo = True Then If CLng(UserToday(0)) => CLng(GroupSetting(45)) And CLng(GroupSetting(45))>0 Then FoundErr = True ErrMsg = ErrMsg + "<li>您每天最多只能下载<font color=""red""><b>" & GroupSetting(45) & "</b></font>个软件,如果还要继续下载请明天再来吧!</li>" Exit Sub End If strUserToday = Newasp.ChkNumeric(UserToday(0))+1 &","& UserToday(1) &","& UserToday(2) &","& UserToday(3) &","& UserToday(4) &","& UserToday(5) UpdateUserToday(strUserToday) End If If UseDownRecord = 2 Then Newasp.Execute ("UPDATE NC_UserDown SET isdown1=1 WHERE softid=" & softid & " And userid=" & CLng(Newasp.memberid)) End If Exit Sub End If If UseDownRecord < 2 Then CookiesID = "softid_" & softid DownCooliesID = "downid_" & downid & "_" & softid CookieSoftID = Newasp.ChkNumeric(Request.Cookies("DownLoadSoft")(CookiesID)) CookieSoftID = CLng(CookieSoftID) CookieDownID = Newasp.ChkNumeric(Request.Cookies("DownLoadSoft")(DownCooliesID)) CookieDownID = CLng(CookieDownID) If Trim(Request.Cookies("DownLoadSoft")) = "" Then Response.Cookies("DownLoadSoft")("userip") = Newasp.GetUserIP Response.Cookies("DownLoadSoft").Expires = Date + 1 End If If CookieSoftID = softid And IsUseServer = False Then UpdateUserInfo = False If CookieSoftID = softid And IsUseServer And User_Group = 0 Then UpdateUserInfo = False If IsUseServer And CookieSoftID = softid And CookieDownID = downid And User_Group > 0 Then UpdateUserInfo = False End If End If If PointNum < 1 Then If UseDownRecord = 2 Then '-- 打开所有下载记录 If ChkDownRecord(2) Then UpdateUserInfo = False Else UpdateUserInfo = True End If End If If UpdateUserInfo = True Then If CLng(UserToday(0)) => CLng(GroupSetting(44)) And CLng(GroupSetting(44))>0 Then FoundErr = True ErrMsg = ErrMsg + "<li>您每天最多只能下载<font color=""red""><b>" & GroupSetting(44) & "</b></font>个软件,如果还要继续下载请明天再来吧!</li>" Exit Sub End If strUserToday = Newasp.ChkNumeric(UserToday(0))+1 &","& UserToday(1) &","& UserToday(2) &","& UserToday(3) &","& UserToday(4) &","& UserToday(5) UpdateUserToday(strUserToday) End If If UseDownRecord = 2 Then Newasp.Execute ("UPDATE NC_UserDown SET isdown2=1 WHERE softid=" & softid & " And userid=" & CLng(Newasp.memberid)) End If Exit Sub End If If UseDownRecord > 0 Then If ChkDownRecord(0) Then UpdateUserInfo = False Else UpdateUserInfo = True End If End If If CInt(UserGroup) > 0 And UpdateUserInfo Then If CLng(UserToday(0)) => CLng(GroupSetting(44)) And CLng(GroupSetting(44))>0 Then FoundErr = True Set Rs = Nothing ErrMsg = ErrMsg + "<li>您每天最多只能下载<font color=""red""><b>" & GroupSetting(44) & "</b></font>个软件,如果还要继续下载请明天再来吧!</li>" Exit Sub End If Set Rs = Server.CreateObject("ADODB.Recordset") SQL = "SELECT userid,UserGrade,userpoint,UserToday,ExpireTime FROM NC_User WHERE username='" & Newasp.CheckBadstr(Newasp.memberName) & "' And userid=" & CLng(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 Sub Else userpoint = Rs("userpoint") If userpoint < 0 Then Rs("userpoint").Value = 0 Rs.Update Set Rs = Nothing Exit Sub End If UserGrade = Rs("UserGrade") If UserGrade < UserGroup Then ErrMsg = ErrMsg & "<li>您的级别不够,下载此软件需要<font color=""blue"">"& GroupName &"</font>以上级别的会员;</li><li>如果你要下载此软件请联系管理员。</li>" FoundErr=True Set Rs = Nothing Exit Sub End If If userpoint < PointNum Then ErrMsg = ErrMsg & "<li>对不起!您的点数不足。不能下载此软件</li><li>下载本软件所需的点数:"& PointNum &"</li><li>如果你确实要下载此软件请到<a href=""../user/"">会员中心</a>充值。</li>" FoundErr=True Set Rs = Nothing Exit Sub Else Rs("userpoint").Value = CLng(Rs("userpoint") - PointNum) Rs.Update If UseDownRecord < 2 Then Response.Cookies("DownLoadSoft")(CookiesID) = softid Response.Cookies("DownLoadSoft")(DownCooliesID) = downid End If End If End If Rs.Close:Set Rs = Nothing If UseDownRecord > 0 Then Newasp.Execute ("UPDATE NC_UserDown SET isdown1=1 WHERE softid=" & softid & " And userid=" & CLng(Newasp.memberid)) End If strUserToday = Newasp.ChkNumeric(UserToday(0))+1 &","& UserToday(1) &","& UserToday(2) &","& UserToday(3) &","& UserToday(4) &","& UserToday(5) UpdateUserToday(strUserToday) End If End Sub Function ChkDownRecord(stype) ChkDownRecord = False If Newasp.memberid = 0 Then Exit Function Dim maxdaynum,IsDownRecord,isdown1,isdown2 IsDownRecord = True maxdaynum = Newasp.CheckNumeric(GroupSetting(43)) Set Rs = Server.CreateObject("ADODB.Recordset") SQL = "SELECT * FROM NC_UserDown WHERE softid=" & softid & " And userid=" & CLng(Newasp.memberid) Rs.Open SQL,Conn,1,3 If Rs.BOF And Rs.EOF Then Rs.Addnew Rs("ChannelID").Value = ChannelID Rs("userid").Value = Newasp.memberid Rs("UserName").Value = Newasp.CheckBadstr(Newasp.memberName) Rs("softid").Value = softid Rs("title").Value = Left(SoftName,255) Rs("downtime").Value = Now() Rs("lasttime").Value = Now() Rs("downhits").Value = 1 Rs("isdown1").Value = 0 Rs("isdown2").Value = 0 Rs("isdel").Value = 0 Rs.Update IsDownRecord = False Else isdown1 = Rs("isdown1").Value isdown2 = Rs("isdown1").Value Rs("downhits").Value = Rs("downhits").Value + 1 If DateDiff("D", Rs("lasttime"), Now()) < maxdaynum Then If isdown1 = 0 And stype < 2 Then IsDownRecord = False Else If isdown2 = 0 And stype = 2 Then IsDownRecord = False Else IsDownRecord = True End If End If Else If maxdaynum <= 0 And isdown1 = 1 And stype < 2 Then IsDownRecord = True Else If maxdaynum <= 0 And isdown2 = 1 And stype = 2 Then IsDownRecord = True Else IsDownRecord = False End If End If Rs("lasttime").Value = Now() Rs("isdown1").Value = 0 Rs("isdown2").Value = 0 End If Rs("title").Value = Left(SoftName,255) Rs("isdel").Value = 0 Rs.Update End If Rs.Close:Set Rs = Nothing If IsDownRecord Then ChkDownRecord = True Else ChkDownRecord = False End If End Function Sub addMemberPoint() Dim CookiesID If ReturnPoint Then If SoftPointNum = 0 Then SoftPointNum = addPoint If SoftPointNum > 0 Then CookiesID = "Point_" & softid If Trim(Request.Cookies("DownLoadSoft")) = "" Then Response.Cookies("DownLoadSoft")("userip") = Newasp.GetUserIP Response.Cookies("DownLoadSoft").Expires = Date + 1 End If If Request.Cookies("DownLoadSoft")(CookiesID) <> "yes" Then Newasp.Execute ("UPDATE NC_User SET userpoint=userpoint+" & SoftPointNum & " WHERE username='" & Replace(username, "'", "") & "'") End If Response.Cookies("DownLoadSoft")(CookiesID) = "yes" End If End If End Sub Sub RevealDownloadUrl(url) Response.Write "<html><head><title>" & SoftName & "</title>" & vbCrLf Response.Write "<meta http-equiv=Content-Type content=text/html; charset=gb2312>" & vbCrLf Response.Write "<style type=""text/css"">" & vbNewLine Response.Write "body {font-size: 12px;font-family: 宋体;}" & vbNewLine Response.Write "td {font-size: 12px; font-family: 宋体; line-height: 18px;table-layout:fixed;word-break:break-all}" & vbNewLine Response.Write "a {color: #555555; text-decoration: none}" & vbNewLine Response.Write "a:hover {color: #FF8C40; text-decoration: underline}" & vbNewLine Response.Write "th{ background-color: #3795D2;color: white;font-size: 12px;font-weight:bold;height: 25;}" & vbNewLine Response.Write ".TableRow1 {background-color:#F7F7F7;}" & vbNewLine Response.Write ".TableRow2 {background-color:#F0F0F0;}" & vbNewLine Response.Write ".TableBorder {border: 1px #3795D2 solid ; background-color: #FFFFFF;font: 12px;}" & vbNewLine Response.Write "</style>" & vbNewLine Response.Write "</head><body><br /><br />" & vbCrLf Response.Write "<table width=500 border=0 align=center cellpadding=0 cellspacing=0 class=TableBorder>" Response.Write "<tr>" Response.Write " <th>" & SoftName & "</th>" Response.Write "</tr>" Response.Write "<tr height=50>" Response.Write "<td class=TableRow1 align=center>提示:下载此软件需要扣除 <b><font color=red>" & PointNum & "</font></b>点</td>" Response.Write "</tr>" Response.Write "<tr height=50>" Response.Write "<td class=TableRow1 align=center><a href=""" & url & """><font color=blue>立即下载</font> -- " & SoftName & "</a></td>" Response.Write "</tr>" Response.Write "<tr height=22><td align=center class=TableRow2><a href=./>返回首页...</a> | <a href=javascript:window.close()>关闭本窗口...</a></td></tr>" Response.Write "</table>" Response.Write "<br /><br /></body></html>" End Sub %>