Quote:
Originally Posted by benoli105
ok well , is the built in registratin that hard? i mean , harder then making a web register page .. ?
|
no it's quite easier.
registration by web-based form requires:
- setting up a php, asp, cgi, ..., http server
- running connection between http server & SQL server
- knowing how registration is done at svr game side
auto-registration only requires
- knowing how registration is done at svr game side
but the point of Phantomangel042 is important, your login process will not be able to detect any mistyping (coz its purpose is to create a new account if given user's name doesn't exist) and thus it can be confusing to players: their first reaction will be to think that they enter the correct user name and their account has been deleted or hacked.
if you still want to implement auto-registration, simply change the PS_UserData.dbo.usp_Try_GameLogin_Taiwan stored procedure
one possible version of your current script can be:
Code:
USE [PS_UserData]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER Proc [dbo].[usp_Try_GameLogin_Taiwan]
@UserID varchar(18),
@InPassword varchar(32),
@SessionID bigint,
@UserIP varchar(15),
@UserUID int = -1,
@LoginType smallint = 1,
@LoginTime datetime = NULL
AS
SET NOCOUNT ON
DECLARE
@Status smallint,
@Leave tinyint,
@LeaveDate datetime
/*==================================================
-1 Invalid ID and Password
-2 Can't connect with the account since it's not selected as free challenger
-3 Account doesn't exist
-4 ID inprocess of termination follwing user's request.
-5 Your account is blocked now. You can't log into the game.
-6 Your account is blocked now. You can't log into the game.
-7 Account still restricted
==================================================*/
SET @Status = -1
SET @LoginTime = GETDATE()
--------------------------------------------------
SELECT @UserUID=[UserUID], @Status=[Status], @Leave=[Leave], @LeaveDate=LeaveDate
FROM Users_Master
WHERE UserID = @UserID AND Pw = @InPassword
-- NotExist User OR Leave User
IF( @UserUID = -1) -- !! some scripts test 0 while above default value is -1
BEGIN
SET @Status = -3
END
ELSE IF (@Leave = 1) --This blocks a logged in account from being kicked
BEGIN
SET @Status = -5
END
ELSE IF (DATEDIFF(SECOND, @LeaveDate, GETDATE()) < 6)--This is the time delay
BEGIN
SET @Status = -7
END
-- BlockUser Check
IF( (@Status >= 2) AND (@Status <= 6) )
BEGIN
-- Get Block Limit Date AND Replace date text
DECLARE @BlockEndDate datetime
SELECT @BlockEndDate = BlockEndDate FROM Users_Block WHERE UserUID = @UserUID
IF ( @@ROWCOUNT <> 0 )
BEGIN
-- Block Release
IF (@BlockEndDate <= @LoginTime)
BEGIN
SET @Status = 0
UPDATE Users_Master SET Status=@Status WHERE UserUID=@UserUID
END
END
END
-- Select
SELECT @Status AS Status, @UserUID AS UserUID
-- Log Insert
IF (@Status=0 OR @Status=16 OR @Status=32 OR @Status=48 OR @Status=64 OR @Status=80)
BEGIN
UPDATE Users_Master SET Leave=1, JoinDate=GETDATE() WHERE UserUID=@UserUID
END
SET NOCOUNT OFF
change it to be: (part of PS_UserData.dbo.usp_Try_GameLogin_Taiwan)
Code:
-- try to select user by name,password
SELECT @UserUID=[UserUID], @Status=[Status], @Leave=[Leave], @LeaveDate=LeaveDate
FROM Users_Master
WHERE UserID = @UserID AND Pw = @InPassword
-- NotExist User OR Leave User
IF (@UserUID = -1) -- account does not exist, will create it
BEGIN
-- define unique ID of new account
select @UserUID=isnull(max(UserUID),0)+1 FROM Users_Master
set @Status = 0
-- auto-register new account
INSERT INTO Users_Master ([UserUID],[UserID],[Pw],[JoinDate],[Status])
VALUES (@UserUID,@UserID,@InPassword,GETDATE(),@Status)
END
-- Select responses
SELECT @Status AS Status, @UserUID AS UserUID
full:
Code:
USE [PS_UserData]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER Proc [dbo].[usp_Try_GameLogin_Taiwan]
@UserID varchar(18),
@InPassword varchar(32),
@SessionID bigint,
@UserIP varchar(15),
@UserUID int = -1,
@LoginType smallint = 1,
@LoginTime datetime = NULL
AS
SET NOCOUNT ON
DECLARE
@Status smallint,
@Leave tinyint,
@LeaveDate datetime
/*==================================================
-1 Invalid ID and Password
-2 Can't connect with the account since it's not selected as free challenger
-3 Account doesn't exist
-4 ID inprocess of termination follwing user's request.
-5 Your account is blocked now. You can't log into the game.
-6 Your account is blocked now. You can't log into the game.
-7 Account still restricted
==================================================*/
SET @Status = -1
SET @LoginTime = GETDATE()
-- ------------------------------------------------
SELECT @UserUID=[UserUID], @Status=[Status], @Leave=[Leave], @LeaveDate=LeaveDate
FROM Users_Master
WHERE UserID = @UserID AND Pw = @InPassword
-- NotExist User OR Leave User
IF (@UserUID = -1) -- account does not exist, will create it
BEGIN
-- define unique ID of new account
select @UserUID=isnull(max(UserUID),0)+1 FROM Users_Master
--
set @Status = 0
-- auto-register new account
INSERT INTO Users_Master ([UserUID],[UserID],[Pw],[JoinDate],[Status])
VALUES (@UserUID,@UserID,@InPassword,GETDATE(),@Status)
END
ELSE IF (@Leave = 1) -- This blocks a logged in account from being kicked
BEGIN
SET @Status = -5
END
-- ELSE IF (DATEDIFF(SECOND, @LeaveDate, GETDATE()) < 6)--This is the time delay
-- BEGIN
-- SET @Status = -7
-- END
-- BlockUser Check
IF( (@Status >= 2) AND (@Status <= 6) )
BEGIN
-- Get Block Limit Date AND Replace date text
DECLARE @BlockEndDate datetime
SELECT @BlockEndDate = BlockEndDate FROM Users_Block WHERE UserUID = @UserUID
IF ( @@ROWCOUNT <> 0 )
BEGIN
-- Block Release
IF (@BlockEndDate <= @LoginTime)
BEGIN
SET @Status = 0
UPDATE Users_Master SET Status=@Status WHERE UserUID=@UserUID
END
END
END
-- Select
SELECT @Status AS Status, @UserUID AS UserUID
-- Log Insert
IF (@Status=0 OR @Status=16 OR @Status=32 OR @Status=48 OR @Status=64 OR @Status=80)
BEGIN
UPDATE Users_Master SET Leave=1, JoinDate=GETDATE() WHERE UserUID=@UserUID
END
SET NOCOUNT OFF
I said, auto-reg is (can be) quite easy, don't forget that it's even more easy to introduce mistakes. if your login process fails, verify *all* tests & write operations made on the PS_UserData.dbo.usp_Try_GameLogin_Taiwan and PS_UserData.dbo.usp_Try_GameLogout_R procedures to find out the errors.
but fortunately, login (with or without registration) only depends on invoked SP - it does not depend on your client game nor on the server ps_game (as long as the server components do use the SP listed herebefore).