Attached: Original

Source: Internet
Author: User
Tags close page trim advantage
Using ASP to write network paging machine

You like surfing the Internet friends must have been to the virtual community NetEase, 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

<%@ Language=vbscript%>
<%
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!"
End If
' Send the information below to the paging information queue.
If Trim (Application ("message")) = "" Then
Application.Lock
Application ("message") =who & "$" & Content & "$ & meme" placed in the paging information queue
Application.UnLock
Else
Application.Lock ' placed in the paging information queue
Application ("message") =application (' message ') & "&" & Who & "$" & Content & "$" & meme
Application.UnLock
End If
' Send finished, close page
Response.Write "<script language=javascript>self.close ();</script>"
End If
%>
<title> Network Pager </title>
<script language= "JavaScript" >
function Check ()
{
if (document.send.content.value.length<1)
{
Alert ("You have to say a few words!");
Return
}
Document.send.action= "Bbssendbegin.asp?act=wantsend&userid=<%=trim" (Request ("userid"))%> ";
Document.send.submit ();
}
</script>
<body bgcolor=ghostwhite >
<br>
<center>
Network Paging machine
</center>
<br>
<%if Ubound (users) >=2 then%>
<center>
<form



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.