Erreur du plugin phpsend (bukkit)
Résolu
bartimus37
Messages postés
301
Statut
Membre
-
bartimus37 Messages postés 301 Statut Membre -
bartimus37 Messages postés 301 Statut Membre -
Bonjours j'ai une erreur :
Fatal error: Class 'PHPSend' not found in /home/minebill/public_html/test.php on line 3
suite à l'utilisation de ce script (j'ai bien changer les valeur adresse mdp et port)
<?php
include_once("PHPSend.php");
$con = new PHPSend();
$succ = $arr[$i]->PHPSconnect("adresse","mdp","port");
$con->PHPScommand("say Server says Hello!");
$con->PHPScommand("say Server sets time to Day!");
$con->PHPScommand("time day");
$succ = $con->PHPSdisconnect();
?>
Fatal error: Class 'PHPSend' not found in /home/minebill/public_html/test.php on line 3
suite à l'utilisation de ce script (j'ai bien changer les valeur adresse mdp et port)
<?php
include_once("PHPSend.php");
$con = new PHPSend();
$succ = $arr[$i]->PHPSconnect("adresse","mdp","port");
$con->PHPScommand("say Server says Hello!");
$con->PHPScommand("say Server sets time to Day!");
$con->PHPScommand("time day");
$succ = $con->PHPSdisconnect();
?>
4 réponses
-
Bonjour, je viens de trouver d'où venait votre erreur, c'est un truc tout bête:
https://pastebin.com/RKgxXJi4 Regardez ligne 75, lors de la déclaration de la classe, on voit PHPSsend avec un "s" en trop, il vous suffit d'enlever ce "s" minuscule en trop.
Si tout fonctionne bien (normalement ça devrait ^^), passez ce sujet en "résolu". -
Bonjour, pouvez-vous nous donner le code se trouvant dans le fichier PHPSend.php ?
L'erreur signifie que vous utilisez une classe qui n'existe pas.-
<?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 PHPSsend { 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 mais j'ai encore un erreur :
Fatal error: Call to a member function PHPSconnect() on a non-object in /home/minebill/public_html/test.php on line 4 -