hackerneo 发表于 2008-12-3 10:54:31

ctgwglzc 发表于 2008-12-3 12:52:13

/****** Object:Stored Procedure dbo.ACCOUNT_NATION_CHECK2    Script Date: 6/6/2006 6:03:33 PM ******/

-- 팀장님 중국 재미있어요? --;
-- 팀장님 땜에 전 이 고달픈 프로시져 짜야 되요 ㅠ.ㅠ

CREATE PROCEDURE ACCOUNT_NATION_CHECK2 AS
------------------------------------------------------------------------------------------------
-- 변수들을 선언하는 부분

DECLARE @strAccountID char(31), @strCharID1 char(31), @strCharID2 char(31), @strCharID3 char(31)   
DECLARE @bNation tinyint, @bCharNum tinyint, @row tinyint
DECLARE @bNation1 tinyint, @bNation2 tinyint, @bNation3 tinyint -- 이건 국가 차이 ^^;

SET @strAccountID = null
SET @strCharID1 = null
SET @strCharID2 = null
SET @strCharID3 = null
SET @bNation = 0
SET @bCharNum = 0
SET @bNation1 = 0
SET @bNation2 = 0
SET @bNation3 = 0
SET @row = 0

--------------------------------------------------------------------------------------------------
-- 이 부분은 계정과 캐릭의 국가가 틀린 유저들을 임시 테이블에 넣는다.
DECLARE Backup_Cursor CURSOR FOR                                       
        SELECT strAccountID, bNation, bCharNum, strCharID1, strCharID2, strCharID3
        FROM ACCOUNT_CHAR WHERE bCharNum > 0       

        OPEN Backup_Cursor
        FETCH NEXT FROM Backup_Cursor INTO @strAccountID, @bNation, @bCharNum,
                        @strCharID1, @strCharID2, @strCharID3
                               
WHILE @@FETCH_STATUS = 0
BEGIN       
        SET @bNation1 = 0
        SET @bNation2 = 0
        SET @bNation3 = 0
/*
        SELECT @row = count(*)
        FROM ACCOUNT_NATION_CHECK                 -- 이 테이블에다가 명단을 넣을 계획임
        WHERE strAccountID = @strAccountID
*/
-----------------------------------------------------------
-- 비교될 캐릭들의 국가 정보 얻어온다 :)
        SELECT @bNation1 = Nation                        -- 첫번째 비교 캐릭
        FROM USERDATA WHERE strUserID = @strCharID1        
       
        SELECT @bNation2 = Nation                        -- 두번째 비교 캐릭
        FROM USERDATA WHERE strUserID = @strCharID2        
       
        SELECT @bNation3 = Nation                        -- 세번째 비교 캐릭
        FROM USERDATA WHERE strUserID = @strCharID3        
------------------------------------------------------------
        IF (((@bNation <> @bNation1) AND @bNation1 > 0) OR ((@bNation <> @bNation2) AND @bNation2 > 0 )
                OR ((@bNation <> @bNation3)AND @bNation3 > 0))
        BEGIN
                INSERT INTO ACCOUNT_NATION_CHECK(strAccountID, byAC_Nation, byChar_N1, byChar_N2, byChar_N3, strChar_ID1, strChar_ID2, strChar_ID3)
                VALUES (@strAccountID, @bNation, @bNation1, @bNation2, @bNation3, @strCharID1, @strCharID2, @strCharID3 )               
        END
       
        FETCH NEXT FROM Backup_Cursor INTO @strAccountID, @bNation, @bCharNum,
                        @strCharID1, @strCharID2, @strCharID3
END

CLOSE Backup_Cursor
DEALLOCATE Backup_Cursor


GO

demon2k 发表于 2008-12-3 13:01:20

我怀疑所谓的密码不对是因为有的端在读取数据库时对密码是采取了某些算法的,但是存储密码使用的使明码存储造成了这种现象

yangwx 发表于 2008-12-3 13:33:39

原帖由 demon2k 于 2008-12-3 13:01 发表 http://kofans.cn/bbs/images/common/back.gif
我怀疑所谓的密码不对是因为有的端在读取数据库时对密码是采取了某些算法的,但是存储密码使用的使明码存储造成了这种现象
登陆密码应该是由这个存储过程来判断滴

CREATE PROCEDURE 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)

SET @pwd = null

SELECT @pwd = strPasswd FROM . 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

demon2k 发表于 2008-12-3 13:56:40

谢谢,我去看一下 :)
页: [1]
查看完整版本: 谁有 ACCOUNT_NATION_CHECK 这个存储过程?