Erreur PHPSend

bartimus37

Aventurier
9 Novembre 2012
5
0
1
27
Bonjours, après installation de phpsend je l'ai tester mais j'ai l'erreur :
Fatal error: Call to a member function PHPSconnect() on a non-object in /home/minebill/public_html/test.php on line 4
test.php :
Code:
<?php
include_once("PHPSend.php");
$con = new PHPSend();
$succ = $arr[$i]->PHPSconnect("mine-bill.servegame.com","3fe7bc7294585a59","11223");
$con->PHPScommand("say Server says Hello!");
$con->PHPScommand("say Server sets time to Day!");
$con->PHPScommand("time day");
$succ = $con->PHPSdisconnect();
?>
PHPSend.php :
Code:
<?php
 
 
 
include("PHPSendConf.php");
 
 
 
class PHPSresponse
 
{
 
    var $msg;
 
    var $from;
 
   
 
    function isFrom($who)
 
    {
 
        if ($who==$from)
 
            return true;
 
        else
 
            return false;
 
    }
 
}
 
 
 
function recv($socket)
 
{
 
    $r=socket_read($socket, 256, PHP_NORMAL_READ);
 
    return substr($r,0,-1);
 
}
 
 
 
function PHPSauth($pass)
 
{
 
    global $PHPSpassword, $PHPSuseWhitelist, $PHPSpostPassword, $PHPSwhitelist;
 
   
 
    $from=$_SERVER['REMOTE_ADDR'];
 
    if ($PHPSuseWhitelist && !in_array($from,$PHPSwhitelist))
 
        return 1;
 
    if ($pass==sha1($PHPSpostPassword))
 
        return 0;
 
    else
 
        return 2;
 
}
 
 
 
class PHPSend
 
{
 
    var $socket=null;
 
   
 
    function PHPSconnect($adress, $password, $port=11223)
 
    {
 
        $this->socket = socket_create(AF_INET, SOCK_STREAM, 0);
 
       
 
        socket_set_block($this->socket);
 
       
 
        $result = socket_connect($this->socket, $adress, $port);
 
       
 
        if ($this->socket==null)
 
                return 1;
 
       
 
        socket_write($this->socket, sha1($password)."\n", strlen(sha1($password))+2); //auth
 
        $result=recv($this->socket);
 
       
 
        if ($result=="PHPSpass0")
 
            return 0;
 
        else if ($result=="PHPSpass1")
 
            return 2;
 
        else if ($result=="PHPSpass2")
 
            return 3;
 
        else if ($result=="PHPSbusy")
 
            return 4;
 
        else
 
            return 5;
 
    }
 
   
 
    function PHPScommand($command)
 
    {
 
        socket_write($this->socket, "[server]\n",10);
 
        socket_write($this->socket, $command."\n",strlen($command)+2);
 
        $result=recv($this->socket);
 
       
 
        if ($result!="PHPScmd0")
 
            return 1;
 
        return 0;
 
    }
 
   
 
    function PHPScommandAsPlayer($player,$command)
 
    {
 
        socket_write($this->socket, $player."\n",strlen($player)+2);
 
        socket_write($this->socket, $command."\n",strlen($command)+2);
 
        $result=recv($this->socket);
 
       
 
        if ($result!="PHPScmd0")
 
            return 1;
 
        return 0;
 
    }
 
   
 
    function PHPSdisconnect()
 
    {
 
        socket_write($this->socket, "[server]\n",10);
 
        socket_write($this->socket, "PHPSdisconnect\n",15);
 
        $result=recv($this->socket);
 
       
 
        if ($result!="PHPSdisconnect0")
 
            return 1;
 
        return 0;
 
    }
 
   
 
    function PHPSrecv()
 
    {
 
        $result=recv($this->socket);
 
        $resp=explode(':',$result,2);
 
        $r=new PHPresponse();
 
        $r->from=$resp[0];
 
        $r->msg=$resp[1];
 
        return $r;
 
    }
 
   
 
    function PHPSrecvMsg()
 
    {
 
        $result=recv($this->socket);
 
        $resp=explode(':',$result,2);
 
        return $resp[1];
 
    }
 
}
 
 
 
?>
Merci d'avance
 
Bonjours résolut à la ligne 4 c'était
$succ = $con->PHPSconnect("serveur","mdp","port");
Mon serveur est bien en marche aucune erreur de log
mon fichier PHPSendConf.php :
Code:
<?php
 
 
 
$PHPSpassword="mdp";
 
$PHPSpostPassword="mdp";
 
$PHPSuseWhitelist=true;
 
$PHPSwhitelist=array
 
        (
 
            "serveur"
 
        );
 
?>

mon fichier de config du plugin :
Code:
password: mdp
postPassword: mdp
postDataUrl: http://localhost/post.php
port: 11223
logLevel: 2
useWhitelist: false
postPrint: true
maxThreads: 10
Maintenant j'ai ça comme erreur :

Warning: socket_connect() [function.socket-connect]: unable to connect [110]: Connection timed out in /home/minebill/public_html/PHPSend.php on line 48

Warning: socket_write() [function.socket-write]: unable to write to socket [32]: Broken pipe in /home/minebill/public_html/PHPSend.php on line 53

Warning: socket_read() [function.socket-read]: unable to read from socket [107]: Transport endpoint is not connected in /home/minebill/public_html/PHPSend.php on line 21

Warning: socket_write() [function.socket-write]: unable to write to socket [32]: Broken pipe in /home/minebill/public_html/PHPSend.php on line 70

Warning: socket_write() [function.socket-write]: unable to write to socket [32]: Broken pipe in /home/minebill/public_html/PHPSend.php on line 71

Warning: socket_read() [function.socket-read]: unable to read from socket [107]: Transport endpoint is not connected in /home/minebill/public_html/PHPSend.php on line 21

Warning: socket_write() [function.socket-write]: unable to write to socket [32]: Broken pipe in /home/minebill/public_html/PHPSend.php on line 70

Warning: socket_write() [function.socket-write]: unable to write to socket [32]: Broken pipe in /home/minebill/public_html/PHPSend.php on line 71

Warning: socket_read() [function.socket-read]: unable to read from socket [107]: Transport endpoint is not connected in /home/minebill/public_html/PHPSend.php on line 21

Warning: socket_write() [function.socket-write]: unable to write to socket [32]: Broken pipe in /home/minebill/public_html/PHPSend.php on line 70

Warning: socket_write() [function.socket-write]: unable to write to socket [32]: Broken pipe in /home/minebill/public_html/PHPSend.php on line 71

Warning: socket_read() [function.socket-read]: unable to read from socket [107]: Transport endpoint is not connected in /home/minebill/public_html/PHPSend.php on line 21

Warning: socket_write() [function.socket-write]: unable to write to socket [32]: Broken pipe in /home/minebill/public_html/PHPSend.php on line 92

Warning: socket_write() [function.socket-write]: unable to write to socket [32]: Broken pipe in /home/minebill/public_html/PHPSend.php on line 93

Warning: socket_read() [function.socket-read]: unable to read from socket [107]: Transport endpoint is not connected in /home/minebill/public_html/PHPSend.php on line 21


Si sa peut avoir un rapport j'ai ouvert le port 11223 sur ma box et mon parefeu ainsi que le port 25565