<%
dim rsdown,sqldown,flagdown,payflag,rsp,downpath,ftp,rss,daytop,weektop,alltop,listnum,editnum,eventnum,hotnum,newnum,gudinnum,vipshow,sonum,paymod,retime,showset,upmod,sqlu,rsu,foundsee,dt,last,sqlvip
dim userid,sqlb,rsb,seenameid,seecount,payj,topcount,downc,downx,pointx,tieshux,UpPicMod,UpFileMod
dim downfile0,downfile1,downfile2,downfile3,downfile4,addflag
sqldown="select flag from [admin] where username='"&Dvbbs.membername&"'"
set rsdown=conndown.execute(sqldown)
if not(rsdown.eof and rsdown.bof) then
flagdown=rsdown("flag")
else
flagdown=0
end if
set rsp=conndown.execute("select downpath from [notdown]")
downpath=rsp("downpath")
if right(downpath,1)<>"/" then
 downpath=downpath&"/"
end if
rsp.close
set rsp=nothing

set rsp=conndown.execute("select ftp from [ftpdown]")
ftp=rsp("ftp")
if right(ftp,1)<>"/" then
 ftp=ftp&"/"
end if
rsp.close
set rsp=nothing

set rss=conndown.execute("select * from [showpage]")
daytop=rss("daytop")
weektop=rss("weektop")
alltop=rss("alltop")
listnum=rss("listnum")
editnum=rss("editnum")
eventnum=rss("eventnum")
hotnum=rss("hotnum")
newnum=rss("newnum")
gudinnum=rss("gudinnum")
vipshow=rss("vipshow")
sonum=rss("sonum")
paymod=rss("paymod")
retime=rss("retime")
downc=rss("downc")
downx=rss("downx")
pointx=rss("pointx")
tieshux=rss("tieshux")
UpPicMod=rss("UpPicMod")
UpFileMod=rss("UpFileMod")
if rss("Upload")<10 then
	addflag=0
else
	addflag=1
end if
showset=split(rss("showset"),",")
rss.close

function downshow(sx)
if (downc=0 and (sx="" or sx=1 or sx=0)) or (downc=1 and downx=1)then
response.write "<font color=red>开放下载</font>"
elseif (downc=0 and sx=2) or (downc=1 and downx=2) then
response.write "<font color=red>会员下载</font>"
elseif (downc=0 and sx=3) or (downc=1 and downx=3) then
if vipshow=2 then
response.write "<font color=red>VIP下载</font>" 
else response.write "<font color=red>会员下载</font>" 
end if
elseif (downc=0 and sx=4) or (downc=1 and downx=4) then
response.write "<font color=red>特约下载</font>"
elseif (downc=0 and sx=5) or (downc=1 and downx=5) then
  if downc=0 and sx=5 then
response.write "<font color=red>付费下载</font>  <B><font color=blue>"&rs("point")&"</b></font>点" 
else
response.write "<font color=red>付费下载</font>  <B><font color=blue>"&pointx&"</b></font>点"
  end if
elseif (downc=0 and sx=6) or (downc=1 and downx=6) then
if vipshow=2 then
response.write "<font color=red>金牌下载</font>"
else response.write "<font color=red>会员下载</font>" 
end if
elseif (downc=0 and sx=7) or (downc=1 and downx=7) then
 if downc=0 and sx=7 then
response.write "<font color=red>贴数下载</font>  <B><font color=blue>"&rs("tieshu")&"</font></B>贴"
  else
response.write "<font color=red>贴数下载</font>  <B><font color=blue>"&tieshux&"</font></B>贴"
  end if
end if
end function

function soft(sx)
if sx=0 then
response.write "<font color=red>普通软件</font>"
elseif sx=1 then
response.write "<font color=red>RealPlay播放</font>"
elseif sx=2 then
response.write "<font color=red>MediaPlay播放</font>"
elseif sx=3 then
response.write "<font color=red>FLASH动画</font>"
end if
end function

