// msnp_status.php version 1.00
// Copyright (c) 2004 TAKEDA Hiroyuki
//
$login_id = 'kusuli@hotmail.com'; // チェック用のアカウント
$passwd = '********'; // そのパスワード
$check_id = 'leiqunni@hotmail.com'; // チェックするアカウント
//
if ( $lid != '' ) $login_id = $lid;
if ( $psw != '' ) $passwd = $psw;
if ( $cid != '' ) $check_id = $cid;
//
$ds = 'messenger.hotmail.com';
$port = '1863';
$TrID = 0;
// ソケット接続
$fp = fsockopen( $ds, $port, $errno, $errstr, 30 );
//
fputs( $fp, "VER " . $TrID ++ . " MSNP8 CVR0\r\n" );
$buffer = fgets( $fp, 256 );
fputs( $fp, "CVR " . $TrID ++ . " 0x0409 win 4.10 i386 MSNMSGR 5.0.0544 MSMSGS $login_id \r\n" );
$buffer = fgets( $fp, 256 );
fputs( $fp, "USR " . $TrID ++ . " TWN I $login_id \r\n" );
$buffer = fgets( $fp, 256 );
list( $cmd, $trid, $xfr, $ns, $buffer ) = split( ' ', $buffer );
list( $ns, $port ) = split( ':', $ns );
fclose( $fp );
// ソケット接続
$fp = fsockopen( $ns, $port, $errno, $errstr, 30 );
//
fputs( $fp, "VER " . $TrID ++ . " MSNP8 CVR0\r\n" );
$buffer = fgets( $fp, 256 );
fputs( $fp, "CVR " . $TrID ++ . " 0x0409 win 4.10 i386 MSNMSGR 5.0.0544 MSMSGS $login_id \r\n" );
$buffer = fgets( $fp, 256 );
fputs( $fp, "USR " . $TrID ++ . " TWN I $login_id \r\n" );
$buffer = fgets( $fp, 256 );
list( $cmd, $trid, $twn, $s, $param ) = split( ' ', $buffer );
$auth = "Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in=$login_id,pwd=$passwd,$param";
// ソケット接続
$fp2 = fsockopen( 'ssl://loginnet.passport.com', 443, $errno, $errstr, 5 );
fputs( $fp2, "GET /login2.srf HTTP/1.0\r\nAuthorization: $auth\r\n" );
$header .= fread( $fp2, 65536 );
fclose( $fp2 );
//
list( $buff1, $buff2 ) = split( ",from-PP='", $header );
list( $buff1, $buff2 ) = split( "',ru=http:", $buff2 );
fputs( $fp, "USR " . $TrID ++ . " TWN S $buff1 \r\n" );
$buffer = fread( $fp, 65536 );
fputs( $fp, "SYN " . $TrID ++ . " 0 \r\n" );
$buffer = fread( $fp, 65536 );
list( $syn, $trid, $ver, $list, $group ) = split( ' ', $buffer );
fputs( $fp, "CHG " . $TrID ++ . " NLN \r\n" );
$buffer = fread( $fp, 65536 );
while ( 1 ) {
$buffer = fgets( $fp, 1024 );
if ( ereg( "^ILN", $buffer ) ) {
list( $iln, $trid, $status, $account, $nickname, $param ) = split( ' ', $buffer );
if ( $status == 'NLN' and $account == $check_id ) {
echo '';
exit;
}
}
if ( ereg( "^MSG Hotmail", $buffer ) ) {
echo '';
exit;
}
}
?>