home *** CD-ROM | disk | FTP | other *** search
/ 221.214.14.186 / 221.214.14.186.tar / 221.214.14.186 / zb / OnlineCount.asp < prev    next >
Text File  |  2003-10-07  |  4KB  |  111 lines

  1. <%@ Language=JavaScript %> 
  2. <% 
  3.   var strCountData="1234567890"; 
  4.   var theTime=new Date(); 
  5.   if (typeof(Application("GuestOnline"))=="undefined") 
  6.         Application("GuestOnline")="0"; 
  7.   function CheckGuest() 
  8.   { 
  9.     //Check Me 
  10.     if (typeof(Session("UserName"))=="undefined") 
  11.         Session("UserName")="guest"; 
  12.     var strUserName=String(Session("UserName")); 
  13.     var strGuestOnline=String(Application("GuestOnline")); 
  14.     var GuestArray=strGuestOnline.split("\n"); 
  15.     var i; 
  16.     var iGuestNum; 
  17.     if (typeof(Session("GuestNum"))=="undefined")    
  18.     { 
  19.        for (i=0;i<GuestArray.length;i++) 
  20.        { 
  21.           if (GuestArray[i]=="0") break; 
  22.        } 
  23.        Session("GuestNum")=i; 
  24.     } 
  25.     
  26.     iGuestNum=Session("GuestNum")*1;   
  27.     if (iGuestNum>10000)iGuestNum=10000;        
  28.   
  29.     var strFormatTime=theTime.getTime(); 
  30.     strFormatTime="0000000000000000000"+strFormatTime; 
  31.     strFormatTime=strFormatTime.substr(strFormatTime.length-16,16); 
  32.     
  33.     GuestArray[iGuestNum]=strFormatTime+strUserName; 
  34.     
  35.     strGuestOnline=GuestArray.join("\n"); 
  36.     Application("GuestOnline")=strGuestOnline; 
  37.     
  38.     return 1;    
  39.   } 
  40.   function GetNumber() 
  41.   {    
  42.     //Count Guests on line     
  43.     var strFormatTime=theTime.getTime()-5*60*1000; 
  44.     strFormatTime="0000000000000000000"+strFormatTime; 
  45.     strFormatTime=strFormatTime.substr(strFormatTime.length-16,16); 
  46.   
  47.     var strGuestOnline=String(Application("GuestOnline")); 
  48.     var GuestArray=strGuestOnline.split("\n");     
  49.     
  50.     var iGuestCounter=0; 
  51.     var i;    
  52.     for (i=0;i<GuestArray.length;i++) 
  53.     { 
  54.         if (GuestArray[i].substr(0,16)> strFormatTime) 
  55.             iGuestCounter++; 
  56.         else if (GuestArray[i].length>0) 
  57.             GuestArray[i]="0";    
  58.     }   
  59.     strGuestOnline=GuestArray.join("\n"); 
  60.     Application("GuestOnline")=strGuestOnline; 
  61.    return iGuestCounter; 
  62.   } 
  63.    
  64.    CheckGuest(); 
  65.    //Output 
  66.    strCountData=GetNumber(); 
  67.    
  68.    var i;    
  69.    strCountData="0"+strCountData;   
  70.          
  71. var strDigits= new Array( 
  72.          "0", "0x3c","0x66","0x66","0x66","0x66","0x66","0x66","0x66","0x66","0x3c", //0 
  73.          "1","0x30","0x38","0x30","0x30","0x30","0x30","0x30","0x30","0x30","0x30",  //1 
  74.          "2","0x3c","0x66","0x60","0x60","0x30","0x18","0x0c","0x06","0x06","0x7e",  //2 
  75.          "3","0x3c","0x66","0x60","0x60","0x38","0x60","0x60","0x60","0x66","0x3c",  //3 
  76.          "4","0x30","0x30","0x38","0x38","0x34","0x34","0x32","0x7e","0x30","0x78",  //4 
  77.          "5","0x7e","0x06","0x06","0x06","0x3e","0x60","0x60","0x60","0x66","0x3c",  //5 
  78.          "6","0x38","0x0c","0x06","0x06","0x3e","0x66","0x66","0x66","0x66","0x3c",  //6 
  79.          "7","0x7e","0x66","0x60","0x60","0x30","0x30","0x18","0x18","0x0c","0x0c",  //7 
  80.          "8","0x3c","0x66","0x66","0x66","0x3c","0x66","0x66","0x66","0x66","0x3c",  //8 
  81.          "9","0x3c","0x66","0x66","0x66","0x66","0x7c","0x60","0x60","0x30","0x1c"); //9 
  82.  
  83. var iCharCount=strCountData.length; 
  84. var iCharWidth=8; 
  85. var iCharHeight=10*1; 
  86. var theBit; 
  87. var theNum; 
  88. Response.ContentType ="image/x-xbitmap"; 
  89. Response.Expires =0; 
  90.  
  91. Response.Write ("#define counter_width "+ iCharWidth*iCharCount+"\r\n");  //═╝╨╬┐φ 
  92. Response.Write ("#define counter_height "+ iCharHeight+"\r\n");   //═╝╨╬╕▀ 
  93. Response.Write ("static unsigned char counter_bits[]={\r\n"); 
  94.  
  95. for (iRow=0;iRow<iCharHeight;iRow++) 
  96. for (i=0;i<iCharCount;i++) 
  97.   theBit=strCountData.charAt(i); 
  98.   for (k=0;k<strDigits.length;k+=(iCharHeight+1)) 
  99.   { 
  100.    if (strDigits[k]==theBit)break; 
  101.   } 
  102.   if (k>=strDigits.length)k=0; 
  103.   theOffset=k+1; 
  104.   
  105.   Response.Write (strDigits[theOffset+iRow]); 
  106.   Response.Write (","); 
  107.  
  108. Response.Write ("};\r\n"); 
  109. %>