The given problem is present in 7.xx and in 8 beta 1 versions of a forum. Not all addresses in the list can be banned!
Function Ban IP in a file functions_common.asp works incorrectly. If at the list are present single IP addresses - all normally work. If in the list it is brought IP the address with a symbol * (Ban on a mask) all addresses which are located below this address not banned. If to exclude the given address from the list function works correctly. I have laid out a file which shows this mistake.
So works:
So does not work:
So normally works - IP the address with (*) 128.78.69.* is removed:
Here it is possible to take a file which shows misoperation of function
'******************************************
'**** Banned IP's *****
'******************************************
Private Function bannedIP()
'Declare variables
Dim rsIPAddr
Dim strCheckIPAddress
Dim strUserIPAddress
Dim blnIPMatched
Dim strTmpUserIPAddress
'Intilise variable
blnIPMatched = False
'Get the users IP
strUserIPAddress = getIP()
'Intialise the ADO recordset object
Set rsIPAddr = Server.CreateObject("ADODB.Recordset")
'Get any banned IP address from the database
'Initalise the strSQL variable with an SQL statement to query the database to count the number of topics in the forums
strSQL = "SELECT " & strDbTable & "BanList.IP " & _
"FROM " & strDbTable & "BanList" & strDBNoLock & " " & _
"WHERE " & strDbTable & "BanList.IP Is Not Null;"
'Query the database
rsIPAddr.Open strSQL, adoCon
'Loop through the IP address and check 'em out
Do while NOT rsIPAddr.EOF
'Reset the banned IP address
strTmpUserIPAddress = strUserIPAddress
'Get the IP address to check from the recordset
strCheckIPAddress = rsIPAddr("IP")
'See if we need to check the IP range or just one IP address
'If the last character is a * then this is a wildcard range to be checked
If Right(strCheckIPAddress, 1) = "*" Then
'Remove the wildcard charcter form the IP
strCheckIPAddress = Replace(strCheckIPAddress, "*", "", 1, -1, 1)
'Trim the users IP to the same length as the IP range to check
strTmpUserIPAddress = Mid(strTmpUserIPAddress, 1, Len(strCheckIPAddress))
'See if whats left of the IP matches
If strCheckIPAddress = strTmpUserIPAddress Then blnIPMatched = True
'Else check the IP address metches
Else
'Else check to see if the IP address match
If strCheckIPAddress = strTmpUserIPAddress Then blnIPMatched = True
End If
'Move to the next record
rsIPAddr.MoveNext
Loop
'Clean up
rsIPAddr.Close
Set rsIPAddr = Nothing
'Return the function
bannedIP = blnIPMatched
End Function
http://217.147.29.102/sample/IP.zip - http://217.147.29.102/sample/IP.zip
http://217.147.29.102/sample/banned.gif -