<!--#include file="down_conn.asp"-->
<!-- #include file="inc/const.asp" -->
<!-- #include file="inc/dv_ubbcode.asp" -->
<!-- #include file="inc/md5.asp" -->
<!-- #include file="down_function.asp" -->
<%
dim rs_nodown,showname,classid,Nclassid,classname,Nclassname,lasthits,sid,i,abgcolor,rdown
DIM URL,play,pimg


Dvbbs.LoadTemplates("")
Dvbbs.Stats="<a href=down_default.asp>下载中心</a> → 软件信息"
Dvbbs.Nav()'输出头
Dvbbs.Head_var 2,0,Dvbbs.Stats,""

if not isnull(session("ReflashTime")) then
  if DateDiff("s",session("ReflashTime"),Now())<retime then
  response.write "限制每次刷新距离时间为"&retime&"秒，"
     response.write "<meta HTTP-EQUIV=REFRESH CONTENT=3>正在打开页面，请稍后……"
	response.end
  else
  session("ReflashTime")=Now()
  end if
 end if


set rs_nodown=conndown.execute("select * from notdown")
	dim downpwd
	downpwd=rs_nodown("nodown")
rs_nodown.close
set rs_nodown=nothing

	if request("down")<>"" then
	call downsoft()
	response.end
	end if
	if isnumeric(request("id"))=0 then 
  FoundErrs  "<FONT color=red>指定的ID必须为正整数</font>"
ShowErrs(Dvbbs.Stats)
end if
   
	if request("id")=""  or request("id")="0" then
FoundErrs  "<FONT color=red>你没有指定下载地址的 ID，请确认ID后下载</font>"
ShowErrs(Dvbbs.Stats)
	end if
	set rs=server.createobject("adodb.recordset")
  	sql="select Dclass.class,DNclass.Nclass,download.showname,download.classid,download.Nclassid,download.lasthits,download.downshow from download,Dclass,DNclass where download.classid=Dclass.classid and download.Nclassid=DNclass.Nclassid and download.ID="&request("id")
 	rs.open sql,conndown,1,1
        if rs.bof and rs.eof then
  FoundErrs  "<FONT color=red>指定的下载ID不存在，该软件可能被删除了或者还没有添加，请确认ID后下载</font>"
ShowErrs(Dvbbs.Stats)
       elseif not rs.eof then
		showname=rs("showname")
		classid=rs("classid")
		Nclassid=rs("Nclassid")
		classname=rs("class")
		Nclassname=rs("Nclass")
		lasthits=rs("lasthits")
 	end if
	rs.close
'更新每周每日数据
	tdate=year(Now()) & "-" & month(Now()) & "-" & day(Now())
	if trim(lasthits)=trim(tdate) then
		sql="update download set dayhits=dayhits+1 where id="&request("id")
		conndown.Execute(sql)
'		response.write "success"
	else
		sql="update download set dayhits=1 where id="&request("id")
		conndown.Execute(sql)
'		response.write "error"
	end if
	sql="update download set hits=hits+1,lasthits='"&tdate&"' where ID="&request("id")
	conndown.Execute(sql)
	dim p_year,p_month,p_day,period_time
   	p_year=CInt(year(Now()))-CInt(year(lasthits))
   	p_month=CInt(month(Now()))-CInt(month(lasthits))
   	p_day=CInt(day(Now()))-CInt(day(lasthits))
   	period_time=((p_year*12+p_month)*30+p_day)
	if cint(period_time)=<cint(7) then
		sql="update download set weekhits=weekhits+1 where id="&request("id")
		conndown.Execute(sql)
	else
		sql="update download set weekhits=1 where id="&request("id")
		conndown.Execute(sql)
	end if

		
%>
<script language="JavaScript">
<!--
function Showvote(id)
{
	var filename="down_vote.asp?id="+id;
	window.open(filename,"显示窗口","scrollbars=yes,width=350,height=300");
}
//-->
</SCRIPT>

