Web Wiz - Green Windows Web Hosting - Celebrating 25 Years!

  New Posts New Posts RSS Feed - Bug with a Banned IP’s
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Bug with a Banned IP’s

 Post Reply Post Reply
Author
Ritchie View Drop Down
Groupie
Groupie
Avatar

Joined: 14 June 2005
Location: Russian Federation
Status: Offline
Points: 91
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ritchie Quote  Post ReplyReply Direct Link To This Post Topic: Bug with a Banned IP’s
    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
 


Edited by Ritchie - 04 February 2006 at 11:05pm
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Ritchie View Drop Down
Groupie
Groupie
Avatar

Joined: 14 June 2005
Location: Russian Federation
Status: Offline
Points: 91
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ritchie Quote  Post ReplyReply Direct Link To This Post 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


Edited by Ritchie - 06 February 2006 at 8:38pm
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 07 February 2006 at 1:31pm
Many thanks for the suggestion
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.