Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE dbo.ACCOUNT_LOGIN
- @AccountID varchar(21),
- @Password varchar(32),
- @nRet smallint OUTPUT
- AS
- /*
- Author: Nero
- */
- DECLARE @AccountID2 varchar(50), @Password2 varchar(50), @Authority smallint, @Nation tinyint, @CharNum tinyint
- SET @Nation = 0
- SET @CharNum = 0
- -- Otomatik üyelik
- SELECT @AccountID2 = COUNT(strAccountID) FROM TB_USER WHERE strAccountID = @AccountID
- IF @AccountID2 = 0
- BEGIN
- INSERT INTO TB_USER (strAccountID, strPasswd) VALUES (@AccountID, @Password)
- END
- /* Normal üyelik
- SELECT @AccountID2 = COUNT(strAccountID) FROM TB_USER WHERE strAccountID = @AccountID
- IF @AccountID2 = 0
- BEGIN
- SET @nRet = 2 -- Account doesnt exist.
- RETURN
- END
- */
- SELECT @Password2 = strPasswd, @Authority = strAuthority FROM TB_USER WHERE strAccountID = @AccountID
- IF @Password2 IS null or @Password2 != @Password
- BEGIN
- SET @nRet = 3 -- Invalid password.
- RETURN
- END
- ELSE
- IF @Authority = 255
- BEGIN
- SET @nRet = 4 -- Account is banned.
- RETURN
- END
- ELSE
- BEGIN
- DELETE CURRENTUSER WHERE strAccountID = @AccountID
- SET @nRet = @Nation+1
- RETURN
- END
- SELECT @Nation = bNation, @CharNum = bCharNum FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
- IF @@ROWCOUNT = 0
- BEGIN
- SET @nRet = @Nation+1
- RETURN
- END
- IF @CharNum = 0
- BEGIN
- SET @nRet = @Nation+1
- RETURN
- END
- ELSE
- BEGIN
- SET @nRet = @Nation+1
- RETURN
- END
- GO
Add Comment
Please, Sign In to add comment