<!--#include file="down_conn.asp"-->
<!-- #include file="inc/const.asp" -->
<html>
<head>
<title>--管理页面</title>


<meta NAME=GENERATOR Content="Microsoft FrontPage 4.0" CHARSET=GB2312>
</head>
<script language=javascript>

function check()

{
  if(document.form1.username.value=="")
    {
      alert("用户名为空");
      return false;
    }
  
 }
 

</script>

<BODY leftmargin="0" bottommargin="0" rightmargin="0" topmargin="0" marginheight="0" marginwidth="0">
<%

Dvbbs.LoadTemplates("")
Dvbbs.Head()
	dim admin_flag,str,rss,sqls,sql1,rs1,usertitle,rs2,sql2,rs3,sql3,mess,money,userep,usercp
dim userpower,userart
	admin_flag="22"
	if not Dvbbs.master then
		response.write "<BR><li>本页面为管理员专用，请<a href=admin_login.asp target=_top>登陆</a>后进入。<br><li>您没有管理本页面的权限。"
		response.end
	else
		if Request("action") = "savemod" then
		call savemod()
		elseif Request("action") = "saveconfig" then
		call saveconfig()
		elseif Request("action") = "alladd" then
		call alladd()
		else
		call payinfo()
		end if
		conndown.close
		set conndown=nothing
	end if
sub payinfo()
set rss = server.CreateObject ("Adodb.recordset")
	sqls="select * from showpage"
	rss.open sqls,conndown,0,1
%>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder2">
<form action=?action=savemod method=post>
<tr><th valign=middle height=23 align=left width="100%">付费用户申请系统模式设定</th></tr>
<tr><td valign=middle class=forumrow align=left width="75%">
说明：付费用户申请系统有两模式<br>
<font color="#FF0000">自动添加系统</font>：用户在前台可以看到申请条件，如果满足条件即可申请，申请后直接加为“付费用户”<br>
<font color="#FF0000">人工添加系统</font>：用户在前台可以看到申请条件，如果满足条件可以递交申请，申请会提交给管理员审批，如果批准则加为付费用户</td> 
</tr><tr>
<td valign=middle class=forumrow align=left width="75%">
<p align="center">自动添加付费用户<input type=radio name="paymod" value="1" <%if rss("paymod")=1 then%>checked<%end if%>>　　　　人工添加付费用户<input type=radio name="paymod" value="2" <%if rss("paymod")=2 then%>checked<%end if%>>　　　<input type=submit name="submit" value="提 交"></td></tr>
</form>
</table>
<br>

<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder2">
<tr><th align=center colspan=2  width="717" height=1>
    <p align="left">付费用户申请<b>条件管理</b></p>
  </th>                                                                                 
</tr>
<%sql1="select * from [payconfig]"                                                                                 
set rs1=conndown.execute(sql1) %>                                                                                 
<form name="form" method="post" action="?action=saveconfig">                                                                                       
<tr>                                                                                       
<td align=right width="40%" height="25" class=forumrow>申请付费用户所需金额：</td>                                                                                       
<td align=left  height="25" class=forumrow><INPUT name=userwealth size="20" value="<%=rs1("wealth")%>"></td>                                                                                       
</tr>                                                                                 
<tr>                                                                                       
<td align=right width="40%" height="25" class=forumrow>申请付费用户所需经验：</td>                                                                                       
<td align=left  height="25" class=forumrow><INPUT name=userep size="20" value="<%=rs1("userep")%>"></td>                                                                                       
</tr>                                                                                  
<tr>                                                                                       
<td align=right width="40%" height="25" class=forumrow>申请付费用户所需魅力：</td>                                                                                       
<td align=left height="25" class=forumrow><INPUT name=usercp size="20" value="<%=rs1("usercp")%>"></td>                                                                                       
</tr>                                                                                  
<tr>                                                                                       
<td align=right width="40%" height="25" class=forumrow>申请付费用户所需威望：</td>                                                                                       
<td align=left  height="25" class=forumrow><INPUT name=userpower size="20" value="<%=rs1("power")%>"></td>                                                                                       
</tr>                                                                                        
<tr>                                                                                       
<td align=right width="40%" height="25" class=forumrow>申请付费用户所需文章数：</td>                                                                                       
<td align=left height="25" class=forumrow><INPUT name=userart size="20" value="<%=rs1("article")%>"></td>                                                                                       
</tr>                                                                                       
<tr>                                                                                       
<td align=center colspan=2 width="95%" height="27" class=forumrow><INPUT type=submit value=修改 name=submit></td>                                                                                       
</tr>                                                                                       
</form>                                                                                 
</table>
<br>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder2">
<tr><th valign=middle colspan=2 height=23 align=left width="100%">付费用户管理</th></tr>
<tr><td valign=middle class=forumrow align=left width="25%"> </td>
<td valign=middle class=forumrow align=left width="75%"></td></tr> 
<tr><td valign=middle class=forumrow align=left width="25%"> </td>
<td valign=middle class=forumrow align=left width="75%">
<a href=admin_down_payuser.asp><font color=red>进 入 管 理</font></a>        
</td></tr> 
</table>  
<br>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder2">
<tr><th valign=middle colspan=2 height=23 align=left width="100%">审批申请用户</th></tr>
<tr><td valign=middle class=forumrow align=left width="25%"> </td>
<td valign=middle class=forumrow align=left width="75%"></td></tr> 
<tr><td valign=middle class=forumrow align=left width="25%"> </td>
<td valign=middle class=forumrow align=left width="75%">
<a href=admin_down_payapplyuser.asp><font color=red>审批申请用户</font></a>            
</td></tr> 
</table>     
    <br><form method="post" action="admin_down_addpayuser.asp?menu=2" name="form1"  onsubmit="javascript:return check();">
    <table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder2">
	
	<tr>
	<th width="95%" colspan="2">
      <p align="left">增加新付费用户</p>
	</th>
	</tr>
	<tr>
	<td class=forumrow width="95%" colspan="2">注意事项： 请仔细填写下面的相关信息！
	</td>
	</tr>
	<tr>
	<td class=forumrow width="30%">用户名：</td>
	<td class=forumrow width="70%"><input maxLength=20 name=username size=20>&nbsp;&nbsp;  
      <input type="submit" name="Submit" value="确定"></td></tr></table></form>
	
