%Response.Buffer=true
response.expires=0
application.lock
myname=Session("myname")
myid=Session("myid")
if myid="" or myname="" then response.end
application.lock
call get_guests
if myname<>guests(myid,0) or Session("mytemp")<>guests(myid,1) then response.end
my_level=guests(myid,4)
if my_level<(-1*guests(myid,9)) then my_level=-1*guests(myid,9)
call get_votes
if (votes(0)<>0 and votes(1)=myname) then my_level=1
set rsparam=conn.execute("select * from param")
set rs=conn.execute("select count(*) as roomnum from room")
if guests(myid,4)=rsparam("superlevel") then myname="聊天室管理员"
if my_level-rsparam("laddroom")<0 then
call echoerr("你没有权力建立新的房间!","room.asp")
response.end
elseif rs("roomnum")>=rsparam("maxroom") then
call echoerr("管理员允许最大建房数为"&rsparam("maxroom")&"栋,已经不能再建房了!","room.asp")
response.end
end if
set rs1=conn.execute("select ID from room where room_owner='"&myname&"'")
if not (rs1.eof or rs1.bof) and my_level-rsparam("ldelroom")<0 then
call echoerr("你已经有自己的房间了!","room.asp")
response.end
end if
if request("cmdYes")="确认" then
errText=""
sRoom=left(trim(request("sRoom")),10)
if sRoom<>trim(trstr(server.HTMLEncode(sRoom))) then errText=errText&"房间名字里有非法字符。
"
set rs1=conn.execute("select ID from room where room_name='"&sRoom&"'")
if not (rs1.eof or rs1.bof) then errText="已经有了同名字的房间了!"
if errText="" then
room_name=sRoom
room_des=left(server.HTMLEncode(trdb(trim(request("room_des")))),250)
room_title=left(server.HTMLEncode(trdb(trim(request("sayabout")))),50)
room_auto=left(server.HTMLEncode(trdb(trim(request("room_auto")))),10)
if my_level-rsparam("ldelroom")>=0 then
room_owner=request("room_owner")
room_keep=true
else
room_owner=myname
room_keep=false
end if
if room_owner="" or room_name="" or room_auto="" or room_des="" or room_title="" then
call echoerr("聊天室名、机器人、标题和描述都不能为空!","newroom.asp")
response.end
end if
conn.execute("insert into room (room_ref,room_name,room_owner,room_auto,room_des,room_title,room_keep,room_html,room_time,room_exp,build_time) values ('"&room_title&"','"&room_name&"','"&room_owner&"','"&room_auto&"','"&room_des&"','你的传说,我的传说,在网路上隐隐约约地传说!("&room_owner&","&time()&")',"&room_keep&",true,'"&now()&"',0,'"&now()&"')")
set rs=conn.execute("select ID from room where room_name='"&room_name&"'")
call get_says
guests(myid,11)=now()
say_id=says(current,0)
current=current+1
if current>MaxTalk then current=0
say_id=say_id+1
says(current,0)=say_id
says(current,1)=myname
says(current,2)="大家"
says(current,3)=false
says(current,4)=rs("ID")
says(current,5)="'【建房】##建立的“%%”欢迎大家的光临!','"&myname&"','"&sRoom&"',0,'0088ff','green',-3,'"&time()&"',"
current=current+1
if current>MaxTalk then current=0
say_id=say_id+1
says(current,0)=say_id
says(current,1)=myname
says(current,2)="大家"
says(current,3)=false
says(current,4)=guests(myid,5)
says(current,5)="'【建房】##搭起一座房子,在门上写着“%%,欢迎光临”。然后开门进去了!','"&myname&"','"&sRoom&"',0,'336699','green',-3,'"&time()&"',"
guests(myid,5)=rs("ID")
call put_guests
call put_says%>
<%response.end
end if
call echoerr("操作失败:"&errText,"room.asp")
else%>
| 建新房间 |