<?php class GG { const P_LOGIN80 = 0x0031; const P_HEADER_L = 8; // DLUGOSC HEADERA PAKIETU const GG_VERSION = 'Gadu-Gadu Client build 10.0.0.10450'; function __construct($NUMER, $HASLO) { // ZAPISUJEMY NUMER I HASLO $this->NUMER = $NUMER; $this->HASLO = $HASLO; // POBIERANIE ADRESU I PORTU SERWERA GG $odpowiedz = file_get_contents('http://appmsg.gadu-gadu.pl/appsvc/appmsg.asp?fmnumber='.$this->NUMER.'&version=8.0.0.7669'); $this->ADRES = $wynik[1]; $this->PORT = $wynik[2]; } private function PobierzPakiet() { return $wynik_docelowy; } private function WyslijPakiet($id, $pakiet) { } function ZakodujHaslo2($haslo, $klucz) { $x0=0; $x1=0; $y0=0; $y1=0; $z=0; $tmp=0; $y0 = ($klucz << 16) >> 16; $y1 = $klucz >> 16 ; for ($i=0; $i<strlen($haslo); $i++) { $x0 = ($x0 & 0xFF00) | ord($haslo[$i]); $x1 &= 0xFFFF; $y0 ^= $x0; $y1 ^= $x1; $y0 += $x0; $y1 += $x1; $x1 <<= 8; $x1 |= ($x0 >> 8); $x0 <<= 8; $y0 ^= $x0; $y1 ^= $x1; $x1 <<= 8; $x1 |= ($x0 >> 8); $x0 <<= 8; $y0 -= $x0; $y1 -= $x1; $x1 <<= 8; $x1 |= ($x0 >> 8); $x0 <<= 8; $y0 ^= $x0; $y1 ^= $x1; $z = $y0 & 0x1F; $y0 &= 0xFFFF; $y1 &= 0xFFFF; if ( $z <= 16 ) { $tmp= ($y1 << $z) | ($y0 >> (16-$z)); $y0 = ($y1 >> (16-$z)) | ($y0 << $z); $y1 = $tmp; } else { $tmp= $y0 << ($z-16); $y0 = ($y0 >> (32-$z)) | ( (($y1 << $z) >> $z) << ($z-16) ); $y1 = ($y1 >> (32-$z)) | $tmp; } $y0 &= 0xFFFF; $y1 &= 0xFFFF; } return $hash; } public function Loguj() { // LACZYMY SIE Z SERWEREM GG $odpowiedz = $this->PobierzPakiet(); $ZakodowaneHaslo = $this->ZakodujHaslo2($this->HASLO, $ziarno['ziarno']); $this->NUMER, 'pl', 0x01, $ZakodowaneHaslo, 0x0002, 0, 0x00000007, 0, 0, 0, 0, 100, 0x64, 0x23, 'Gadu-Gadu Client build 10.0.0.10450', 0 ); $this->WyslijPakiet(self::P_LOGIN80, $pakiet); $wiad = 'czesc'; } }
Pomoże ktoś bardziej ogarnięty?