%Response.Buffer=true
response.expires=0
myname=Session("myname")
myid=Session("myid")
if myid="" or myname="" then response.end
application.lock
call get_guests
call get_maxuser
if myname<>guests(myid,0) or Session("mytemp")<>guests(myid,1) then response.end
set rsparam=conn.execute("select * from param")
if guests(myid,4)=rsparam("superlevel") then myname="聊天室管理员"
selwho=request("selwho")
set rs=conn.execute("SELECT user_level,exp_num FROM user WHERE username='" & selwho & "'")
errText=""
if rs.eof or rs.bof then
errText="查无此人:"&selwho&"!"
else
towho_level=rs("user_level")
if guests(myid,4)已经是"&new_level&"级用户了!"
elseif new_level<1 or guests(myid,4)-new_level<2 then
errText="你不能把对方的级别修改到"&new_level&"级!"
else
forwhat=left(trdb(request("forwhat")),40)
if forwhat="" then errText="不注明升降级原因,那怎么能行呢?"
end if
else
errText="级别必须用数字表示!"
end if
end if
end if
if errText="" then
errText="你成功地修改了"&selwho&"的级别!"
conn.Execute("UPDATE user SET user_level="&new_level&" WHERE username='"&selwho&"'")
conn.Execute("INSERT INTO record (occ_env,occ_time,for_what) VALUES ('"&myname&" 把 "&selwho&" 级别从 "&towho_level&" 级修改为 "&new_level&" 级','"&now()&"','"&forwhat&"')")
for i=0 to MaxUser
if guests(i,0)=selwho then
guests(i,4)=new_level
call put_guests
exit for
end if
next
end if
application.unlock
call echoerr(errText,"online_admin.asp")%>