Network you like to surf the Internet friends must have been to NetEase's virtual community bar, inside the pager function must be very popular. Through the pager, we can call anyone who is currently surfing in a virtual community and can chat online.
In fact, we use ASP can fully realize with netease virtual community inside the same function of the pager, how? Don't believe it? Then follow me step by step using ASP to realize the network Pager bar.
Active Server Pages (ASP) is a server-side scripting environment that you can use to create and run dynamic, interactive WEB server applications. Using ASP, you can combine HTML pages, script commands, and ActiveX components to create interactive Web pages and powerful web-based applications. ASP applications are easy to develop and modify.
Next, we began to write our network pager.
First of all, there are two ways to realize the function of network paging:
A Using database to realize the preservation and processing of paging information
The advantage of this approach is that storage information processing is very convenient, but its shortcomings are also obvious, that is, increase the burden on the server side, because the frequent storage database will greatly increase I/o access times, resulting in slow connection speed of the site.
Two Use application directly to save paging information
The advantage of this method is that the speed is obviously faster than using the database to save the paging information; The disadvantage is that the processing information is cumbersome, but it is worth it, we must first guarantee the performance of the entire site.
In combination with the above factors, we will use the second method to write a network pager, for the first method, I will briefly introduce the last.
Our network pager needs three pages, that is, "pager" page, "Display paging Information" page, "Monitor pager" page.
The pager page (bbssendbegic.asp) is a page that is used to send messages to other online users, naturally, as if it were a paging station in our lives.
The "Show Paging Information" page (bbssendinfo.asp) is when someone calls you, bounce out of the page that shows the call content, just like your own BP, but our network BP machine is more powerful oh, he can immediately reply to the information they give you, you can reply later, Or simply erase the message.
The "Watch Pager" page (bbsautosearch.asp) is a constant monitor of whether someone is calling your page, like an indefatigable robotic robot that keeps tabs on all the paging information and filters out only your paging information.
Three pages only between the "Display paging Information" page and the "Monitor pager" page is closely related to the "pager" page is a relatively independent page, the three relations are as follows:
No direct relationship to the "BP machine."
Next, we start writing the first page, the "pager" page. In this page, we want to implement the following functions:
1. Get the list of users currently online
2. Send information to the paging information queue to prepare for future information
The specific code for the page is as follows (bbssendbegin.asp):
The code has detailed annotation information that can be read carefully
Users=split (Application ("Onlineuser"), ",") ' splits the list of current online users and saves them to an array
If Trim (Request ("act") = "Wantsend" then "determines the current operating state
Who=trim (Request.Form ("who")) ' gets called user name
Content=trim (Request.Form ("content")) ' Get call content
Meme=trim ("userid") ' Gets the name of the user who sent the pager
If who= "" or content= "" Then
Response.Redirect "error.asp?msg= name or message content is empty, unable to transmit!"
' Send the information below to the paging information queue.
If Trim (Application ("message")) = "" Then
Application ("message") =who & "$" & Content & "$ & meme" placed in the paging information queue
Application.Lock ' placed in the paging information queue
Application ("message") =application (' message ') & "&" & Who & "$" & Content & "$" & meme
' Send finished, close page
<title> Network Pager </title>
function Check ()
Alert ("You have to say a few words!");
Document.send.action= "Bbssendbegin.asp?act=wantsend&userid=<%=trim" (Request ("userid"))%> ";
<body bgcolor=ghostwhite >
Network Paging machine
<%if Ubound (users) >=2 then%>
<form name= "Send" method= "POST" >
<td> send a message to:</td>
<!--get a list of current online users and put them in the Drop-down list box-->
<select name= "who" >
<%for i=0 To UBound (users)%>
<%if Trim (Users (i)) <>trim (meme) then%>
<%if i>1 then%>
<%if users (i) <>users (i-1) then%>
<%if users (i) <>meme then%>
<td> Message Content:</td>
<input type= "text" name= "content" size= "maxlength=" >
<TD colspan= "2" > </td>
<TD colspan= "