<!--#include file="../Inc.asp"-->
<!--#include file="../ydzq.asp"-->
<%call head()
Call saycarda("添加职位")

dim userid,ids,TP
ids=request("ids")
userid=request("userid")
TP=request("TP")

if keys=1 or keys=2 Then
else
  Call Error("无权管理")
  end if

if TP<>"" then
TP=clng(TP)
if TP=1 then

if ids="" or IsNumeric(ids)=False then
  Call Error("选择版块无效！")
  end if
end if

if userid="" or IsNumeric(userid)=False then
  Call Error("会员ID无效！")
  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")=5 then
    Call Error("无权管理2！")
	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("无权管理3！")
	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("无权管理4！")
	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("无权管理5！")
	End if
rsgl2.close
  set rsgl2=Nothing
  End If

  If keys=2 Then
if tp=3 then
    Call Error("无权管理6！")
	End if
  End if


'检查ID是否存在
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT name FROM users where id="&userid,conn,1,1
if rs.eof then
  rs.close
  set rs=Nothing
  Call Error("会员ID不存在！")
end if
  rs.close
  set rs=Nothing
if TP=1 then
 conn.Execute"update users set skey="&ids&" Where ID="&userid
end if

if TP=2 then
response.write "无权设定！<br/>"
end if
if TP=3 then
 conn.Execute"update users set keys=2 Where ID="&userid
end If
if TP=4 then
 conn.Execute"update users set keys=3 Where ID="&userid
end If
if TP=5 then
 conn.Execute"update users set keys=4 Where ID="&userid
end If
if TP=6 then
 conn.Execute"update users set keys=5 Where ID="&userid
end If
if TP=7 then
 conn.Execute"update users set keys=6 Where ID="&userid
end if
response.write "操作成功！<br/>"
response.write"<a href=""adminboss.asp?sid="&sid&"&amp;saytk="&saytk&""">职业设定</a><br/>"
ELSE
if saytk>1 then
Response.write "<form name=""form"" method=""post"" action=""adminboss.asp?sid="&sid&"&amp;saytk="&saytk&""">"
response.write "用户ID：<br/><input name='userid' format='*N' value=''/><br/>"
response.write "选择版块<br/>"
response.write "<select name='ids'><option>版块列表</option>"
set rs=server.createobject("ADODB.Recordset")
rs.open"select id,name from ydbbs where lx=1 order by id desc",conn,1,1
dim j
j=1
do while not rs.eof
Response.write "<option value='" & ubb(rs("id")) & "'>" & ubb(rs("name")) & "</option>"
j=j+1
rs.movenext
loop
rs.close
set rs=nothing
Response.write "</select><br/>"
response.write "<input type=""hidden"" name=""tp"" value=""1""/>"
response.write "<input type=""submit"" name=""Submit"" value=""设为版主""></form><br/>"
Response.write "<form name=""form"" method=""post"" action=""adminboss.asp?sid="&sid&"&amp;saytk="&saytk&""">"
response.write "用户ID：<input name='userid' format='*N' value=''/><br/>"

response.write "<input type=""hidden"" name=""tp"" value=""2""/>"
response.write "<input type=""submit"" name=""Submit"" value=""设为"&saybbsgl&"""></form><br/>"

Response.write "<form name=""form"" method=""post"" action=""adminboss.asp?sid="&sid&"&amp;saytk="&saytk&""">"
response.write "用户ID：<input name='userid' format='*N' value=''/><br/>"
response.write "<input type=""hidden"" name=""tp"" value=""3""/>"
response.write "<input type=""submit"" name=""Submit"" value=""设为"&saybbsgl1&"""></form><br/>"

Response.write "<form name=""form"" method=""post"" action=""adminboss.asp?sid="&sid&"&amp;saytk="&saytk&""">"
response.write "用户ID：<input name='userid' format='*N' value=''/><br/>"
response.write "<input type=""hidden"" name=""tp"" value=""4""/>"
response.write "<input type=""submit"" name=""Submit"" value=""设为"&saybbsgl2&"""></form><br/>"