</object><!-- #include file="down_Forum_js.asp" -->
<body>
<table class="tableborder1" cellspacing=1 width="<%= Dvbbs.mainsetting(0) %>" align=center>
        <tr>
          <th valign=middle height=25 width="100%"><%
	dim sql1,rs1
	set rs=server.createobject("adodb.recordset")
	sql="select class,classid from Dclass"
	rs.open sql,conndown,1,3
	do while not rs.eof
%>
<a href="down_index.asp?classid=<%=rs("classid")%>" onMouseOver="showmenu(event,'<%=showdown(rs("classid"),0)%>')" style="CURSOR:hand"><font color="ffffff"><%=rs("class")%></font></a>|        
<%
	rs.movenext
	loop
	rs.close
%></th>
        </tr>
</table><br>
<table align=center border="0" width="<%= Dvbbs.mainsetting(0) %>">
  <tr>
    <td width="25%" valign="top" align="center">
<%if showset(10)=1 then%><!--#include file="down_allhot.asp"--><br><%end if%>
<%if showset(11)=1 then%><!--#include file="down_hot.asp"--><br><%end if%>
<%if showset(12)=1 then%><!--#include file="down_day.asp"--><br><%end if%>
<%if showset(13)=1 then%><!--#include file="down_week.asp"--><br><%end if%>
<%if showset(14)=1 then%><!--#include file="down_all.asp"--><%end if%></td>

    <td width="77%" valign="top" align="center">
    <table class="singleborder" cellspacing=1 width="100%" align=center >
        <%sid=request("id") 
	sql="select * from download where id="&request("id")   
	rs.open sql,conndown,1,1

	sid=rs("id")
      dim point,tieshu
   
%>  
	<tr><th width="100%" height="24" align="left"><a href="down_default.asp"><font  color="ffffff">下载分类</font></a> >> <a href='down_index.asp?classid=<%=classid%>'><font  color="ffffff"><%=classname%></font></a> >> <a  href='down_index.asp?classid=<%=classid%>&Nclassid=<%=Nclassid%>'><font  color="ffffff"><%=Nclassname%></font></a> >>                 
<%=rs("showname")%>   
        </tr> 
<tr><td class=tablebody2 height="20">
<%
dim sqls
set rss = server.CreateObject ("Adodb.recordset")
	sqls="select * from showpage"
	rss.open sqls,conndown,0,1
	if not(rss.eof and rss.bof) then
%><img src=down_images/gg_open.gif border="0" align="absmiddle">
<marquee scrollamount=3 onmouseover=this.stop(); onmouseout=this.start(); width="80%" height="24"><font color=red><%=rss("gonggao")%></font></marquee>
<%rss.close
end if%></td></tr>  
	<tr><td width="100%" class=tablebody1>  
            <table width="100%" align="center" class=tablebody1>

              <tr> 
                <td class=tablebody1 width="50%">软件名称：<b><%=rs("showname")%></b></td>
		 <td class=tablebody1 width="50%">软件属性：<%=soft(rs("softsx"))%></td>
              </tr>
              <tr> 
                <td class=tablebody1 width="50%">下载方式：<%=downshow(rs("downshow"))%></td>
                <td class=tablebody1 width="50%">授权方式：<%=rs("orders")%></td>
              </tr>
              <tr> 
                <td width="50%" class=tablebody1>软件类型：<%=Nclassname%></td>
                <td width="50%" class=tablebody1>软件评价：<%for i=1 to rs("hot")%><img  src="down_images/friend.gif"><%next%></td>
              </tr>
              <tr> 
                <td width="50%" class=tablebody1>软件大小：<%=rs("size")%></td>
                <td width="50%" class=tablebody1>相关链接：<a href="<%=rs("fromurl")%>">home  page</a></td>              
              </tr>
              <tr> 
                <td width="50%" class=tablebody1>上传时间：<%=rs("dateandtime")%></td>
                <td width="50%" class=tablebody1>本日下载：<%=rs("dayhits")%>&nbsp;&nbsp;本周： <%=rs("weekhits")%>&nbsp;&nbsp;总计：<%=rs("hits")%></td>             
              </tr>
              <tr> 

              </tr>
              <tr> 
                <td class=tablebody1 width="50%">运行环境：<%=rs("system")%></td>
                <td class=tablebody1 width="50%">本软件相关图片：</td>
              </tr>
              <tr> 
                <td class=tablebody1 width="50%">&nbsp;</td>
                <td class=tablebody1 width="50%" rowspan="2" valign="top" align="left">
                <%if rs("pic")<>"" and rs("pic")<>" " then%> <a href=<%=rs("pic")%> target=_blank><img src="<%=rs("pic")%>" border="0" alt=点击查看详细图片></a>
                <%else%><img src=down_images/moren.jpg border="0"   alt=没有该相关图片 >
                <%end if%> </td>
              </tr>
              <tr> 
                <td class=tablebody1 width="50%" valign="top" align="center">
 <SCRIPT language="JavaScript">     
function windowOpen(loadpos)     
{controlWindow=window.open(loadpos,"surveywin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=470,height=400,status=yes,resizable=yes");     
}    
</SCRIPT>
    <%
if (rs("usetime")=0 or (date()-rs("dateandtime")<=rs("usetime"))) and (rs("daydown")=0 or rs("daydown")=NULL or (rs("dayhits")<=rs("daydown"))) then
response.write "下载有效期："&downtime(rs("dateandtime"),rs("usetime"))&"<br><br>"
response.write "每日下载次数限制："&daydownload(rs("dayhits"),rs("daydown"))&"<br><br>"     
%>
<%if rs("filename")<>"" then%> 
下载1：<a href="down_list.asp?id=<%=rs("id")%>&down=1&dpwd=<%=md5(downpwd,16)%>" ><IMG SRC="down_images/download.gif" BORDER=0 ></a>
<%if rs("softsx")<>0 then%><a href="javascript:openScript('down_play.asp?id=<%=rs("id")%>&down=1',500,400)"><font color=blue>在线观看</font></a><%end if%><br><%end if%>
<%if rs("filename1")<>"" then%>               
下载2：<a href="down_list.asp?id=<%=rs("id")%>&down=2&dpwd=<%=md5(downpwd,16)%>" ><IMG SRC="down_images/download.gif" BORDER=0"></a>
<%if rs("softsx")<>0 then%><a href="javascript:openScript('down_play.asp?id=<%=rs("id")%>&down=2',500,400)"><font color=blue>在线观看</font></a><%end if%><br><%end if%>
<%if rs("filename2")<>"" then%>
下载3：<a href="down_list.asp?id=<%=rs("id")%>&down=3&dpwd=<%=md5(downpwd,16)%>" ><IMG SRC="down_images/download.gif" BORDER=0 alt=下载地址三></a>
<%if rs("softsx")<>0 then%><a href="javascript:openScript('down_play.asp?id=<%=rs("id")%>&down=3',500,400)"><font color=blue>在线观看</font></a><%end if%><br><%end if%>
<%if rs("filename3")<>"" then%>下载4：<a href="down_list.asp?id=<%=rs("id")%>&down=4&dpwd=<%=md5(downpwd,16)%>" ><IMG SRC="down_images/download.gif" BORDER=0 alt=下载地址四></a>
<%if rs("softsx")<>0 then%><a href="javascript:openScript('down_play.asp?id=<%=rs("id")%>&down=4',500,450)"><font color=blue>在线观看</font></a><%end if%><br>          
                                                           <%end if%>  
 <%if rs("filename4")<>"" then%>下载5：<a href="down_list.asp?id=<%=rs("id")%>&down=5&dpwd=<%=md5(downpwd,16)%>" ><IMG SRC="down_images/download.gif" BORDER=0 alt=下载地址五></a><%if rs("softsx")<>0 then%><a href="javascript:openScript('down_play.asp?id=<%=rs("id")%>&down=5',500,450)"><font color=blue>在线观看</font></a><%end if%> <%end if%>   

