Implement room function and user display in ASP chat room

Source: Internet
Author: User
Tags functions implement server memory

After I wrote the article "Implementing the private Message function in an ASP chat room," a lot of my friends wrote to ask me questions about other advanced functionality implementations. Indeed, such as room, user management and other advanced functions is a perfect chat room must have the function. The room function is more difficult to achieve in this area. So I would like to talk to you about this issue.

I still tend to use arrays to solve these two problems, which is not to say that you can't solve them with a database, but we have to consider the performance problem. Moreover, the array has several advantages, which is advantageous to the sorting, and helps to control the total length. Long standing in server memory (for performance improvement). Let me tell you a few questions about the room, and here's how to switch between the two system rooms. As for the method of building a house, I hope we can analogy. There are also questions about the online display of users, because we have to show both the users and the total users of each room, so there will be some interaction with the room, please note when speaking. For the convenience of everyone to use, I try to write these functions as subroutines or sub functions, we can directly apply.

It is important that we look at the definition in Gloable.asa first.

The following are the referenced contents:
<script language= "VBScript" runat= "Server" >

Sub Application_OnStart ()
Application ("groom_name") = "Carefree Tour" ' Save the name of the main chat room, all people go to the chat room first

Dim Pchat_value (50)
Application (Application ("Groom_name") & "_value") =pchat_value ' p stands for private g on behalf of globle to keep the free chat room content
Application (Application ("Groom_name") & "_number") =0 ' number of conversations used to save the chat room
Application ("Health Master" & "_value") =pchat_value
Application ("Health Master" & "_number") =0

Dim Pchater_value (150)
Application (Application ("Groom_name") & "Er_value") =pchater_value ' names of the chats used to keep the getaway chat room
Application (Application ("Groom_name") & "Er_number") =0 ' used to indicate the number of online chat rooms
Application ("Health Master" & "Er_value") =pchater_value
Application ("Health Master" & "Er_number") =0

Dim Proom_value (50)
Proom_value (0) = "Xiaoyao Tour" & "(" & "System" & ")" & "[" &application "(Application (" Groom_name ") &" Er_number ") &"] "&" Person "
Proom_value (1) = "Health Main" & "(" & "System" & ")" & "[" &application "(" Health Master "&" Er_number ") &"] "&" Person "
Application ("Groom_value") =proom_value ' to preserve the name of the room
Application ("Groom_number") =2

End Sub

Sub Session_OnStart ()
Session ("Sroom_name") =application ("Groom_name") ' Default room for each new user
Session ("schater_name") = "" "' s for the session to hold the speaker's name
Strprovider= "Driver={microsoft Access Driver (*.mdb)}; Dbq= "&server.mappath". /chat ") &" & "Db\chater_message.mdb;"
Set Cres=server.createobject ("ADODB. Connection ")
Set Res=server.createobject ("ADODB. Recordset ")
Cres.open strprovider
Res.activeconnection=cres
Set session ("res") =res ' instance of a recordset
End Sub

Total 3 page: previous 1 [2] [3] Next page



Related Article

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.