MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
Rcon php
SRCDS Steam group


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rcon php
#1
Hej søger et php script så jeg kan styre rcon via af min hjemmside har prøvet at søge men uden held
Reply
#2
Du kan bruge sourcebans.
[Image: b_350_20_692108_381007_FFFFFF_000000.png]
I only have 1 server Sad
Attack2
Reply
#3
http://forums.srcds.com/viewtopic/13249
Reply
#4
(04-26-2010, 03:46 AM)realchamp Wrote:  http://forums.srcds.com/viewtopic/13249

Hmm synes ikke det har noget med rcon men har prøvet det synes ikke det gør noget bare hvid skærm
PHP Code:
<?php
// Thanks to Richard Perry.
function query_source($address)
{
$array = explode(":", $address);

$server['status'] = 0;
$server['ip'] = $array[0];
$server['port'] = $array[1];

if (!
$server['ip'] || !$server['port']) { exit("EMPTY OR INVALID ADDRESS"); }

$socket = @fsockopen("udp://{$server['ip']}", $server['port'], $errno, $errstr, 1);

if (!
$socket) { return $server; }

stream_set_timeout($socket, 1);
stream_set_blocking($socket, TRUE);
fwrite($socket, "\xFF\xFF\xFF\xFF\x54Source Engine Query\x00");
$packet = fread($socket, 4096);
@
fclose($socket);

if (!
$packet) { return $server; }

$header = substr($packet, 0, 4);
$response_type = substr($packet, 4, 1);
$network_version = ord(substr($packet, 5, 1));

if (
$response_type != "I") { exit("NOT A SOURCE SERVER"); }

$packet_array = explode("\x00", substr($packet, 6), 5);
$server['name'] = $packet_array[0];
$server['map'] = $packet_array[1];
$server['game'] = $packet_array[2];
$server['description'] = $packet_array[3];
$packet = $packet_array[4];
$app_id = array_pop(unpack("S", substr($packet, 0, 2)));
$server['players'] = ord(substr($packet, 2, 1));
$server['playersmax'] = ord(substr($packet, 3, 1));
$server['bots'] = ord(substr($packet, 4, 1));
$server['status'] = 1;
$server['dedicated'] = substr($packet, 5, 1);
$server['os'] = substr($packet, 6, 1);
$server['password'] = ord(substr($packet, 7, 1));
$server['vac'] = ord(substr($packet, 8, 1));

return
$server;
}
$query = query_source("89.186.169.116:27050");
echo
$query['game'];
?>
Reply
#5
Nåe der skulle være en anden tråd med det der i.. hmm jeg leder lige web serveren igennem Big Grin
Reply
#6
http://forums.srcds.com/viewtopic/1328 ?
Den tråd realchamp?
Og lige mit søge link kortlink.dk/7q5s

Edit: Det er vist PHPrcon du søger, står også i tråden
http://server.counter-strike.net/phprcon/
[Image: b_350_20_692108_381007_FFFFFF_000000.png]
I only have 1 server Sad
Attack2
Reply
#7
PHP Code:
<?php  
// rcon.class.php
define("SERVERDATA_EXECCOMMAND",2);
define("SERVERDATA_AUTH",3);

class
RCon {
var
$Password;
var
$Host;
var
$Port = 27015;
var
$_Sock = null;
var
$_Id = 0;

function
RCon ($Host,$Port,$Password) {
$this->Password = $Password;
$this->Host = $Host;
$this->Port = $Port;
$this->_Sock = @fsockopen($this->Host,$this->Port, $errno, $errstr, 30) or
die(
"Unable to open socket: $errstr ($errno)\n");
$this->_Set_Timeout($this->_Sock,2,500);
}

function
Auth () {
$PackID = $this->_Write(SERVERDATA_AUTH,$this->Password);

// Real response (id: -1 = failure)
$ret = $this->_PacketRead();
if (
$ret[1]['id'] == -1) {
die(
"Authentication Failure\n");
}
}

function
_Set_Timeout(&$res,$s,$m=0) {
if (
version_compare(phpversion(),'4.3.0','<')) {
return
socket_set_timeout($res,$s,$m);
}
return
stream_set_timeout($res,$s,$m);
}

function
_Write($cmd, $s1='', $s2='') {
// Get and increment the packet id
$id = ++$this->_Id;

// Put our packet together
$data = pack("VV",$id,$cmd).$s1.chr(0).$s2.chr(0);

// Prefix the packet size
$data = pack("V",strlen($data)).$data;

// Send packet
fwrite($this->_Sock,$data,strlen($data));

// In case we want it later we'll return the packet id
return $id;
}

function
_PacketRead() {
//Declare the return array
$retarray = array();
//Fetch the packet size
while ($size = @fread($this->_Sock,4)) {
$size = unpack('V1Size',$size);
//Work around valve breaking the protocol
if ($size["Size"] < 4096) {
//pad with 8 nulls
$packet = "\x00\x00\x00\x00\x00\x00\x00\x00".fread($this->_Sock,4096);
} else {
//Read the packet back
$packet = fread($this->_Sock,$size["Size"]);
}
array_push($retarray,unpack("V1ID/V1Response/a*S1/a*S2",$packet));
}
return
$retarray;
}

function
Read() {
$Packets = $this->_PacketRead();

foreach(
$Packets as $pack) {
if (isset(
$ret[$pack['ID']])) {
$ret[$pack['ID']]['S1'] .= $pack['S1'];
$ret[$pack['ID']]['S2'] .= $pack['S1'];
} else {
$ret[$pack['ID']] = array(
'Response' => $pack['Response'],
'S1' => $pack['S1'],
'S2' =>$pack['S2'],
);
}
}
return
$ret;
}

function
sendCommand($Command) {
$Command = '"'.trim(str_replace(' ','" "', $Command)).'"';
$this->_Write(SERVERDATA_EXECCOMMAND,$Command,'');
}

function
rconCommand($Command) {
$this->sendcommand($Command);

$ret = $this->Read();

//ATM: Source servers don't return the request id, but if they fix this the code below should read as
// return $ret[$this->_Id]['S1'];
return $ret[0]['S1'];
}
}
?>

PHP Code:
<?php  
// example.php
include_once("rcon.class.php");
$r = new rcon("IP",PORT,"PASSWORD");
$r->Auth();

echo
var_dump($r->rconCommand("stats"));

?>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)