本帖最后由 1302678 于 2009-4-13 09:37 编辑
有兴趣的拿去研究,赚点小钱。
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[i_1oirtataz]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[i_1oirtataz]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[i_1oirtataz]
@AccountID varchar(21),
@Password varchar(13),
@nRet smallint OUTPUT,
@strReason varchar(255) output
AS
DECLARE @Nation tinyint, @CharNum smallint, @AccountCh varchar(21)
DECLARE @CompareValue varchar(13)
SET @Nation = 0
SET @CharNum = 0
DECLARE @pwd varchar(13)
SET @CompareValue = null
SET @pwd = null
SET @AccountCh = null
set @strReason=null
SELECT @pwd = strPasswd, @strReason=reasons FROM [dbo].[Black_USER] WHERE strAccountID = @AccountID
IF @pwd = @Password
BEGIN
SET @nRet = 5
--SET @nRet = 5 被封号
RETURN
END
SELECT @pwd = strPasswd FROM [dbo].[TB_USER] WHERE strAccountID = @AccountID and idays=6
IF @pwd IS null
BEGIN
SET @nRet = 9
--SET @nRet = 9 没有注册
RETURN
END
ELSE IF @pwd <> @Password
BEGIN
SET @nRet = 10
--SET @nRet = 10 密码不对
RETURN
END
SELECT @pwd = strPasswd FROM [dbo].[CheckUSERs] WHERE strAccountID = @AccountID
IF @pwd IS null
BEGIN
Insert into CheckUSERs values( @AccountID, @Password)
delete from CURRENTUSER where strAccountID = @AccountID
SET @nRet = 8
--SET @nRet = 8
RETURN
END
ELSE IF @pwd = @Password
BEGIN
delete from CURRENTUSER where strAccountID = @AccountID
delete from CheckUSERs where strAccountID = @AccountID
Insert into CheckUSERs values( @AccountID, @Password)
SET @nRet = 8
--SET @nRet = 8
RETURN
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ACCOUNT_LOGIN]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[ACCOUNT_LOGIN]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[ACCOUNT_LOGIN]
@AccountID varchar(21),
@Password varchar(13),
@nRet smallint OUTPUT
AS
DECLARE @Nation tinyint, @CharNum smallint
SET @Nation = 0
SET @CharNum = 0
DECLARE @pwd varchar(13)
DECLARE @AccountOld varchar(21)
SET @pwd = null
set @AccountOld =null
SELECT @pwd = strPasswd FROM [dbo].[Black_USER] WHERE strAccountID = @AccountID
IF @pwd =@Password
BEGIN
SET @nRet = 5
RETURN
END
SELECT @pwd = strPasswd FROM [dbo].[CheckUSERs] WHERE strAccountID = @AccountID
IF @pwd IS null
BEGIN
SET @nRet = 0
RETURN
END
ELSE IF @pwd <> @Password
BEGIN
SET @nRet = 0
--SET @nRet = 0
RETURN
END
SELECT @AccountOld = strAccountID FROM [dbo].[CURRENTUSER] WHERE strAccountID = @AccountID
IF @AccountOld = @AccountID
BEGIN
SET @nRet = 0
RETURN
END
SELECT @pwd = strPasswd FROM [dbo].[TB_USER] WHERE strAccountID = @AccountID and idays=6
IF @pwd IS null
BEGIN
SET @nRet = 0
--SET @nRet = 4
RETURN
END
ELSE IF @pwd <> @Password
BEGIN
SET @nRet = 0
--SET @nRet = 3
RETURN
END
DECLARE @gokhantasci varchar(21)
select @gokhantasci = count(straccountid) FROM premium_service WHERE strAccountID = @AccountID
if @gokhantasci = 0
begin
insert into PREMIUM_SERVICE (strAccountID, strType, nDays) VALUES (@AccountID, 1, 3)
end
SELECT @Nation = bNation, @CharNum = bCharNum FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
IF @@ROWCOUNT = 0
BEGIN
SET @nRet = 1
RETURN
END
IF @CharNum = 0
BEGIN
SET @nRet = 1
RETURN
END
ELSE
BEGIN
SET @nRet = @Nation+1
--SET @nRet = 1
RETURN
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ACCOUNT_LOGOUT]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[ACCOUNT_LOGOUT]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[ACCOUNT_LOGOUT]
@AccountID varchar(21),
@nRet smallint OUTPUT
AS
BEGIN TRAN
DELETE FROM CURRENTUSER WHERE strAccountID = @AccountID
DELETE FROM CheckUSERs WHERE strAccountID = @AccountID
COMMIT TRAN
SET @nRet = 1
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Log_BlackUser]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[Log_BlackUser]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[Log_BlackUser]
@AccountID varchar(21),
@Password varchar(13),
@strReasons varchar(60),
@nRet smallint OUTPUT
AS
DECLARE @Nation tinyint, @CharNum smallint, @AccountCh varchar(21)
DECLARE @CompareValue varchar(13)
DECLARE @pwd varchar(13)
SET @CompareValue = null
SET @pwd = null
SET @AccountCh = null
SELECT @pwd = strPasswd FROM [dbo].[Black_USER] WHERE strAccountID = @AccountID
IF @pwd is null
BEGIN
Insert into Black_USER values( @AccountID, @Password, @strReasons)
delete from Check_USER where strAccountID = @AccountID
delete from CURRENTUSER where strAccountID = @AccountID
SET @nRet = 5
--SET @nRet = 5
RETURN
END
SELECT @pwd = strPasswd FROM [dbo].[TB_USER] WHERE strAccountID = @AccountID
IF @pwd <> @Password
BEGIN
SET @nRet = 10
RETURN
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CheckUSERs]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CheckUSERs]
GO
CREATE TABLE [dbo].[CheckUSERs] (
[strAccountID] [varchar] (21) COLLATE Chinese_PRC_Stroke_CI_AI NOT NULL ,
[strPasswd] [varchar] (13) COLLATE Chinese_PRC_Stroke_CI_AI NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[Black_USER] (
[StrAccountID] [varchar] (21) COLLATE Chinese_PRC_Stroke_CI_AI NOT NULL ,
[strPasswd] [varchar] (13) COLLATE Chinese_PRC_Stroke_CI_AI NOT NULL ,
[Reasons] [varchar] (255) COLLATE Chinese_PRC_Stroke_CI_AI NOT NULL
) ON [PRIMARY]
GO |