<!--#include file=down_conn.asp-->
<!-- #include file="inc/const.asp" -->

<head>
<title>-管理页面</title>

<meta NAME=GENERATOR Content="Microsoft FrontPage 4.0" CHARSET=GB2312>
<base target="footer">
</head>
<%

Dvbbs.LoadTemplates("")
Dvbbs.Head()
	dim admin_flag,user,right_class
	admin_flag="22"
	if not Dvbbs.master or instr(session("flag"),admin_flag)=0 then
		response.write "<BR><li>本页面为管理员专用，请<a href=admin_index.asp target=_top>登陆</a>后进入。<br><li>您没有管理本页面的权限。"
		response.end
	else%>
<BODY leftmargin="0" bottommargin="0" rightmargin="0" topmargin="0" marginheight="0" marginwidth="0">
<%
   user=LCase(Request("username"))
   right_class=CInt(Request("right_class"))
	
	Set rs=Server.CreateObject("Adodb.RecordSet")
   
   rs.Open "Select * from [DV_user] where username='"&user&"'",conn,0,1

   if  rs.EOF and rs.bof then
   Response.Write "<font color=red><div align=center><br><br>此用户不是论坛用户</div></font>"
   rs.Close
   Set rs=Nothing
   Response.End 
   end if
	
   Set rs=Server.CreateObject("Adodb.RecordSet")
   
   rs.Open "Select * from Admin where username='"&user&"'",conndown

   if not rs.EOF then

   Response.Write "<font color=red><div align=center><br><br>该用户名已经存在</div></font>"
   rs.Close
   Set rs=Nothing

   conndown.Close
   Set conndown=Nothing

   Response.End   

   end if
   
   sql="insert into Admin(username,Flag,addtime) values('"&user&"',"&right_class&",date())"
   conndown.Execute sql
   
   rs.Close
   set rs=Nothing
   
   conndown.Close
   set conndown=Nothing

   Response.Redirect "admin_down_adminuser.asp"
   end if
%>