<!--#include file="system_manage.asp"-->
<!--#include file="../include/md5.asp"-->
<%
Dim postid,title

   Call DBConnBegin()
	  Set rs = server.createobject("adodb.recordset")
Select Case Request("action")
Case "del"
id=tx_common.checkstr(request.querystring("id"),1)
sql="delete from tx_ADMIN where id="&id
tx_common.execute sql
 Call tx_common.message("·管理员删除成功<br>·如果你的浏览器不支持跳转，<a href='admin_adminuser.asp'>点击这里返回</a><meta http-equiv=refresh content='3;URL=admin_adminuser.asp'>",1)
  Case "addsave"
  postid=request("id")
tx_adminuser=request.Form("adminuser")
tx_adminpass=md5(2,request.Form("adminpass"))
      'Save
	  If postid<>"" Then 
	   rs.open "select tx_adminuser,tx_adminpass,tx_ifmaster from tx_admin where id="&postid,conn,1,3
	 else
	 rs.open "select tx_adminuser,tx_adminpass,tx_ifmaster from tx_admin",conn,1,3
	  rs.AddNew
	  End If 
   rs(0) = tx_adminuser
   rs(1) = tx_adminpass
   rs(2) = 1
	  rs.update
	  rs.close
	  Call tx_common.message("·管理员添加/修改成功<br>·如果你的浏览器不支持跳转，<a href='admin_adminuser.asp'>点击这里返回</a><meta http-equiv=refresh content='3;URL=admin_adminuser.asp'>",1)
Case "add"
content=tx_tables.formtop("?action=addsave","添加管理员")
content= content & tx_tables.inputs("用户名","adminuser","text","")
content= content & tx_tables.inputs("密码","adminpass","text","")
content =content & tx_tables.formfoot
Case "edit"
	 rs.open "select * from tx_admin where id="&tx_common.checkstr(request.querystring("id"),1),conn,1,3
content=tx_tables.formtop("?action=addsave&id="&rs("id"),"添加管理员")
content= content & tx_tables.inputs("用户名","adminuser","text",rs("tx_adminuser"))
content= content & tx_tables.inputs("用户名","adminpass","text",rs("tx_adminpass"))
content =content & tx_tables.formfoot
  Case Else

content =  "<table width='100%' cellpadding=3 cellspacing=1 class=td1>"
content = content & "<tr class=td4><td colspan=3><strong>管理员列表</strong></td></tr>"
content =content & "<tr class=td2><td nowap>ID</td><td width='60%'>用户名</td><td width='10%'>操作</td></tr>"
Set rso=conn.execute("select * from tx_admin order by id desc")
If Not rso.bof And Not rso.eof Then
Do While Not rso.bof And Not rso.eof 
content =content & "<tr class=td2><td>"&rso("id")&"</td><td>"&rso("tx_adminuser")&"</td><td><a href=?action=edit&id="&rso("id")&">编辑</a> | <a href=?action=del&id="&rso("id")&">删除</a></td></tr>"
rso.movenext
Loop
Else 
content = content & "<tr class=td2><td colspan=3>暂时没有任何信息，请添加！</td></tr>"
End If 
content = content & tx_tables.tablesfoot
rso.close 
End Select
Call ClassEnd()
Call DBConnEnd()
response.write content
Call GetBottom()
%>
