Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 12.04.2007, 20:11   #16
khelben
Архивный участник
 
Join Date: Mar 2006
Posts: 104
Default

Ok.

Here's what i did.

First, modify your USER_ACCOUNT table in lin2db.

Add a column 'auth_login' as datetime

create the following stored proc in lin2db

[lin2db].[dbo].[ap_Online]
Code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


ALTER PROCEDURE [dbo].[ap_Online] 
@uid int
AS
SET NOCOUNT ON

UPDATE user_account SET auth_login=GETDATE() WHERE uid=@uid

SET NOCOUNT OFF

SELECT uid FROM user_account with (nolock) WHERE uid=@uid
Alter the following stored procs in lin2world

[lin2world].[dbo].[lin_CharLogin]
Code:
ALTER PROCEDURE [dbo].[lin_CharLogin]
(
	@char_id	INT,
	@path  varchar(64) = 'C:\php\php.exe'
)
AS

SET NOCOUNT ON

UPDATE user_data SET login = GETDATE() WHERE char_id = @char_id


if (SELECT datediff(ss, isnull(auth_login, 0), getdate()) FROM lin2db.dbo.user_account WHERE uid = (SELECT account_id FROM lin2world.dbo.user_data WHERE char_id = @char_id)) > 30
begin

	--I couldn't get sky's sp_l2kick.dll to work, so i went this route
	set @path= @path +' -f C:\php\kick.php ' +convert(varchar(5),@char_id)
	EXEC xp_cmdshell @path;
	RETURN -1

end
alter this proc, also in lin2world

[lin2world].[dbo].[lin_CharLogout]
Code:
ALTER PROCEDURE [dbo].[lin_CharLogout]
(    
 @char_id INT,    
 @usedTimeSec INT
)    
AS    
    
SET NOCOUNT ON    
    
DECLARE @logoutDate DATETIME    
SET @logoutDate = GETDATE()    
    
UPDATE user_data SET Logout = @logoutDate, use_time = use_time + @usedTimeSec WHERE char_id = @char_id
UPDATE lin2db..user_account SET auth_login=GETDATE() WHERE uid=(SELECT account_id from user_data where char_id = @char_id)

SET NOCOUNT OFF
you'll also need to put this kick php somewhere, don't forget to adjust the charlogin stored proc to properly point to it.

kick.php
Code:
<?php

//----Convert string to unicode---- >
function tounicode($string){
    $rs="";
	for($i=0;$i<strlen($string);$i++)
		$rs.=$string[$i].chr(0);
    return($rs.chr(0).chr(0));}
//<<<

function KickCharacterPacket($char_id){
	$buf=pack("cV",5,$char_id).tounicode("HACK Detect");
	$cachedsocket=@fsockopen("127.0.0.1","2012",$errno,$errstr,1) or die($notconnected);
	fwrite($cachedsocket,pack("s",(strlen($buf)+2)).$buf);
	$len=unpack("v",fread($cachedsocket,2));$rid=unpack("c",fread($cachedsocket,1));
	for($i=0;$i<(($len[1]-4)/4);$i++){$read=unpack("i",fread($cachedsocket,4));$rs.=$read[1];}
	fclose($cachedsocket);return $rs;}

$a = KickCharacterPacket($argv[1]);
if(!$a){
	echo 'some errors ocured!';
}else{
	echo 'Successed!';
}

?>
also use the authd i shared in an earlier post.
that should about cover it.

you must have the following set in your config.txt:

UserData=True

http://www.2shared.com/file/1836692/...5/L2AuthD.html

http://rapidshare.com/files/25634619/L2AuthD.rar.html
khelben is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 22:21.