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 10.04.2007, 19:13   #11
Le][u$
Архивный участник
 
Join Date: Aug 2006
Posts: 57
Default My fix

I can't bye some *.dll for my server to prevent this bug completly, and i do that:
1. Add custom field in lin2db (in my db it's "online") with INT value.
2. I use hAuthd by Hint and set online = 1 when user logged on (or you can use Authd with modded query
Code:
"SELECT user_data FROM user_data WITH (nolock) WHERE uid = %d"
=>
Code:
"UPDATE user_account SET online = 1 WHERE uid = %d"
. You can find it near 0046752C. Tested. Work normal (but in console Authd: "Fetch error -1" when login).
3.
Code:
ALTER PROCEDURE [dbo].[lin_GetUnreadMailCount]
(
	@char_id		int,
	@path  varchar(64) = 'C:\php\php.exe'
)
AS
SET NOCOUNT ON

SELECT COUNT(*)
FROM user_mail_receiver(NOLOCK)
WHERE receiver_id = @char_id
	AND mailbox_type = 0
	AND read_status = 0;

if (SELECT online FROM lin2db.dbo.user_account WHERE uid = (SELECT account_id FROM lin2world.dbo.user_data WHERE char_id = @char_id))<>1
begin
	set @path= @path +' C:\php\kick.php id=' +convert(varchar(5),@char_id)
	EXEC xp_cmdshell @path
	RETURN -1	
end
kick.php
Code:
<?
#$char_id=$_GET['id'];

//----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){
	include("config.php");$buf=pack("cV",5,$char_id).tounicode("admin");
	$cachedsocket=@fsockopen($cached['host'],$cached['port'],$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 GetError($rs);}

$a = KickCharacterPacket($char_id);
if(!$a){
	echo 'some errors ocured!';
}else{
	echo 'Successed!';
}
?>
thats all. if you can optimized it and/or can add some stuff for it, or you known how to do this better => plz post it there!
Le][u$ 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 17:19.