ASP without Golobal and session to achieve online population statistics

Source: Internet
Author: User
Tags count root directory server memory
session| Statistics | online | Online number The most commonly used method is Golobal.asa combined session, but this method has two disadvantages:


1, each session to occupy 12k of server memory space, in order to the number of +1 will pay the price of 12k memory.


2, Golobal.asa to be placed in the root directory of the site will work, and the root directory can only have a golobal, contradictions outstanding.


to this end, there is a use of cookies and application in the ASP file to achieve online statistics method, welcomed the criticism, common discussion:


First step: Make a framework that contains hidden frames (count.asp)


Step Two: Write Count.asp


<%


user=request.cookies ("21bbsusername")


totaluser=application ("user")


If InStr (Totaluser,user) =0 then


Application.Lock


application ("user") =totaluser& ";" &user


Application.UnLock


End If


%>


<html>


<head>


<meta http-equiv= "Refresh" content= "2" >


</head>


<body>


</body>


</html>


Step three: Show


<%


user=split (Application ("User"), ";")


num=ubound (user)


Response.Write Num


%>





Related Article

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.