function downtime(addt,downt)
if downt=0 then
downtime="无限期下载"
else
dt=downt-(date()-addt)
	if date()-addt<=downt then
	downtime="有效期为"&downt&"天；还剩 "&dt&" 天"
	else
	downtime="有效期为"&downt&"天；已过期"
	end if
end if
end function

function daydownload(dh,dd)
'dh当日下载次数
'dd限制日下载次数
if dd<>"" and dd<>0 then
	last=dd-dh
	if dh=<dd then
	 daydownload="日下载限制为"&dd&"次；还有<font color=blue>"&last&"</font>次"
	else
	daydownload="日下载限制为"&dd&"次；已截止"
	end if
else
daydownload="每日下载次数无限制"
end if
end function 

function classnum(expression)
dim rs_class,sql_class
rs_class=conn.execute("select userclass from DV_usertitle where usertitle='"&expression&"'")
classnum=rs_class("userclass")
end function

sub down_manage()
if addflag=1 or dvbbs.master or flagdown=1 or flagdown=2 then
%>

<table class="tableborder1" cellspacing=1 width="<%= Dvbbs.mainsetting(0) %>" align=center>
<tr><td class=tablebody1 align=center height=25>
<b><%=Dvbbs.membername%></b> 您可以进行的管理项目包括：◇<a href="down_addsoft.asp">添加软件</a>&nbsp;&nbsp;&nbsp;
<%if dvbbs.master then%>  
◇<a href="down_adminedit.asp">修改删除软件</a>  &nbsp;&nbsp;&nbsp;                               
◇<a href="admin_down_index.asp">人员管理，栏目管理请进后台</a>
<%elseif flagdown=1 or flagdown=2 then%> 
◇<a href="down_adminedit.asp">修改删除软件</a>  &nbsp;&nbsp;&nbsp; 
<%end if%>                            
</td></tr>
</table>
<%
end if
end sub

'-------------------付费用户--------------------
sub down_payuser()
dim rsp,sqlp
sqlp="select * from [user] where username='"&Dvbbs.membername&"' "
set rsp=conndown.execute(sqlp)
if not(rsp.eof and rsp.bof) then
	if rsp("apply")=2 then	
%>
<table class="tableborder1" cellspacing=1 width="<%= Dvbbs.mainsetting(0) %>" align=center>
        <tr>
          <th valign=middle height=25 width="100%">付费用户控制面版</th>
        </tr>
<tr>
<td class=tablebody1 align=center height=30>您已经递交过申请了，您的申请暂未审批，请等待！</td>
</table>
<%elseif rsp("apply")=1 then%>
<table class="tableborder1" cellspacing=1 width="97%" align=center>
        <tr>
          <th valign=middle height=25 width="100%">付费用户控制面版</th>
        </tr>
<%if session("payuser")<>Dvbbs.membername then%>
<tr>
<td class=tablebody1 align=left height=30>
<form action=down_paylogin.asp?action=chk method=post>
<p align="center">
<b><%=Dvbbs.membername%></b> 请输入您的密码进入付费用户控制面版：　<input maxLength=20 name=password size=12 type=password>&nbsp;&nbsp;<input type=submit name=submit value="进 入"></p>
</td>
</form></tr>
<%elseif session("payuser")=Dvbbs.membername then%>
<tr>
<td class=tablebody1 align=center height=30>
<b><%=Dvbbs.membername%></b> &nbsp;&nbsp;                                 
[<a href=down_paycontrol.asp>查看详细信息</a>]&nbsp;&nbsp;&nbsp;[<a href=down_paylogout.asp>退出</a>]
</td></tr>
<%end if%>
</table>
<%
end if
elseif Dvbbs.membername<>"" then
%>
<table class="tableborder1" cellspacing=1 width="<%= Dvbbs.mainsetting(0) %>" align=center>
        <tr>
          <th valign=middle height=25 width="100%">付费用户申请</th>
        </tr>
<tr>
<td class=tablebody1 align=center height=30><a href=down_applypayuser.asp><font color=red>[申请成为付费用户]</font></a></td></tr>
</table>
<%
end if
end sub
%>