<form method="post" action="?action=alladd" name="form3">
<table align="center" class="tableBorder2">
  <tr>
	<td class=forumrow width="30%">批量添加：<br>
      （将用户组的用户加为付费用户）</td>
	<td class=forumrow width="70%"><%
sql="select * from [Dv_UserGroups] order by UserGroupid desc"
set rs=conn.execute(sql)%>
<select name=usertitle size=1>
<%
do while not rs.eof
response.write "<option value="&rs("usertitle")&""
response.write ">"&rs("usertitle")&"</option>"
rs.movenext
loop
set rs=nothing
%>
</select>&nbsp;&nbsp;  
      <input type="submit" name="Submit" value="添加"></td>
  </tr></table>
</form>	

<br>
<%end sub
sub savemod()
if request("paymod")=""  then
response.write "输入的数据不能为空！"
else
set rs = server.CreateObject ("Adodb.recordset")
sql="select * from showpage"
rs.open sql,conndown,1,3
rs("paymod")=request("paymod")
rs.update
response.write"修改成功！"
end if
end sub

sub saveconfig()                                                                          
if not isnumeric(request.form("userwealth")) or not isnumeric(request.form("userart")) or not isnumeric(request.form("userep")) or not isnumeric(request.form("usercp")) or not isnumeric(request.form("userpower")) then                                                                                         
	response.write"输入的数据必须为整数！"     
	response.end                                                                
else                                                                                        
	if request.form("userwealth")="" then                                                                                        
	money=0                                                                                        
	else                                                                                             
	money=int(request.form("userwealth"))                                                                                        
	end if                                                                                        
	if request.form("userep")="" then                                                                                        
	userep=0                                                                                        
	else                                                                                        
	userep=int(request.form("userep"))                                                                                        
	end if                                                                                        
	if request.form("usercp")="" then                                                                                        
	usercp=0                                                                                        
	else                                                                                        
	usercp=int(request.form("usercp"))                                                                                        
	end if                                                                                        
	if request.form("userpower")="" then                                                                                        
	userpower=0                                                                                        
	else                                                                                        
	userpower=int(request.form("userpower"))                                                                                            
	end if                                                                               
	if request.form("userart")="" then                                                                                        
	userart=0                                                                                        
	else                                                                                        
	userart=int(request.form("userart"))                                                                                              
	end if                                                                                  
end if                                                                         
	set rs= server.createobject ("adodb.recordset")                                                                         
	sql = "select * from [payconfig]"                                                                         
	rs.Open sql,conndown,1,3                                                                         
	if not(rs.eof and rs.bof) then                                                                                      
	rs("article") = userart                                                                                    
	rs("power") = userpower                                                                                    
	rs("wealth") = money                                                                                    
	rs("userep") = userep                                                                                    
	rs("usercp") = usercp                                                                                    
	rs.Update                                                                            
	end if                                                              
rs.close                                                                          
set rs=nothing                                                                     
response.write "修改成功!"                                                                           
end sub       

sub alladd()
usertitle=request("usertitle")
Set rs1 = Server.CreateObject("ADODB.Recordset")
sql1="select * from [user]"
rs1.open sql1,conndown,1,3
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from [DV_user] where userclass='"&usertitle&"'"
rs.open sql,conn,0,1

if not(rs.eof and rs.bof) then
do while not rs.eof
set rss=conndown.execute("select * from [user] where username='"&rs("username")&"'")
if rss.eof and rss.bof then
rs1.addnew
rs1("username")=rs("username")
rs1("regtime")=date()
rs1("allpoint")=0
rs1("lockuser")=1
rs1("apply")=1
rs1.update
set rs2=server.createobject("adodb.recordset")      
sql2="select * from [dv_message]"      
rs2.open sql2,conn,1,3      
rs2.addnew      
rs2("sender")="论坛下载中心"      
rs2("incept")=rs("username")     
rs2("title")="您的付费下载用户账号已经开通！"      
rs2("content")="您的付费下载用户账号已经开通！请妥善保管您的密码！"      
rs2("flag")=0      
rs2("issend")=1      
rs2.update      
rs2.close
end if
rs.movenext
loop
end if
set rs3=server.createobject("adodb.recordset")
sql3="select * from events"
rs3.open sql3,conndown,1,3
mess=""&dvbbs.MemberName&"将所有“"&usertitle&"”加为付费用户"	
rs3.addnew
rs3("event")=mess
rs3("addtime")=date()
rs3.update
rs3.close
response.write("添加成功！")
end sub                                                                                 
%>                      

