I am working on trying to collect a more "Generic" version than I use. Also, getting the running stats from the INI file required that I wrote a function to read a standard format ini file. That was fairly easy and is as below:
<% '============================================================ 'Functions to parse out a section of the spamfilter.ini file '============================================================
Function ReadFromIniFile(strFileName,strSection, strKey)
Dim blnSectionFound: blnSectionFound = False
Dim blnKeyFound: blnKeyFound = False
Dim objFSO: Set objFSO = CreateObject ("Scripting.FileSystemObject")
Dim objTextStream: Set objTextStream = objFSO.OpenTextFile(strFileName)
Dim strLine Dim astrTemp
Do While Not objTextStream.AtEndOfStream And Not blnSectionFound strLine = objTextStream.ReadLine If InStr (strLine,"[" & strSection & "]") > 0 Then blnSectionFound = True End If Loop
Do While Not objTextStream.AtEndOfStream And Not blnKeyFound And blnSectionFound strLine = objTextStream.ReadLine If Not strLine = vbNullString Then If Not InStr (strLine,"[") > 0 And Not InStrRev (strLine,"]") > 0 Then astrTemp = Split(strLine,"=") If IsArray(astrTemp) Then If trim(astrTemp(LBound(astrTemp))) = strKey Then blnKeyFound = True End If End If Else blnSectionFound = True End If End If Loop
If blnKeyFound Then strValue = astrTemp(UBound(astrTemp)) End If
ReadFromIniFile = strValue End Function
'============================================================
%>
The section of code in my web interface that actually uses the function is as follows:
<tr> <td align="right"><font face="Arial" color="#008000"><small><strong>EMails Forwarded:</strong></small></font></td> <td width="5"></td> <td align="right"><small><font face="Arial" color="#FF0000"><strong><%Response.Write ReadFromIniFile("d:\SpamFilterISP\SpamFilter.ini","stats","EMailsForwarded:")%></strong></font></small></td> <td width="30"></td> <td align="right"><font face="Arial" color="#008000"><small><strong>EMails Blocked:</strong></small></font></td> <td width="5"></td> <td align="right"><small><font face="Arial" color="#FF0000"><strong><%Response.Write ReadFromIniFile("d:\SpamFilterISP\SpamFilter.ini","stats","EMailsBlocked")%></strong></font></small></td> </tr>
I hope this helps in the short term.
Dan S.
|