estou aqui hoje para postar para vocês a solução do problema de player continuar logado mesmo depois de ter saido da conta.
Aconselho a fazer BACKUP antes de começar.
Primeiro passo e apagar o que vamos criar depois fixado!
Código:
_______________________________________________________________________
1. Apague a WZ_CONNECT_MEMB & WZ_DISCONNECT_MEMB de Stored Procedures.
2. Apague a tabela MEMB_STAT
_______________________________________________________________________________________
Depois que você apagou, execute a primeira query para criar a Procedure WZ_CONNECT_MEMB.
_______________________________________________________________________________________
CREATE PROCEDURE WZ_CONNECT_MEMB
@uid varchar(20),
@server varchar(20),
@uip varchar(20)
AS
Begin
BEGIN TRANSACTION
SET NOCOUNT ON
IF EXISTS ( SELECT memb___id FROM MEMB_STAT WITH (READUNCOMMITTED)
WHERE memb___id = @uid )
Begin
UPDATE MEMB_STAT
SET ip = @uip , connectstat = 1 , servername = @server , ConnectTM = (getdate())
WHERE memb___id = @uid
End
ELSE
Begin
INSERT INTO MEMB_STAT ( memb___id,ip,connectstat,servername) valueS (
@uid,
@uip,
1,
@server
)
End
IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
SET NOCOUNT OFF
End
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO
__________________________________________________________________________
Agora execute essa segunda query para criar a procedure WZ_DISCONNECT_MEMB.
__________________________________________________________________________
CREATE PROCEDURE WZ_DISCONNECT_MEMB
@uid varchar(20)
AS
Begin
BEGIN TRANSACTION
SET NOCOUNT ON
IF EXISTS ( SELECT memb___id FROM MEMB_STAT WITH (READUNCOMMITTED)
WHERE memb___id = @uid )
Begin
UPDATE MEMB_STAT
SET DisConnectTM = (getdate()), connectstat = 0 WHERE memb___id = @uid
End
ELSE
Begin
INSERT INTO MEMB_STAT ( memb___id,DisConnectTM,connectstat) valueS (
@uid,
(getdate()),
0
)
End
IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
SET NOCOUNT OFF
End
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
___________________________________________________________________________
E por ultimo rode a ultima query para criar a tabela MEMB_STAT
__________________________________________________________________________
CREATE TABLE [dbo].[MEMB_STAT] (
[memb___id] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[ConnectStat] [tinyint] NULL ,
[serverName] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[iP] [nvarchar] (15) COLLATE Chinese_PRC_CI_AS NULL ,
[ConnectTM] [smalldatetime] NULL ,
[DisConnectTM] [smalldatetime] NULL
) ON [PRIMARY]
GO
___________________________________________________________________________
Problema solucionado!
Espero que gostem.
Creditos:
Querys: @meirim
Tutorial: @HumbertoS
eu por trazer a XPZONE
gostou ? e sor agradecer ...
Aconselho a fazer BACKUP antes de começar.
Primeiro passo e apagar o que vamos criar depois fixado!
Código:
_______________________________________________________________________
1. Apague a WZ_CONNECT_MEMB & WZ_DISCONNECT_MEMB de Stored Procedures.
2. Apague a tabela MEMB_STAT
_______________________________________________________________________________________
Depois que você apagou, execute a primeira query para criar a Procedure WZ_CONNECT_MEMB.
_______________________________________________________________________________________
CREATE PROCEDURE WZ_CONNECT_MEMB
@uid varchar(20),
@server varchar(20),
@uip varchar(20)
AS
Begin
BEGIN TRANSACTION
SET NOCOUNT ON
IF EXISTS ( SELECT memb___id FROM MEMB_STAT WITH (READUNCOMMITTED)
WHERE memb___id = @uid )
Begin
UPDATE MEMB_STAT
SET ip = @uip , connectstat = 1 , servername = @server , ConnectTM = (getdate())
WHERE memb___id = @uid
End
ELSE
Begin
INSERT INTO MEMB_STAT ( memb___id,ip,connectstat,servername) valueS (
@uid,
@uip,
1,
@server
)
End
IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
SET NOCOUNT OFF
End
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO
__________________________________________________________________________
Agora execute essa segunda query para criar a procedure WZ_DISCONNECT_MEMB.
__________________________________________________________________________
CREATE PROCEDURE WZ_DISCONNECT_MEMB
@uid varchar(20)
AS
Begin
BEGIN TRANSACTION
SET NOCOUNT ON
IF EXISTS ( SELECT memb___id FROM MEMB_STAT WITH (READUNCOMMITTED)
WHERE memb___id = @uid )
Begin
UPDATE MEMB_STAT
SET DisConnectTM = (getdate()), connectstat = 0 WHERE memb___id = @uid
End
ELSE
Begin
INSERT INTO MEMB_STAT ( memb___id,DisConnectTM,connectstat) valueS (
@uid,
(getdate()),
0
)
End
IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
SET NOCOUNT OFF
End
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
___________________________________________________________________________
E por ultimo rode a ultima query para criar a tabela MEMB_STAT
__________________________________________________________________________
CREATE TABLE [dbo].[MEMB_STAT] (
[memb___id] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[ConnectStat] [tinyint] NULL ,
[serverName] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[iP] [nvarchar] (15) COLLATE Chinese_PRC_CI_AS NULL ,
[ConnectTM] [smalldatetime] NULL ,
[DisConnectTM] [smalldatetime] NULL
) ON [PRIMARY]
GO
___________________________________________________________________________
Problema solucionado!
Espero que gostem.
Creditos:
Querys: @meirim
Tutorial: @HumbertoS
eu por trazer a XPZONE
gostou ? e sor agradecer ...
Editado por um moderador: