Users who surf frequently on the internet are afraid that few people have ever been to a chat room and 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 to ASP has been introduced in a number of computer magazines and is not discussed here.
One, chat room planning:
1, the choice of how to store conversation content: How should the content of the instant conversation on the client be stored in 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 designed 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, step into the chat room: Like most chat rooms, should first provide users with a login interface, 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. Users will be able to Enter the conversation content in the text input area.
Two, design process and development skills:
1, Design ODBC system data Source: As mentioned earlier, this development uses ASP to operate on 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 >
<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 there is a trick here to hide the user's account in the client's browser with the parameter kname, so that each time the user submits the conversation, his account Submitted.
3, the design of the text input area: The text input area is generated by 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. The frft.asp content is as follows
<! DOCTYPE HTML Public "-//ietf//dtd html//en" >
<meta http-equiv= "content-t Ype "content=" text/html; Charset=gb_2312-80 ">
<meta name=" generator "content=" Microsoft FrontPage 2.0 ">
<title
;/head >
<body >
<% kname=request. QueryString ("Kname")% >
<base target= "main" >
<form name= "FM1" method= "POST" action= "forum.asp" >
<p align= "center" ><input type= "text" size= "the" name= "Content" > <p align= "center" ><input Type= "button" Name= "B1" value= "Submit/Refresh"
<input type= "reset" name= "B2" value= "rewrite" >
<input Type = "hidden" name= "Kname" value=