<%
else
response.write "下载有效期：<font color=red>"&downtime(rs("dateandtime"),rs("usetime"))&"</font><br><br>"
response.write "每日下载次数限制：<font color=red>"&daydownload(rs("dayhits"),rs("daydown"))&"</font><br><br>"
end if

%>   
      
	        </td>
              </tr>

              <tr> 
                <td colspan="2" class=tablebody1 width="100%"> 
                  <p>软件简介：</p>
                </td>
              </tr>
              <tr> 
                <td colspan="2" class=tablebody1 width="100%">
                <blockquote>
                <%
response.write replace(replace(rs("note"),chr(13),"<br>"),chr(32),"&nbsp;&nbsp;")%></blockquote></td>
              </tr>
              <tr> 
                <td width="50%" class=tablebody1>&nbsp;</td>
                <td width="50%" class=tablebody1>&nbsp;提供人:<font color=red><%=Dvbbs.Forum_info(0)%></font>  <b><a href="javascript:openScript('messanger.asp?action=new&touser=<%=rs("adduser")%>',500,400)"><%=rs("adduser")%></a></b>
                </td>
              </tr>
              <tr> 
                <td colspan="2" class=tablebody1 width="575"> 
<font color=red>＊</font> 推荐使用网络蚂蚁下载本站软件，如果您发现链接错误或其它问题，请写信通知 我们。<br>      
<font color=red>＊</font> 如果您链接本站本地软件，请注明来自<a href="http://www.koomv.com/bbs"><font color=red>空谷寻梦社区</font></a>，谢谢您的支持！<br>      
<font color=red>＊</font> 欢迎广大作者给我们提供软件以及使用说明。<br>      
                </td>
              </tr>
            </table>
    	</td></tr>   
	<tr><td class=tablebody1 align="right" >
<table align=center border="0" width="100%"><tr>
<td class=tablebody1 align="left" width="3%" nowrap>
		<IMG SRC="down_images/fav_add.gif"  BORDER="0" alt="把本贴加入IE收藏夹"  style="CURSOR: hand" onClick="window.external.AddFavorite('<%=Dvbbs.Forum_info(1)%>/down_list.asp?id=<%=rs("id")%>', ' <%=DVBBS.Forum_info(0)%> - <%=rs("showname")%>')">
</td>
<td width="15%" align="right" nowrap class=tablebody1>【<a href="javascript:Showvote('<%=rs("id")%>')"><font color="#FF0000">评论投票</font></a>】</td>
<td nowrap>
<a href="down_editsoft.asp?id=<%=rs("id")%>&classid=<%=rs("classid")%>&Nclassid=<%=rs("Nclassid")%>">修改软件</a></td>
</TR>

</table>
	</td></tr>   
    </table>
    </td>                           
    </tr>
<TR><TD></TD></TR>                         
  </table>
<script language="javascript" src="down_index_js.asp"></script>
<%
down_payuser()
down_manage()
%> 




<%
sub downsoft()
dim downl,dpwd,ldown
Set rdown = Server.CreateObject("ADODB.Recordset")
sqldown="SELECT * FROM download where id="&request("id")
rdown.OPEN sqldown, Conndown,1,3
        if rdown.bof and rdown.eof then
  FoundErrs  "<FONT color=red>指定的下载ID不存在，该软件可能被删除了或者还没有添加，请确认ID后下载</font>"
ShowErrs(Dvbbs.Stats)
         else
downl=request("down")
dpwd=request("dpwd")
ldown=rdown("ldown")
if downc=0 then
point=rdown("point")
tieshu=rdown("tieshu")
elseif downc=1 then 
point=pointx
tieshu=tieshux
end if




