← Back to DevelopmentAging & Mixing viewer.dll generatorProgramsClan filesInternet Information ServiceOllyDbg tutorialsMiscellaneousSkinsLinks / Files

log_user_connections

← Back to Miscellaneous
/!\ This guide assumes that your clan.dll is working correctly and feeding the CT table inside the ClanDB database. /!\

When people connect to the server, their info is added to the CT table via the clan.dll, using this query :

Hexadecimal - clan.dll



We can redirect the data submitted into two different tables (CT, and a new one to keep a trace of people connections) with a stored procedure.

1. Creating the new table
For this guide I'll use a new database named ExtraDB and a new table named Login. Here's the table structure :

tsql

CREATE TABLE [dbo].[login](
        [id] [int] IDENTITY(1,1) NOT NULL,
        [account] [varchar](50) NOT NULL,
        [character] [varchar](50) NOT NULL,
        [ip] [varchar](50) NOT NULL,
        [date] [datetime] NOT NULL
)


2. Creating the new procedure
The procedure is created for the ClanDB database. You simply need to execute this query inside the database :

tsql

CREATE PROCEDURE update_ct @account VARCHAR(25), @character VARCHAR(50), @ip VARCHAR(20), @server VARCHAR(50), @serial INT
AS
        DELETE FROM [clandb].[dbo].[ct] WHERE [chname] = @character

        INSERT INTO [clandb].[dbo].[ct] ([userid], [chname], [ip], [servername], [sno], [logontime]) VALUES(@account, @character, @ip, @server, @serial, GETDATE())

        INSERT INTO [extradb].[dbo].[login] ([account], [character], [ip], [date]) VALUES(@account, @character, @ip, GETDATE())
GO
 


When the procedure is executed, it :
* clean lines with the same character name
* insert a new line into the CT table
* logs the connection into the Login table

3. Editing the clan.dll
Now that we have created our procedure, we need to edit the clan.dll file so it executes the procedure.
We need to replace the old query with this one :

tsql

EXEC [clandb].[dbo].[update_ct] '%s','%s','%s','%s','%d'


Like that :

Hexadecimal - clan.dll



4. .dll generator
The clan.dll file with the procedure has been added to the .dll generator under the name clan-procedure.dll :)