Hallo
Ich habe probiert eine von mir geschriebene PHP Klasse in Java umzuschreiben aber ich bekomm es auch nach vielem probieren nicht hin.
Das sind die methoden die mir teils noch fehlen.
Also _getLoginSeed() fehlt noch komplett und in connect() noch das was mit _getLoginSeed() zusammenhängt.
Kann mir da jemand helfen?
Natürlich braucht man auch PHP Kenntnisse.
Danke für die Hilfe
Ich habe probiert eine von mir geschriebene PHP Klasse in Java umzuschreiben aber ich bekomm es auch nach vielem probieren nicht hin.
Code:
/*
* Connect and Autheticate to the Server
*/
function connect($ip,$port,$pass){
$this->CON=fsockopen($ip,$port,$errno,$errstr,$this->TIMEOUT);
if(!$this->CON){
return $errstr."(".$errno.")";
}else{
socket_set_blocking($this->CON,false);
$seed=$this->_getLoginSeed();
if($this->debug)
echo "Seed: [".$seed."]
";
$crypt=$seed.$pass;
$cryptkey=md5($crypt);
$cmd="login ".$cryptkey;
$this->sendCommand($cmd);
$response=$this->getResponse();
if(strlen(strstr($response,"successful"))>3){
if($this->debug)
echo "Logged in!
";
return true;
}else{
if($this->debug)
echo "Failed to log in!
";
return false;
}
}
}
/*
* get and parse the Login Seed
*/
function _getLoginSeed(){
if(!$this->CON){
if($this->debug)
echo "No connection opened!
";
return false;
}
$result="";
$done=false;
while(!$done){
$data=fgets($this->CON,1024);
for($i=0;$i<strlen($data);$i++){
$result.=$data[$i];
}
if(strpos($result,"\x0a\x0a"))
break;
}
$seed=strstr($result,"seed:");
return substr($seed,6,16);
}
Das sind die methoden die mir teils noch fehlen.
Also _getLoginSeed() fehlt noch komplett und in connect() noch das was mit _getLoginSeed() zusammenhängt.
Kann mir da jemand helfen?
Natürlich braucht man auch PHP Kenntnisse.
Danke für die Hilfe