Php Command
#1

Hi everybody, i just have a php script to send Rcon commands to the server.

The thing is, if i send "say lalala", players see the command, but it's not printed in the console.

The code is this:

PHP код:
<?
 set_time_limit 
(30) ;
 
$ip $_POST['ip']; if (!$ip) die();
 
$port $_POST['port']; if (!$port) die();

 
$pass $_POST['pass']; if (!$pass) die();
 
$passlen strlen($pass);
 
$cmd $_POST['cmd']; if (!$cmd) die();
 
$cmdlen strlen($cmd);

 
$packet 'SAMP';
 
$packet .= chr(strtok($ip'.')).chr(strtok('.')).chr(strtok('.')).chr(strtok('.'));
 
$packet .= chr($port 0xFF).chr($port >> 0xFF);
 
$packet .= "x";
 
$packet .= chr($passlen 0xFF).chr($passlen >> 0xFF).$pass;
 
$packet .= chr($cmdlen 0xFF).chr($cmdlen >> 0xFF).$cmd;

 
$fp =fsockopen('udp://' $ip$port$errno$errstr);
 
fwrite($fp$packet);
 while(!
feof($fp)) {
  
$str=fread($fp,128);
  
$str=substr($str,13,strlen($str)-13);
  if (!
$str) break;
  echo 
$str."<br>";
  }
 
fclose($fp);
?>
So how could i manage to print those messages?

Thanks to all.

Cheers.
---
Web
Reply


Messages In This Thread
Php Command - by webflashing - 20.08.2008, 19:52
Re: Php Command - by eXchainZ-FoReVeR - 03.10.2009, 12:55
Re: Php Command - by Mike Garber - 03.10.2009, 14:10
Re: Php Command - by Think - 03.10.2009, 14:49
Re: Php Command - by eXchainZ-FoReVeR - 05.10.2009, 18:00

Forum Jump:


Users browsing this thread: 5 Guest(s)