• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Account_login+nation fixed.

Experienced Elementalist
Joined
Dec 7, 2006
Messages
250
Reaction score
2
Code:
ALTER PROCEDURE [dbo].[ACCOUNT_LOGIN]
@AccountID    varchar(21),
@Password    varchar(13),
@nRet        smallint    OUTPUT

AS

----------------------------------Client Auto Account Registration---------------------------
--REMOVE /* & */ to enable
/*
select @nRet = count(straccountid) from tb_user where straccountid = @AccountID

if @nRet = 0
begin
insert into tb_user (straccountid, strpasswd, strSocNo, idays, strAuthority) values (@AccountID, @password, 1, '6', 1)
end
*/
-----------------------------------Process Login----------------------------------------

DECLARE @Nation tinyint, @CharNum smallint, @PremyName varchar(21), @Auth tinyint, @Charid char(21)
SET @Nation = 0
SET @CharNum = 0
DECLARE @pwd varchar(13)
SET @pwd = null
SELECT @pwd = strPasswd FROM TB_USER WHERE strAccountID = @AccountID  and  idays>0
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

------------------------------ Define Changes ------------------------------------------

update userdata set zone = 21 where zone = 202
exec RunDupeCheckInn @AccountID
exec RunDupeCheck @AccountID
exec RunDupeCheck2 @AccountID
--exec DupeDeleter @AccountID compatible only with ourko db


---------------------------------ban check----------------------------------------------
--some extra checks 

select @Auth = strAuthority from TB_USER where strAccountID = @AccountID

IF @Auth = 255 -- Define login Blocked (TB_USER 'strAuthority')

BEGIN
        SET @nRet = 4 -- Give Notice "Your Account is currently Blocked. Please contact customer Support"
        RETURN
END

else IF @Auth = 1 -- Define Allowed Login (TB_USER 'strAuthority')

BEGIN
        SET @nRet = @Nation+1 
        RETURN
END 

------------------------------Successfull Transaction-----------------------------------

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

Tested and 100% working, credits to Zenocide for 80% of the procedure cant really tell howmuch% just guessing.

and credits to me for finding out the fix & adding more things.

Woot another epic release, lol.

:laugh:​
 
Experienced Elementalist
Joined
Sep 22, 2005
Messages
215
Reaction score
11
Re: [Share]ACCOUNT_LOGIN+NATION FIXED.

Nice...i mean there are others out there but this is one is organized and looks professional :)

keep up the good work
 
Junior Spellweaver
Joined
Jun 5, 2006
Messages
133
Reaction score
0
Re: [Share]ACCOUNT_LOGIN+NATION FIXED.

Code:
ALTER PROCEDURE [dbo].[ACCOUNT_LOGIN]
@AccountID    varchar(21),
@Password    varchar(13),
@nRet        smallint    OUTPUT

AS

----------------------------------Client Auto Account Registration---------------------------
--REMOVE /* & */ to enable
/*
select @nRet = count(straccountid) from tb_user where straccountid = @AccountID

if @nRet = 0
begin
insert into tb_user (straccountid, strpasswd, strSocNo, idays, strAuthority) values (@AccountID, @password, 1, '6', 1)
end
*/
-----------------------------------Process Login----------------------------------------

DECLARE @Nation tinyint, @CharNum smallint, @PremyName varchar(21), @Auth tinyint, @Charid char(21)
SET @Nation = 0
SET @CharNum = 0
DECLARE @pwd varchar(13)
SET @pwd = null
SELECT @pwd = strPasswd FROM TB_USER WHERE strAccountID = @AccountID  and  idays>0
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
-- Check for bans, don't do a dupe check for no reason...
---------------------------------ban check----------------------------------------------
--some extra checks 

select @Auth = strAuthority from TB_USER where strAccountID = @AccountID

IF @Auth = 255 -- Define login Blocked (TB_USER 'strAuthority')

BEGIN
        SET @nRet = 4 -- Give Notice "Your Account is currently Blocked. Please contact customer Support"
        RETURN
END

else IF @Auth = 1 -- Define Allowed Login (TB_USER 'strAuthority')

BEGIN
        SET @nRet = @Nation+1 
        RETURN
END 

------------------------------ Define Changes ------------------------------------------

update userdata set zone = 21 where zone = 202
exec RunDupeCheckInn @AccountID -- Isn't Doing all of this at one stage a little memory intense? Most servers will lockup with this especially with poorly written proedures.
exec RunDupeCheck @AccountID    -- Set these to be run rather on UPDATE userdata. This does it when they save data, and if you know what you're doing, you can log any dupes.
exec RunDupeCheck2 @AccountID   -- This really doesn't help at all.....
--exec DupeDeleter @AccountID compatible only with ourko db


------------------------------Successfull Transaction-----------------------------------

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

Check for ban first. This way it's more efficient. Also, checking for dupes at this point is somewhat useless.
 
Back
Top