<!--#include file="Inc.asp"-->
<!--#include file="ydzq.asp"-->
<%call head()

Call saycarda("设置"&zonene&"版主")

dim userid,bbsid,action
bbsid=request("bbsid")
dim adminusid
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select adminusid from ydbbs where id="&bbsid,conn,1,1
if rs.eof then
  Call Error("论坛不存在！")
  end if
adminusid=rs("adminusid")
rs.close
set rs=nothing
IF adminusid=myid or keys=1 or keys=2 or keys=3 then
else
  Call Error("权限不足！")
  end if
  
userid=request("userid")
action=request("action")
if bbsid="" or IsNumeric(bbsid)=False then
  Call Error("ID无效！")
end if

if action="ok" then

if userid="" or IsNumeric(userid)=False then
  Call Error("会员ID无效！")
  end if
'检查ID是否存在
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT skey FROM users where id="&userid,conn,1,1
if rs.eof then
  rs.close
  set rs=Nothing
  Call Error("会员ID不存在！")
end if
if rs("skey") = bbsid then
  rs.close
  set rs=Nothing
  Call Error("此会员已经是本"&zonene&"版主！")
end if

if rs("skey") > 0 then
  rs.close
  set rs=Nothing
  Call Error("此会员已是其它版块的版主！")
end if
  rs.close
  set rs=Nothing

 conn.Execute"update users set skey="&bbsid&" Where ID="&userid

response.write "设置"&zonene&"版主成功！<br/>"
Response.write "<a href=""zoneadminset.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">继续添加</a><br/>"
ELSE
if saytk=>2 then
	Response.write "<form name=""form"" method=""post"" action=""zoneadminset.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"
end if
response.write "用户ID：<input name='userid' format='*N' value=''/><br/>"

if saytk=>2 Then
response.write "<input type=""hidden"" name=""action"" value=""ok""/>"
%>

<input type="submit" name="Submit" value="设为版主"></form><br/><%
else
Response.write "<anchor>设为"&zonene&"版主<go href='zoneadminset.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&"' method='post' accept-charset='utf-8'>"
Response.write "<postfield name='userid' value='$(userid)'/>"
Response.write "<postfield name='action' value='ok'/>"
Response.write "</go></anchor><br/>"
END IF
end if

response.write "==现任"&zonene&"版主==<br/>"

Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT * FROM users where skey="&bbsid,conn,1,1
if rs.eof then

Response.write "暂时没有"&zonene&"版主<br/>"
else
  rs.Move(0)

                  a=1
            do while ((not rs.EOF) and a <=10)
   response.write"<a href='/bbs/uinfo.asp?id="&rs("ID")&"&amp;sid="&sid&"&amp;saytk="&saytk&"'>"&rs("name")&"</a><br/>最后在线时间："&rs("tjj")&"<br/>"
  rs.MoveNext
                      a=a+1
                            loop
end If


  rs.close
  set rs=Nothing

Response.write "------------<br/>"
conn.close
set conn=Nothing
response.write"<a href=""zoneadmin.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&zonene&"设置</a>"
response.write"<br/><a href=""zone_vip.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">我的"&zonene&"管理</a>"
response.write"<br/><a href=""zoneall.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">返回"&zonene&"</a>"
%>
<%
call headsay()
%>