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.
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.
Need a PHP class to check RCON for cs1.6
SRCDS Steam group


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need a PHP class to check RCON for cs1.6
#1
Hi,
I'm looking for a PHP class in order to check if a user is really the owner of a serveur

please, this is kind of 'urgent' I only find on the Web a PHP Class for Source Game. If you have this in your pocket please let me know

Thanks
Reply
#2
Sure you can't use the once for source? If i remember right it should work?

Also you might wanna use a remote query instead.
Reply
#3
yeah, it won't work it's not the same protocols with 1.6 and SRCDS games

(and yeah i want to use a remote query Smile )
Reply
#4
http://gameq.sourceforge.net/
Reply
#5
What do you mean of "checking" the rcon of a player?

Do you want to send a rcon command?
Reply
#6
(01-06-2010, 12:24 AM)realchamp Wrote:  What do you mean of "checking" the rcon of a player?

He means

(01-05-2010, 11:43 PM)Iseult Wrote:  (and yeah i want to use a remote query Smile )

And should use

(01-05-2010, 11:58 PM)Nisd Wrote:  http://gameq.sourceforge.net/
Reply
#7
i mean, user enter an IP + PORT + RCON
and it query the serveur
resond 1 >> good RCON
respond 0 >> wrong password

thx for the link i'll check that right now
Reply
#8
Wow you are confusing...... Well never mind, that link i wrote, cause it is to query a server, no Rcon.
Reply
#9
The query to get players, map and users does not require rcon and the one of the Source Engine works for HL1 games too.

To send a rcon command; in fact I believe the source one will work.
Reply
#10
noooo, Gameq doesn't have a RCON system. ='(

yeah i need the RCON verification why do i want this ?


because on my website, you can enter only if you have a server, so to check that, you enter an IP + PORT + your RCON
='(

(on my website, i've already a working version for SRCDS games, i tested it with a CS1.6 server and it says that it's the wrong RCON so no, SRCDS scripts does not support Half Life engine games.)

i updated my first post changing : I'm looking for a PHP class in order to check if a user is really the owner of a server to avoid confusions !

i'll post the rcon CLASS i use,please tell me if you can get this working with cs1.6
Code:
<?php
    define('PACKET_SIZE', '1400');
    define('SERVERQUERY_INFO', "\xFF\xFF\xFF\xFFTSource Engine Query");
    define ('REPLY_INFO', "\x49");
    define('SERVERQUERY_GETCHALLENGE', "\xFF\xFF\xFF\xFF\x57");
    define ('REPLY_GETCHALLENGE', "\x41");
    define('SERVERDATA_AUTH', 3) ;
    define ('SERVERDATA_EXECCOMMAND', 2) ;
    
    class srcds_rcon
    {

         function getLong(&$string)
        {
            $data = substr($string, 0, 4);
            $string = substr($string, 4);
            $data = unpack('Vvalue', $data);
            return $data['value'];
        }
    
      function rcon_command($ip, $port, $password)
        {
            $ip = $_POST["ip"];
            $port = $_POST["port"];
            $password = $_POST["rcon"];
            $requestId = 1;
            $s2 = '';
            $socket = @fsockopen ('tcp://'.$ip, $port, $errno, $errstr, 15);
            if (!$socket)
                return 0;
            $data = pack("VV", $requestId, SERVERDATA_AUTH).$password.chr(0).$s2.chr(0);
            $data = pack("V",strlen($data)).$data;        
            fwrite ($socket, $data, strlen($data));
            
            $requestId++ ;
            $junk = fread ($socket, PACKET_SIZE);
            $string = fread ($socket, PACKET_SIZE);
            $size = $this->getLong($string);
            $id = $this->getLong($string) ;
            
            if ($id == -1)
            {
              return 0;
            }
            else
            {
              return 1; //if good rcon then return 1, else return 0
             }
            
            
        }                
    }
Reply
#11
PHP Code:
<?php 
// rcon.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  
// Another file
// include the rcon.php file:
include("rcon.php");

$r = new rcon("127.0.0.1",27015,"testme");
$r->Auth();

echo
"Authenticated\n";

//Send a request
var_dump($r->rconCommand("cvarlist"));

?>
Reply
#12
thank you so much, i'm testing it right now !
Reply
#13
it doesn't work

i copy past the exaclty same as you but it says :

Unable to open socket: Connection refused (111)
Code:
<?php
$r = new rcon("94.23.26.185",27175,"gamer-certified");  
$r->Auth();  
  
echo "Authenticated\n";  
  
//Send a request  
var_dump($r->rconCommand("cvarlist"));  
  
?>

The server is UP and running !
(yeah i know i did post the rcon_password... it's a 2slot test server based in Europe, so you won't go far with it Big Grin)
you can see the message : HERE
Reply
#14
Change "var $Port = 27015;" to "var $Port = 27175";
Reply
#15
ok, to be hosnest, i didn't try, i found an alternative, (but little bit heavy than your system)

(called phprcon)

Thx anyway for your help realchamp Wink
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)