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


<%call head()
Call saycarda("设为版主")

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

if keys<>1 then
  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 id="" or IsNumeric(id)=False then
  Call Error("会员ID无效！")
  end if

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

if rs("skey") > 0 then
  rs.close
  set rs=Nothing
  Call Error("此会员已是版块的版主！")
end if
  rs.close
  set rs=Nothing
  
if TP=1 then
 conn.Execute"update users set skey="&ids&" Where ID="&id
end if

response.write "操作成功！<br/>"
ELSE
if saytk=>2 then
	Response.write "<form name=""form"" method=""post"" action=""adminboss.asp?ID="&ID&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"
end If
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/>"
if saytk=>2 then
response.write "<input type=""hidden"" name=""tp"" value=""1""/>"
%>

<input type="submit" name="Submit" value="设为版主"></form><br/><%
else
Response.write "<anchor>设为版主<go href='adminboss.asp?ID="&ID&"&amp;saytk="&saytk&"&amp;sid="&sid&"' method='post' accept-charset='utf-8'>"
Response.write "<postfield name='ids' value='$(ids)'/>"
Response.write "<postfield name='TP' value='1'/>"
Response.write "</go></anchor><br/>"
END If
End if
Response.write "------------<br/>"
conn.close
set conn=Nothing
response.write"<a href=""uinfo.asp?id="&id&"&amp;saytk="&saytk&"&amp;sid="&sid&""">用户信息</a>"
response.write"<br/><a href=""managers.asp?saytk="&saytk&"&amp;sid="&sid&""">管理团队</a>"
Call headsay()
%>