<!--#include file="../Inc.asp"-->
<!--#include file="../ydzq.asp"-->
<%

call head()
  Call saycarda("撤销职务")


dim TP,ids,Action,tid,bbsid,tzname,id
Action=Request.QueryString("Action")

ids=usb(request("ids"))
TP=usb(request("TP"))
mmm=usb(request("mmm"))



IF  Action="key" Then
	call keydel
elseif Action="log" Then

	call logdel
else
	call sellacok
end if
'=====================================================

if keys=1 or keys=2 Then
else
Call Error("无权管理！")
End if
if TP<>"" then
if ids=myid Then

  Call Error("你不能撤除自己！")
  end if

if ids="" or Isnumeric(ids)=False Then

  Call Error("ID无效！")
  end if

'检查ID是否存在
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT id FROM users where id="&ids,conn,1,1
if rs.eof then
  rs.close
  set rs=Nothing

  Call Error("ID不存在！")

end if
  rs.close
  set rs=Nothing
  If keys=3 Then
Set rsgl2= Server.CreateObject("ADODB.Recordset")
rsgl2.Open "SELECT * FROM users where id="&ids,conn,1,1
if rsgl2("keys")=5 then
    Call Error("无权管理1！")
	End if
rsgl2.close
  set rsgl2=Nothing
  End If
   If keys=5 Then
Set rsgl2= Server.CreateObject("ADODB.Recordset")
rsgl2.Open "SELECT * FROM users where id="&ids,conn,1,1
if rsgl2("keys")=5 then
    Call Error("无权管理2！")
	End if
rsgl2.close
  set rsgl2=Nothing
  End If

If keys=6 Then
Set rsgl2= Server.CreateObject("ADODB.Recordset")
rsgl2.Open "SELECT * FROM users where id="&ids,conn,1,1
if rsgl2("keys")=6 then
    Call Error("无权管理3！")
	End if
rsgl2.close
  set rsgl2=Nothing
  End If
  
If keys=3 Then
Set rsgl2= Server.CreateObject("ADODB.Recordset")
rsgl2.Open "SELECT * FROM users where id="&ids,conn,1,1
if rsgl2("keys")=6 then
    Call Error("无权管理4！")
	End if
rsgl2.close
  set rsgl2=Nothing
  End If

If keys=2 Then
Set rsgl2= Server.CreateObject("ADODB.Recordset")
rsgl2.Open "SELECT * FROM users where id="&ids,conn,1,1
if rsgl2("keys")=2 then
    Call Error("无权管理5！")
	End if
rsgl2.close
  set rsgl2=Nothing
  End If
  

Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT * FROM users where id="&myid,conn,1,1
if rs("mm")<>mmm then

  Call Error(" 密码不正确")

end if
  rs.close
  set rs=Nothing




Set rsgl1= Server.CreateObject("ADODB.Recordset")
rsgl1.Open "SELECT * FROM users where id="&ids,conn,1,1
if rsgl1("keys")=1 then
    Call Error("无权管理6！")
	else
  conn.Execute("update users set keys=0,skey=0 where id=" & ids)
End if
rsgl1.close
  set rsgl1=Nothing


 Response.Write "撤销成功"
Response.write "<br/><a href=""adminbbsboss.asp?saytk="&saytk&"&amp;sid="&sid&""">[职位管理]</a><br/>"
Response.write "<a href=""../show.asp?saytk="&saytk&"&amp;sid="&sid&""">[我的小屋]</a><br/>"

Else
If saytk>1 Then
Response.write "<form name=""form"" method=""post"" action=""adminget.asp?Action=key&amp;ids="&ids&"&amp;saytk="&saytk&"&amp;sid="&sid&"&amp;TP=1"">"
End if
 Response.Write "确认撤销该会员的职务？<br/>"
response.write "验证密码：<br/><input name='mmm' format='*N' value=''/><br/>"
If saytk>1 Then
response.write "<input type=""submit"" name=""Submit"" value=""确定""></form><br/>"


Else

Response.write "<anchor>是的<go href='adminget.asp?Action=key&amp;ids="&ids&"&amp;saytk="&saytk&"&amp;sid="&sid&"&amp;TP=1' method='post' accept-charset='utf-8'>"
Response.write "<postfield name='mmm' value='$(mmm)'/>"
Response.write "</go></anchor><br/>"
 Response.Write "<anchor>取消<prev/></anchor>"

End if

end If

Call headsay()

%>
