inicio mail me! sindicaci;ón

Realize a website with ASP program online number statistic

In the accession of the webpage that browse, the online number that often can see the number on current website of a few “ is XXX person ” is the same as plan. How do with ASP? Above all, analyse its way, generally speaking, statistic of the number on these lines is to point to the caller number statistic inside a period of time. For instance (inside 5 minutes, inside 10 minutes) and the accident of this time, be by architect set.

Be the same as inside this period of time plan the caller number of each different IP, can reach the number on current line, but here has a precise issue to need to solve, as to come with what method accurately statistic, that is the method with different each one, can use the page that submits automatically for instance, lie between period of time to read take COOKIES to wait a moment, and in ASP, have a finer craftsmanship, use Session object to come namely statistic, gobal.asa introduces here this file, this is a very important file, see its structure please.

It is quotative content below:

> of < SCRIPT LANGUAGE= “VBScript” RUNAT= “Server”

Sub Session_OnStart

End Sub

Sub Session_OnEnd

End Sub

Sub Application_OnStard

End Sub

Sub Application_OnEnd

End Sub < / SCRIPT >

When should having a conversation happening (the user browses a webpage, issue a request to Web server) so, if the word from the first user after the server is started, with respect to can coinstantaneous Application_OnStard and Session_OnStart these two incident, later, again other user utters the word of the request, produce Session_OnStart only this incident, and of Session live period be how long, it is OK of set, session.timeout=X (minute)

Good, had this very good used method, we give online number with respect to well and truly statistic, and number amount is to use an Application variable to save, should be in the first conversation in the begining, the statement Application(”online” )=0 of a clear empty tally is placed in Application_OnStard incident, next, in Session_OnStart incident, place a statement Application(”online” )=application(”online” ) 1 that increases online number, and the statement that puts accordingly to reduce online number in Session_OnEnd incident, your computation value is decreased one.

Such, this file is as follows with respect to instead

It is quotative content below:

> of < SCRIPT LANGUAGE= “VBScript” RUNAT= “Server”

Sub Session_OnStart

Application(”online” )=application(”online” ) 1

End Sub

Sub Session_OnEnd

Application(”online” )=application(”online” )-1

End Sub

Sub Application_OnStard

Application(”online” )=0

End Sub

Sub Application_OnEnd

Application(”online” )=0

End Sub < / SCRIPT >

Write the program of figure of an indication figure next, show online strength on designation page. Can reach so in the number

It is quotative content below:

*Online.asp

> of < % @language= “vbscript” %
< %Tmp=application(”online” )Tmp=Cstr(tmp)Dim Disp(20)Dim Images(20)Dbbits=len(tmp)For I= 1 To DbbitsDisp(I)=left(right(tmp, i) , i-(I-1) )Next

For I=dbbits To 1 Step -1Images(I)= ” < Img Src= “&”Http://xxxx.com.cn/pic “&"/ " &disp(I)&”.gif > “

Response.write "document.write(" &images(I)&”) ; “

Next

% >

The procedure above is very simple, the analysis is not made here, ask him everybody to be read. Cite with statement of a Script on the page that calls online statistic Online.asp file, in order to show graphical statistic implement.

It is quotative content below:

< of > of < Script Language= “JavaScript” Src= “http://xxxx.com.cn/online.asp” / Script >

OK now, remember a point, you must put Gobal.asa on list of true root of Web application process, and had better build process of a Web application for this statistic alone, do not want disorder of as other as other program, the data that reachs otherwise is inaccurate, and modify this program the online statistic that is much user is very simple also. Can offer online statistic to serve so, how to come true please everybody goes thinking. . . .

Bookmark:Digg Del.icio.us Reddit

Leave a Comment