Simple graphical counter for static Domino HTML pages. In your page include:
<img src="http://yourdomain/counter.nsf/counter?OpenAgent">
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Set db=session.CurrentDatabase
Set doc=session.DocumentContext
Dim Account As NotesDocument
Dim Accounts As NotesView
Dim digits(9) As String
digits(0) = "3c 66 66 66 66 66 66 66 66 3c"
digits(1) = "30 38 30 30 30 30 30 30 30 30"
digits(2) = "3c 66 60 60 30 18 0c 06 06 7e"
digits(3) = "3c 66 60 60 38 60 60 60 66 3c"
digits(4) = "30 30 38 38 34 34 32 7e 30 78"
digits(5) = "7e 06 06 06 3e 60 60 60 66 3c"
digits(6) = "38 0c 06 06 3e 66 66 66 66 3c"
digits(7) = "7e 66 60 60 30 30 18 18 0c 0c"
digits(8) = "3c 66 66 66 3c 66 66 66 66 3c"
digits(9) = "3c 66 66 66 66 7c 60 60 30 1c"
' You must create view Accounts with first column with value HTTP_Referer and Ascending sorting
Set Accounts=db.GetView("Accounts")
Set Account = Accounts.GetDocumentByKey( doc.HTTP_Referer(0) )
If Account Is Nothing Then
Set Account = New NotesDocument( db )
Account.HTTP_Referer = doc.HTTP_Referer(0)
Else
count = Account.count(0)
End If
Account.count = count + 1
Call Account.save(True, True)
count = Format(Account.count(0),"00000")
xlen = Len(count)
bytes = ""
For i = 0 To xlen*3-1
bytes = bytes + "0x00,"
Next
For y=0 To 9
For x=0 To xlen-1
digit = Mid(count,x+1,1)
byte = Mid(digits(digit),1+y*3,2)
bytes = bytes + "0x" + byte + ","
Next
Next
For i = 0 To xlen*3-1
bytes = bytes + "0x00,"
Next
Print "Content-type: image/x-xbitmapnn"
Print "#define count_width "+xlen*8
Print "#define count_height 16"
Print "static char count_bits[] = {"
Print bytes
Print "};"
End Sub
This was first published in November 2000