SRCDS Steam group


php mysql server query script integration
#1
Exclamation 
Hello everyone i am currently looking for tutorials, information resources or a programmer to help me fashion php mysql source server query web page integration for all of my source mod servers. with this request and plea full custom file system set up delivery could be met with bountiful funding via paypal. be it note that i am aware of xpaws scripts on github to what i could see and understand i couldnt really get the scripts working if thats even the scripts that i would be potentially looking for or not. and i am indeed aware of the developer wikis source server query documents. im not the slickest with php hence why im looking for help in achieving this goal. contact me via here or steam to further discuss in helping me to achieve and blueprint this goal. if not any info or docs here that could help would be greatly appreciated. this is source engine, not a joke. Cool
Reply
#2
Code:
<?php
class query {
    public 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 = new query;
    $link = "66.242.13.202";
    $port = 27015;
    if(fsockopen($link, $port, $num, $error, 5)) {
        $server = $query->query_source($link . ":" . $port);
        echo "Server is online and running " . $server['vac'] . " with " . $server['os'] . " / " . $server['name'];
    } else {
        echo "Server is not active";
        die();
    }
  
?>
this is a script ive found that seems to at least respond back as my CSS server is online which could be a good sign but cant seem to get any of the variables to echo out.
Reply
#3
ive found a real programmer who will soon be done with data extraction for Half Life 2 Deathmatch. i am paying him to help set up php source server query system for
Counter Strike: Source
Code Name Cure
Contagion
Day of Defeat: Source
Double Action Boogaloo
Golden Eye: Source
Garrys Mod
The Hidden: Source
Half Life 2: Death Match
Left 4 Dead
Left 4 Dead 2
NEOTOKYO!: Source
No More Room In Hell
Zombie Panic: Source
you may contact me and i will share these codes if anyone is looking when its done
it will have an MYSQL database infrastructure to record playernames and frag counts
and display the data extracted in php pages so it can be integrated onto any online webhost.
#SOURCEMODSMATTER #HALFLIFEFORLIFE
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)