<%
Option Explicit
const admin="admin"
const admpass="admin"
dim roomname,kicklist,onliuser,chatdata,userdup,userid,noplace,username,i,chatpoin,password,admlevel
username=trim(request.form("username"))
password=request.form("password")
roomname=application("roomname")
kicklist=application("kicklist")
onliuser=application("onliuser")
chatdata=application("chatdata")
if username="系统" or username="所有人" or username="" then response.redirect "error.asp?mess=使用了非法的字符为名字或使用了系统保留的名名,请换一个再进"
if username=admin and password=admpass then
admlevel=90
session("admlevel")=9
username="*"&username
else
admlevel=0
session("admlevel")=""
if instr(kicklist,"'#"&username&"'")>0 then response.redirect "kickout.htm"
if instr(kicklist,"'"&Request.ServerVariables("remote_addr")&"'")>0 then response.redirect "kickout.htm"
end if
userdup=false
for i=0 to 50
if chatdata(i,0)=username then
if chatdata(i,1)<>request.servervariables("remote_addr") then
response.redirect "error.asp?mess=相同的聊天昵称已存在,请你用另一个昵称进入"
else
userdup=true
userid=i
chatdata(i,4)=admlevel
exit for
end if
end if
next
if not userdup then
for i=0 to 50
if chatdata(i,0)="" then
userid=i
chatdata(i,0)=username '存用户名
chatdata(i,1)=request.servervariables("remote_addr") '存IP地址
chatdata(i,3)="" '置耳语为空
chatdata(i,4)=admlevel '置请勿打挠开关、MIDI开关
chatdata(i,5)="" '置隐藏名单为空
noplace=false
session("userid")=i
exit for
end if
next
if not noplace then
onliuser=onliuser&",'"&username&"'" '将用户加进名单列表
for i=0 to 50
chatdata(i,4)=(chatdata(i,4) mod 4)+4 '通知其它用户刷新名单
next
else
response.redirect "error.asp?mess=聊天室已经满员!"
end if
else
if instr(onliuser,",'"&username&"'")<1 then onliuser=onliuser&",'"&username&"'"
end if
chatpoin=application("chatpoin") '保留5条历史记录
if chatdata(userid,2)>4 then
chatdata(userid,2)=chatpoin-5
else
chatdata(userid,2)=chatpoin-5+50
end if
application.lock
application("chatdata")=chatdata
application("onliuser")=onliuser
application.unlock
session("userip")=request.servervariables("remote_addr")
%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><% =application("roomname") %></title>
<script Language='JavaScript' src=