chat.asp--Master Frame Control file

Source: Internet
Author: User
Control <%
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= "System" or username= "owner" or username= "then Response.Redirect" Error.asp?mess= uses an illegal character as the name or a system-reserved name, please change one "
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= the same chat nickname already exists, please enter with another nickname"
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 ' Save user name
Chatdata (i,1) =request.servervariables ("REMOTE_ADDR") ' Save IP Address
Chatdata (i,3) = "" ' Whisper Empty
Chatdata (i,4) =admlevel ' Place do not hit the flexible switch, MIDI switch
Chatdata (i,5) = "" Hide list is empty
Noplace=false
Session ("userid") =i
Exit For
End If
Next
If not Noplace then
onliuser=onliuser& ", '" &username& "" ' Add user to List
For I=0 to 50
Chatdata (i,4) = (chatdata (i,4) mod 4) +4 ' Notify other users to refresh the list
Next
Else
Response.Redirect "error.asp?mess= chat room is full!" "
End If
Else
If InStr (Onliuser, ", '" &username& ") <1 then onliuser=onliuser&", "" &username& ""


End If
Chatpoin=application ("Chatpoin") ' Retains 5 records
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")
%>

<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title><% =application ("Roomname")%></title>
<script language= ' JavaScript ' src= ' action.js ' ></script>
<script language= ' JavaScript1.2 ' >
var username= "<% =username%>";
Midisw=false; Music switch
var list=new Array (');
var btitle = '



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.