'================定义下载地址URL========判断down地址存在=======
if downl="1" and rdown("filename")<>"" then
downfile0=split(rdown("filename"),"#")
	if cint(downfile0(1))=0 then
 URL=downfile0(0)
         elseif cint(downfile0(1))=1 then
 URL=downpath&downfile0(0)
         elseif cint(downfile0(1))=2 then
 URL=ftp&downfile0(0)
	else
URL=downfile0(0)
   end if
elseif downl="2" and rdown("filename1")<>""then
  downfile1=split(rdown("filename1"),"#")
	if cint(downfile1(1))=0 then
 URL=downfile1(0)
         elseif cint(downfile1(1))=1 then
 URL=downpath&downfile1(0)
         elseif cint(downfile1(1))=2 then
 URL=ftp&downfile1(0)
	else
URL=downfile1(0)
   end if
elseif downl="3" and rdown("filename2")<>"" then
   downfile2=split(rdown("filename2"),"#")
	if cint(downfile2(1))=0 then
 URL=downfile2(0)
         elseif cint(downfile2(1))=1 then
 URL=downpath&downfile2(0)
         elseif cint(downfile2(1))=2 then
 URL=ftp&downfile2(0)
	else
URL=downfile2(0)
   end if
elseif downl="4" and rdown("filename3")<>"" then
   downfile3=split(rdown("filename3"),"#")
	if cint(downfile3(1))=0 then
 URL=downfile3(0)
         elseif cint(downfile3(1))=1 then
 URL=downpath&downfile3(0)
         elseif cint(downfile3(1))=2 then
 URL=ftp&downfile3(0)
	else
URL=downfile3(0)
   end if
elseif downl="5" and rdown("filename4")<>"" then
   downfile4=split(rdown("filename4"),"#")
	if cint(downfile4(1))=0 then
 URL=downfile4(0)
         elseif cint(downfile4(1))=1 then
 URL=downpath&downfile4(0)
         elseif cint(downfile4(1))=2 then
 URL=ftp&downfile4(0)
	else
URL=downfile4(0)
   end if
else
FoundErrs  "<FONT color=red>指定down地址错误！ 只能控制在1-5之间并且这些down地址都存在</font>"
ShowErrs(Dvbbs.Stats)
end if
'+++++++++++++++++++++防盗连控制对应 dpwd地址+++++++++++++++++++
if dpwd<>md5(downpwd,16) then
FoundErrs  "<font color=red>防盗连密码错误！</font>请重新 <a href=login.asp>登陆</a> 下载页面即可"
ShowErrs(Dvbbs.Stats)
end if

'===+++++++++++++++判断用户权限 开始URL转向下载++++++++++++++++

' =====================开放下载=============
if (downc=0 and rdown("downshow")=1) or (downc=1 and downx=1) then
response.redirect "" & url 
else
'=========================下载需要权限===============
   set rs=server.createobject("adodb.recordset")
   sql="select * from [DV_user] where username='"&DVBBS.membername&"'"
    rs.open sql,conn,1,3
              if rs.bof and rs.eof then
      FoundErrs  "<FONT color=red>(**)会员下载，请先登陆！"
      ShowErrs(Dvbbs.Stats)
     end if

if (downc=0 and rdown("downshow")=2) or (downc=1 and downx=2) then  '=========普通会员下载=====
	if DVBBS.founduser then
       response.redirect "" & url
        else
  FoundErrs  "<FONT color=red>会员下载，请先登陆</font>"
ShowErrs(Dvbbs.Stats)
    end if
end if 
  
  set rss = server.CreateObject ("Adodb.recordset")
	sqls="select * from showpage"
	rss.open sqls,conndown,0,1          
if (downc=0 and rdown("downshow")=3) or (downc=1 and downx=3) then  '=========VIP下载控制======
 
 if rss("vipshow")=2 then
	if rs("vip")=1 or rs("vip")=5 or rs("UserGroupID")=8 or rs("UserGroupID")<3 then
       response.redirect "" & url
        else
  FoundErrs  "<FONT color=red>你不是VIP，不能下载</font>"
ShowErrs(Dvbbs.Stats)
    end if