Response.write "<form name=""form"" method=""post"" action=""adminboss.asp?sid="&sid&"&amp;saytk="&saytk&""">"
response.write "用户ID：<input name='userid' format='*N' value=''/><br/>"
response.write "<input type=""hidden"" name=""tp"" value=""6""/>"
response.write "<input type=""submit"" name=""Submit"" value=""设为"&saybbsgl4&"""></form><br/>"

Response.write "<form name=""form"" method=""post"" action=""adminboss.asp?sid="&sid&"&amp;saytk="&saytk&""">"
response.write "用户ID：<input name='userid' format='*N' value=''/><br/>"
response.write "<input type=""hidden"" name=""tp"" value=""7""/>"
response.write "<input type=""submit"" name=""Submit"" value=""设为"&saybbsgl5&"""></form><br/>"

else
response.write "用户ID：<br/><input name='userid' format='*N' value=''/><br/>"
response.write "选择版块<br/>"
response.write "<select name='ids'><option>版块列表</option>"
set rs=server.createobject("ADODB.Recordset")
rs.open"select id,name from ydbbs where lx=1 order by id desc",conn,1,1
j=1
do while not rs.eof
Response.write "<option value='" & ubb(rs("id")) & "'>" & ubb(rs("name")) & "</option>"
j=j+1
rs.movenext
loop
rs.close
set rs=nothing
Response.write "</select><br/>"

Response.write "<anchor>设为版主<go href='adminboss.asp?sid="&sid&"&amp;saytk="&saytk&"' method='post' accept-charset='utf-8'>"
Response.write "<postfield name='ids' value='$(ids)'/>"
Response.write "<postfield name='userid' value='$(userid)'/>"
Response.write "<postfield name='TP' value='1'/>"
Response.write "</go></anchor><br/>"

Response.write "<anchor>设为"&saybbsgl&"<go href='adminboss.asp?sid="&sid&"&amp;saytk="&saytk&"' method='post' accept-charset='utf-8'>"
Response.write "<postfield name='userid' value='$(userid)'/>"
Response.write "<postfield name='TP' value='2'/>"
Response.write "</go></anchor><br/>"

Response.write "<anchor>设为"&saybbsgl1&"<go href='adminboss.asp?sid="&sid&"&amp;saytk="&saytk&"' method='post' accept-charset='utf-8'>"
Response.write "<postfield name='userid' value='$(userid)'/>"
Response.write "<postfield name='TP' value='3'/>"
Response.write "</go></anchor><br/>"

Response.write "<anchor>设为"&saybbsgl2&"<go href='adminboss.asp?sid="&sid&"&amp;saytk="&saytk&"' method='post' accept-charset='utf-8'>"
Response.write "<postfield name='userid' value='$(userid)'/>"
Response.write "<postfield name='TP' value='4'/>"
Response.write "</go></anchor><br/>"


Response.write "<anchor>设为"&saybbsgl4&"<go href='adminboss.asp?sid="&sid&"&amp;saytk="&saytk&"' method='post' accept-charset='utf-8'>"
Response.write "<postfield name='userid' value='$(userid)'/>"
Response.write "<postfield name='TP' value='6'/>"
Response.write "</go></anchor><br/>"

Response.write "<anchor>设为"&saybbsgl5&"<go href='adminboss.asp?sid="&sid&"&amp;saytk="&saytk&"' method='post' accept-charset='utf-8'>"
Response.write "<postfield name='userid' value='$(userid)'/>"
Response.write "<postfield name='TP' value='7'/>"
Response.write "</go></anchor><br/>"
END IF
end if

conn.close
set conn=Nothing
response.write"-------------<br/><a href=""/bbs/adminbbs/adminbbsboss.asp?saytk="&saytk&"&amp;sid="&sid&""">管理撤职</a>"&chr(13)
%>
<!--#include file="../fanhui.asp"-->
<%
call headsay()%>