Print Page | Close Window

Bug with a Banned IP’s

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=18259
Printed Date: 13 April 2026 at 8:55am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Bug with a Banned IP’s
Posted By: Ritchie
Subject: Bug with a Banned IP’s
Date Posted: 04 February 2006 at 11:00pm
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 -



Replies:
Posted By: WebWiz-Bruce
Date Posted: 06 February 2006 at 1:01pm
I'm sure this bug was fixed sometime ago, and I have been through the present code and con not replicate this error.

-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: Ritchie
Date Posted: 06 February 2006 at 8:36pm
I offer in my opinion the most simple way of the decision of this problem. It is necessary to add only one variable and to replace  (functions_common.asp for WWF 8 beta 1)
 
 
951   'Remove the wildcard charcter form the IP
952   strCheckIPAddress = Replace(strCheckIPAddress, "*", "", 1, -1, 1)
953
954   'Trim the users IP to the same length as the IP range to check
955   strTmpUserIPAddress = Mid(strTmpUserIPAddress, 1, Len(strCheckIPAddress))
956
957   'See if whats left of the IP matches
958   If strCheckIPAddress = strTmpUserIPAddress Then blnIPMatched = True
 
 
on
 
 
951   'Remove the wildcard charcter form the IP
952   strCheckIPAddress = Replace(strCheckIPAddress, "*", "", 1, -1, 1)
953
954    Dim strUserIPAddressMidFunction
955
956   'Trim the users IP to the same length as the IP range to check
957   strUserIPAddressMidFunction = Mid(strTmpUserIPAddress, 1, Len(strCheckIPAddress))
958
959   'See if whats left of the IP matches
960   If strCheckIPAddress = strUserIPAddressMidFunction Then blnIPMatched = True
 
After such changes IP of the address are processed correctly Wink


Posted By: WebWiz-Bruce
Date Posted: 07 February 2006 at 1:31pm
Many thanks for the suggestion

-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net