Show current site online numbers

Source: Internet
Author: User
Show | online | online | Everyone good I am Jackie Chan, very happy to see you again, the last time I remember someone in the forum asked the number of online solutions, now I put a piece of code posted for your reference

The application uses global.asp, a very important file, and two objects in the file: application and Session
Global.asa
<script language= "Vascript" runat= "Server"

Sub Application_OnStart
Session.timeout=3
' Lock application
Application.Lock
' Start setting count initialized to 0
Application ("Whoson") =0
' Untie application
Application.UnLock
Endsub

Sub Session_OnStart
Appication.lock
Application ("Whoson") = Application ("Whoson") +1
Application.UnLock
Endsub

Sub Session_OnEnd
Application.Lock
Application ("Whoson") = Application ("Whoson")-1
Application.UnLock
Endsub

</script>

The next is how to show the problem, hehe. In fact, the front of the problem solved, the back is a piece of cake, just need to show the OH place to add the following code: (Of course, if the ASP's document)

<%response.write "Current online number:" &application ("Whoson") & "People"%>

or the following code effect is the same:

Current online number: <%=application ("Whoson")%> person

Of course, if you want to decorate it beautifully, you can add a little bit of HTML modifier code.

Jackie chan
2001/7/20



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.