else
  if DVBBS.founduser then
       response.redirect "" & url
        else
  FoundErrs  "<FONT color=red>(VIP)会员下载，请先登陆</font>"
ShowErrs(Dvbbs.Stats)
    end if
 end if
end if 

if (downc=0 and rdown("downshow")=6) or (downc=1 and downx=6) then  '=========金牌会员下载控制======
if rss("vipshow")=2 then
	if rs("vip")=5 or dvbbs.master then
       response.redirect "" & url
        else
  FoundErrs  "<FONT color=red>金牌会员下载,请先登陆</font>"
ShowErrs(Dvbbs.Stats)
    end if
else
  if DVBBS.founduser then
       response.redirect "" & url
        else
  FoundErrs  "<FONT color=red>会员下载，请先登陆</font>"
ShowErrs(Dvbbs.Stats)
    end if
 end if
end if


if (downc=0 and rdown("downshow")=4) or (downc=1 and downx=4) then  '=========版主以上会员下载控制======
	if rs("UserGroupID")<4 then
       response.redirect "" & url
        else
  FoundErrs  "<FONT color=red>拥有版主权限以上的会员下载,你好象不是吧！？</font>"
ShowErrs(Dvbbs.Stats)
    end if
end if

if (downc=0 and rdown("downshow")=5) or (downc=1 and downx=5) then  '=========收费下载控制======
dim sqlp
set rsp=server.createobject("adodb.recordset")
sqlp="select * from [user] where username='"&dvbbs.membername&"' "
rsp.open sqlp,conndown,1,3
if rsp.eof and rsp.bof then
FoundErrs  "<FONT color=red>你没有开通收费下载!请开通后下载收费软件</font>"
ShowErrs(Dvbbs.Stats)
elseif rsp("lockuser")=2 then
FoundErrs  "<FONT color=red>你的收费下载被锁定。请联系管理员</font>"
ShowErrs(Dvbbs.Stats)
elseif rsp("lockuser")=1 then

seenameid=split(rdown("buyuser"),",")
   seecount=ubound(seenameid)
for payj = 0 to seecount
     	if strcomp(seenameid(payj),rs("userid"))=0 then
	  foundsee=true
	  exit for
       end if
   next
if foundsee=true then
response.redirect "" & url
elseif foundsee=false then

   if rs("userWealth")>=rdown("point") then
rs("userWealth")=rs("userWealth")-rdown("point")
rs.update
rsp("allpoint")=rsp("allpoint")+rdown("point")
rsp.update
rdown("buyuser")=rdown("buyuser")&","&rs("userid")
rdown.update
dim rsjilu,sqljilu
set rsjilu=server.createobject("adodb.recordset")
	sqljilu="select * from downevent"
	rsjilu.open sqljilu,conndown,1,3	
	rsjilu.addnew
        rsjilu("userid")=""&rsp("id")&""
        rsjilu("buydown")=""&rdown("showname")&""
        rsjilu("addtime")=date()
	rsjilu("buypoint")=""&rdown("point")&""
        rsjilu.update
	rsjilu.close
set sqljilu=nothing

 response.redirect "" & url
 else
 FoundErrs  "<FONT color=red>老兄你的钱不够啊！</font>"
ShowErrs(Dvbbs.Stats)
  end if
end if
else
response.redirect "" & url
end if
 
end if



if (downc=0 and rdown("downshow")=7) or (downc=1 and downx=7) then  '=========帖子数下载！======
	if rs("UserPost")>tieshu or dvbbs.master then
       response.redirect "" & url
        else
  FoundErrs  "<FONT color=red>你的帖子数不够"&tieshu&"，请多多发贴支持社区</font>"
ShowErrs(Dvbbs.Stats)
    end if
end if


end if '================URL下载结束--------------------------------------------
end if  '========下载全部结束=========
rdown.close
set rdown=nothing
end sub

conndown.close
set conndown=nothing
Dvbbs.ActiveOnline	
Dvbbs.footer()

%>