IP BAN Problem

05/27/2013 13:03 .Curious.#1
Hello,

I am using xxdashxx's ban script. Everything works well but when an ip got banned that user can ban anybody who he/she knows the ID of the user. Because the procedure is not checking if the password is correct or not ,it is just checking IP and ID if one of them matches it is banning the account.

procedure is :
Code:
--Check for IP ban, if so set the status of the user to banned.
IF(SELECT COUNT(*) FROM [GM_Stuff].[dbo].[BannedIP] where [IP1] = @UserIP) > 0
BEGIN
SET @Status = -2
UPDATE PS_UserData.dbo.Users_Master SET [Status] = @Status WHERE UserID = @UserID
END
IF(SELECT COUNT(*) FROM PS_UserData.dbo.Users_Master where [UserIp] = @UserIP and [Status] = '-2') > 0
BEGIN
-- if previous section returns results witch means the ip is attatched to an account previously ip banned
IF(SELECT COUNT(*) FROM [GM_Stuff].[dbo].[BannedIP] where [UserID] = @UserID) > 0
UPDATE [GM_Stuff].[dbo].[BannedIP] SET [LogAtempt] = 'TRUE' WHERE UserID = @UserID
Else INSERT INTO [GM_Stuff].[dbo].[BannedIP] (UserID,BanDate,IP1,StaffID,StaffIP,[LogAtempt])
Values (@UserID,GETDATE(),@UserIP,'Log','127.0.0.1','TRUE')
END

Could anybody fix that procedure to check Passwords as well besides IP and ID it should not ban if the pasword is incorrect.

Thanks
05/27/2013 19:00 {Skrillex}#2
Use Windows Firewallas an Ip Ban.
05/27/2013 19:29 .Curious.#3
Quote:
Originally Posted by ϟƘƦƖןןΣ✘ View Post
Use Windows Firewallas an Ip Ban.
Thanks for your reply but I wanna use that one.
05/28/2013 17:24 {Skrillex}#4
Today I´m Santa Clouse and make wishes true!

Excute this Query:
Quote:
USE [PS_UserData]
GO
/****** Object: Table [dbo].[BannedIPs] Script Date: 07/30/2010 10:23:37 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[BannedIPs](
[Row] [int] IDENTITY(1,1) NOT NULL,
[banIP] [varchar](15) NOT NULL,
[Reason] [varchar](18) NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
If u want to Ban an Ip Use This Query:
Quote:
INSERT INTO [PS_UserData].[dbo].[BannedIPs] (Banip,Reason)
Values ('Put Ip here','Put Reason here')