<% Response.buffer = True '----------------------------------------------------------------------------------------------------- '- ASP ActiveUsers - Version 1.0 - 13 January 2006 '- Credits to an original article of Josh Painter (http://www.joshpainter.com) '- Copyright © 2006 - modified by Livio Siri (http://www.livio.net) - All Rights Reserved. '----------------------------------------------------------------------------------------------------- '######### Configuration ######################### '--- The Session("bLoginOK") enables the full IP view and WHOIS link. '--- If TRUE you can display the full IP number and perform an IP Whois to know more details about your online visitors. '--- If your site has an administration system, the Session("bLoginOK") should hold the site administrator login status. '--- Fill it with your own login system Session status like: Session("bLoginOK") = Session("YOUR_LOGIN_SESSION_NAME") '--- WARNING: For privacy reasons the visitor IP should be hidden from generic users view, then default should be left FALSE '--- The Session("bLoginOK") = True enables the full IP view and WHOIS link. '--- If your site has an administration system then the Session("bLoginOK") should hold the site administrator login status. '--- Fill it with your own login system Session status like: Session("bLoginOK") = Session("YOUR_LOGIN_SESSION_NAME") '--- WARNING: For privacy reasons the visitor IP should be hidden from generic users view, '--- then for default the Session("bLoginOK") is FALSE Session("bLoginOK") = True '--- Show Who is Online into a pop-up window (True) or in your own created ASP page (False) bShowPopUp = True '--- If bShowPopUp = False then define here your Who is Online page name, refered to the root dir sWhoIsOnlinePage = "whoisonlinetest.asp" '--- The ActiveUsers script path, refered to the root dir sActiveUsersPath = "/activeusers/" '--- In minutes, how long before a User is considered Inactive and is deleted from ActiveUserList intActiveUserTimeout = 15 '--- In minutes, how often should the ActiveUserList be cleaned up. intActiveUserCleanupTime = 1 '######### Configuration End ###################### Session.LCID = 1040 '--- Dim global variables Dim bShowPopUp Dim sWhoIsOnlinePage Dim sActiveUsersPath Dim intActiveUserCleanupTime Dim intActiveUserTimeout '============== CORE ============================================= Call LogActiveUser() Call ActiveUserCleanup() '============== Hide the visitor IP number ================================ Function sNewUserIP(IP) ' On error resume next Dim Tmp, i, sNewIP Tmp = split(IP,".", -1, 1) i = 0 do until i = Ubound(tmp) +1 If i = 2 Then sNewIP = sNewIP & String(len(tmp(2)), "x") & "." ' "xxx." Else sNewIP = sNewIP & tmp(i) & "." End if i = i + 1 loop erase Tmp If len(sNewIP) > 0 then sNewIP = left(sNewIP, Len(sNewIP)-1) else sNewIP = "(unknown)" end if sNewUserIP = sNewIP End Function '============= Log Active Users ======================================= Sub LogActiveUser Dim strActiveUserList Dim intUserStart, intUserEnd Dim strUser Dim strDate Dim inStart strActiveUserList = Application("ActiveUserListLog") inStart = Instr(1, strActiveUserList, Session.SessionID) If inStart > 0 Then Application.Lock intUserStart = Instr(inStart, strActiveUserList, "_Page")+5 intUserEnd = Instr(intUserStart, strActiveUserList, "|") strUser = Mid(strActiveUserList, intUserStart, intUserEnd - intUserStart) strActiveUserList = Replace(strActiveUserList, strUser, request.servervariables("path_info") & "?" & request.querystring & ":" & Now()) Application("ActiveUserListLog") = strActiveUserList Application.UnLock Else Application.Lock Application("ActiveUsersLog") = CInt(Application("ActiveUsersLog")) + 1 Application("ActiveUserListLog") = Application("ActiveUserListLog") & Session.SessionID &_ "_IP" & Request.ServerVariables("REMOTE_ADDR") &_ "_From" & UCase(Request.ServerVariables("HTTP_ACCEPT_LANGUAGE")) &_ "_Logon" & Now() &_ "_Page" & request.servervariables("path_info") & "?" & request.querystring &_ ":" & Now() & "|" Application.UnLock End If End Sub '============= Clean Up Active Users======================================= Sub ActiveUserCleanup Dim ix Dim intUsers Dim strActiveUserList Dim aActiveUsers If Application("ActiveUserListLog") = "" Then Exit Sub If DateDiff("n", Application("ActiveUsersLastCleanup"), Now()) > intActiveUserCleanupTime Then Application.Lock Application("ActiveUsersLastCleanup") = Now() Application.Unlock intUsers = 0 strActiveUserList = Application("ActiveUserListLog") strActiveUserList = Left(strActiveUserList, Len(strActiveUserList) - 1) aActiveUsers = Split(strActiveUserList, "|") For ix = 0 To UBound(aActiveUsers) On error resume next If DateDiff("n", Mid(aActiveUsers(ix), Instr(1, aActiveUsers(ix), ":") + 1, Len(aActiveUsers(ix))), Now()) > intActiveUserTimeout Then aActiveUsers(ix) = "XXXX" Else intUsers = intUsers + 1 End If On error goto 0 Next strActiveUserList = Join(aActiveUsers, "|") & "|" strActiveUserList = Replace(strActiveUserList, "XXXX|", "") Application.Lock Application("ActiveUserListLog") = strActiveUserList Application("ActiveUsersLog") = intUsers Application.UnLock End If End Sub '============= Display Who is Online List ===================================== Sub ShowActiveUsersList () Dim ix Dim intUsers Dim strActiveUserList Dim aActiveUsers Dim count, conn, rs, bgclr Dim sUserIP, sFrom, sPage, sUserID, sLastIn, sAtime, sLogon response.write "
" response.write "http://" & request.servervariables("HTTP_HOST") & " - Who is Online Now (" & Now() & ")" response.write "
" response.write "
" response.write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" On error resume next count=0 strActiveUserList = Application("ActiveUserListLog") strActiveUserList = Left(strActiveUserList, Len(strActiveUserList) - 1) aActiveUsers = Split(strActiveUserList, "|") For ix = 0 To UBound(aActiveUsers) sUserID = Mid(aActiveUsers(ix), 6, Instr(1, aActiveUsers(ix), "_IP")-6) sUserIP = Mid(aActiveUsers(ix), Instr(1, aActiveUsers(ix), "_IP")+3, Instr(1, aActiveUsers(ix), "_From")-5-Instr(1, aActiveUsers(ix), "_IP")+2) sFrom = Mid(aActiveUsers(ix), Instr(1, aActiveUsers(ix), "_From")+5, Instr(1, aActiveUsers(ix), "_Logon")-5-Instr(1, aActiveUsers(ix), "_From")) sLogon = Mid(aActiveUsers(ix), Instr(1, aActiveUsers(ix), "_Logon")+6, Instr(1, aActiveUsers(ix), "_Page")-6-Instr(1, aActiveUsers(ix), "_Logon")) sPage = Mid(aActiveUsers(ix), Instr(1, aActiveUsers(ix), "_Page")+6, Instr(1, aActiveUsers(ix), ":")-6-Instr(1, aActiveUsers(ix), "_Page")) sLastIn = FormatDateTime(Mid(aActiveUsers(ix), Instr(1, aActiveUsers(ix), ":") + 1, Len(aActiveUsers(ix))), vbLongTime) sAtime = DateDiff("n", sLogon, Now()) sLogon = FormatDateTime(sLogon, vbLongTime) If count Mod 2 = 0 Then bgclr = "#F6F6F6" Else bgclr = "#EFEFEF" End if count=count+1 Response.Write "" Response.Write "" If Session("bLoginOK") Then Response.Write "" Else Response.Write "" End if Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Next On error goto 0 Response.Write "
IDIP addressFromLogonLast inActive timeActive page
" & sUserID & ""& sUserIP & "" & sNewUserIP(sUserIP) & "" & sFrom & "" & Replace(sLogon, ".", ":") & "" & Replace(sLastIn, ".", ":") & "" & sAtime & " Mins" & sPage & "
" response.write "

" If right(Request.serverVariables("SCRIPT_NAME"), len(Request.serverVariables("SCRIPT_NAME")) - instrrev(Request.serverVariables("SCRIPT_NAME"), "/")) <> "activeuserstest.asp" AND bShowPopUp Then response.write "
" response.write "
" response.write "
" End if End Sub '--- ShowActiveUsersList '============= Display Active Users Number ====================================== Sub ShowActiveUsersNumber () response.write "
" If bShowPopUp Then response.write " Users online  " Else response.write " Users online: " End if response.write " " & Application("ActiveUsersLog") & " 
" End Sub '--- ShowActiveUsersNumber %>
        <% Call ShowActiveUsersNumber () %>

logo

 FIRE & RESCUE

 POLICE

 PUBLIC WORKS &     TRANSFER STATION

 CODE ENFORCEMENT

 TAX ASSESSMENTS
      & COLLECTION


 BUDGET & FINANCE

 WATER & SEWER

 SELECTMEN'S AGENDA

 PLANNING BOARD'S AGENDA

 WATER DISTRICT'S AGENDA

 SANITARY DISTRICT'S     AGENDA

 BUILDING COMMITTEE'S     AGENDA

 INFRASTRUCTURE     COMMITTEE'S AGENDA

 TOWN ORDINANCES

 PRINTABLE FORMS

Office Hours: Monday-Friday 8:30 am to 5 pm (1st business day of the month office opens at 9am)

                                    (New registrations cannot be processed at 4:30 p.m.)

The day to day business in the Town Office is ably administered by this dedicated and efficient staff.

e-mail to theTown office

Jim Ricker





Town Manager, Jim Ricker, (207) 368-4410



  Certified Treasurer and Tax Collector, Deanna Thompson


Paula



Certified Town Clerk / Registrar of Voters, Paula Scott


Shawna





Clerk / Secretary, Shawna Varrelmann

[Home Page] [Industrial Park News] [Map Page] [Photo Gallery] [History] [Lake News] [Contact Us]

This page was last modified February 18, 2010