CREATE PROCEDURE ACCOUNT_LOGIN
@AccountID varchar(21),
@Password varchar(13),
@nRet smallint OUTPUT
AS
DECLARE @char1 varchar(21),@char2 varchar(21),@char3 varchar(21)
DECLARE @izin1 int,@izin2 int,@izin3 int
-- Merhaba Efendim , Isminiz ?
Select @char1 = strCharID1 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
Select @char2 = strCharID2 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
Select @char3 = strCharID3 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
-- HoHoHo .. Merhabalar.Izin varmı geçmeye ?
-- Dur bir Dakika Banlanıp Banlanmadığını Kontrol Edem
Select @izin1 = Authority FROM USERDATA WHERE strUserID = @char1
Select @izin2 = Authority FROM USERDATA WHERE strUserID = @char2
Select @izin3 = Authority FROM USERDATA WHERE strUserID = @char3
--Banlanmışsınya Şerefsiz xD
IF @izin1 = 255 OR @izin2 = 255 OR @izin3 = 255
BEGIN
Set @nRet = 4
RETURN
END
delete from currentuser where straccountid = @AccountID
select @nRet = count(straccountid) from tb_user where straccountid = @AccountID
if @nRet = 0
begin
insert into tb_user (straccountid, strpasswd, strSocNo, idays) values (@AccountID, @password, 1, '6')
end
DECLARE @Nation tinyint, @CharNum smallint
SET @Nation = 0
SET @CharNum = 0
DECLARE @pwd varchar(13)
SET @pwd = null
SELECT @pwd = strPasswd FROM [dbo].[TB_USER] WHERE strAccountID = @AccountID and idays=6
IF @pwd IS null
BEGIN
SET @nRet = 0
RETURN
END
ELSE IF @pwd <> @Password
BEGIN
SET @nRet = 0
RETURN
END
DECLARE @PremiumServiceDEC varchar(21)
select @PremiumServiceDEC = count(straccountid) FROM premium_service WHERE strAccountID = @AccountID
if @PremiumServiceDEC = 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
RETURN
END
GO