Using ASP to develop network chat rooms

Source: Internet
Author: User
Tags end html page interface odbc reset access database microsoft frontpage access
Chat Room | network | Chat rooms often surf the internet netizens are afraid that few people have not been to the chat room random Shinti. Just a little attention and you'll find that most of these chat rooms are maintained using CGI programs or applets developed by Java. Programmers who have developed such CGI or applets know that this kind of development work is time-consuming and laborious. So is there a simpler and less effort to develop the way? The answer is yes.
The introduction of ASP is a lot of computer magazine introduced, here is not to repeat.
First, chat room planning:
1, the choice of how to store conversation content: On the client to show the content of the instant conversation should be stored in what way the server? ASP has two options, one in the form of a text file and one in the database. But the author feels that the ASP's instructions for the operation of the text file are much less than the commands provided by ADO (Active Data Object) for database operations. Therefore, the use of ado,asp can be flexible to the database operations, such as inserts, deletes, updates, inquiries and so on. The author chooses an Access database to store the content of the conversation. The content of the database retains only one day (depending on the actual situation of the LAN to determine the length of time) conversation.
2, chat Room interface design: In order to customers can easily browse the content of the site, but also to show as much as possible the content of the chat room, the author in a homepage design of three frames. The left frame shows the index of the site. The right frame is divided into two frames. A frame of 70% is used to display the contents of the current chat room, and a frame of 30% is used to provide a text input box and a button for user feedback.
3, into the chat room steps: Like most chat rooms, the first should be provided to the user a login interface, by the user input their own name or alias and their own random given the secret Code. If the user name you enter is the same as the user name of the line, prompts the user to select the user name again or re-enter the password to ensure that all user names online are unique. After successful landing into the chat room, content display frames Show "Welcome to join" The welcome message. The user can enter the conversation content in the text entry area.
Second, the design process and development skills:
1, the design of ODBC system data Source: As mentioned earlier, this development using ASP to operate the ADO, so you must first set the data source. In the NT Server's Control Panel, double-click the ODBC icon to add a System DSN to the System DSN page, select Microsoft Access driver,data Source Name ' fybchat ', Database Select the Chat.mdb in the chat directory. The database consists of the following fields: Name, content, password, chattime, chatdate, which stores names, conversations, passwords, conversation times, and conversation dates, respectively.
2, Login interface design: Login interface for an HTML page, contains some warning information and a form. Get the account number and password since the form, as follows:


<form method= "POST" action= "receivedata.asp" > Account number:
<input type= "text" name= "Usname" > Password:
<input type= "Password" name= "Uspassword" >
</center >< br >< br > < center >
<input type= "Submit" value= "enter" >
<input type= "reset" value= "refill" >
</center >
<input type= "hidden" name= "content" value= "" >
</form>

The Submit button is used to excite the receivedata.asp. The ASP file is primarily to ensure that no two users in the chat room are in the same account. After the user submits the information, the file opens Chat.mdb check if there is already the account number, if there is, but the password is not correct to remind users to re-enter the password, if not then the user smoothly into the chat Room. The function of entering the chat room interface is completed by the following statements:


<frameset rows= "70%,30%" >
<frame src= "forum.asp" name= "main" marginwidth= "1"
marginheight= "1" noresize >
<frame src= "frft.asp?kname= <% =name%>" name= "Footnotes"
Marginwidth= "1" noresize >
</frameset >


Note that there is a trick here to hide the user's account in the client's browser with the parameter kname, so that the user submits his account each time he submits the conversation.
3, the text input area design: The text input area is produced by the frft.asp. As mentioned above, each time the user submits the conversation, he submits his account, and the action of the user submitting the conversation is to activate the forum.asp. The role of forum.asp is to refresh the contents of the chat room. Frft.asp contents are as follows:


<! DOCTYPE HTML Public "-//ietf//dtd html//en" >
<meta http-equiv= "Content-type" content= "text/html; Charset=gb_2312-80 ">
<meta name= "generator" content= "Microsoft FrontPage 2.0" >
<title >
<body >
<% Kname=request. QueryString ("Kname")% >
<base target= "Main" >
<form name= "FM1" method= "POST" action= "forum.asp" >
<p align= "center" ><input type= "text" size= "" name= "Content" > <p align= "center" ><input type= "bu Tton "Name=" B1 value= "submit/Refresh" >
<input type= "reset" name= "B2" value= "rewrite" ></p >
<input type= "hidden" name= "kname" value=<% =kname% >>
</form >
<script language= "VBScript" >
<!--
Sub Ietimer1_timer ()
If fm1.content.value= "" Then
Fm1.content.value= ""
Fm1.submit
End If
End Sub

Sub B1_onclick ()
Fm1.submit
Fm1.content.value= ""
End Sub
-->



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.