Skip to forum content

You are not logged in. Please login or register.


forums.pvpgn.pro → 3d Party Tools → [Script] Simple PvPGN & D2GS Status, using PHP

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 1

1

Topic: [Script] Simple PvPGN & D2GS Status, using PHP

In case someone needs it:

<?php
// Inspired by https://github.com/pvpgn/phputils/blob/master/pvpgn-status/online-offline.php

$connect_server = FALSE;
$gaming_server = FALSE;

// BNETD
if($fp = @fsockopen('127.0.0.1', 6112, $error_number, $error_value, $timeout = 1)) {
    fclose($fp);

    $connect_server = TRUE;
}

// D2CS
if($fp = @fsockopen('127.0.0.1', 6113, $error_number, $error_value, $timeout = 1)) {
    fclose($fp);

    // D2DBS
    if($fp = @fsockopen('127.0.0.1', 6114, $error_number, $error_value, $timeout = 1)) {
        fclose($fp);

        $a = 0;
        $b = 0;

        foreach(array('127.0.0.1') as $ip) {
            $a++;

            // D2GS
            if($fp = @fsockopen($ip, 4000, $error_number, $error_value, $timeout = 1)) {
                fclose($fp);

                $b++;

                $gaming_server = TRUE;
            }
        }
    }
}

$status = 'Connect Server is ' . ($connect_server ? 'ONLINE' : 'OFFLINE') . ' and Gaming Server is ' . ($gaming_server ? 'ONLINE (' . $b . ' of ' . $a . ' servers running)' : 'OFFLINE') . '.';

echo $status;
?>

Posts: 1

Pages 1

You must login or register to post a reply

Who now at forum

Currently view post: 1 guest, 0 registered users

forums.pvpgn.pro → 3d Party Tools → [Script] Simple PvPGN & D2GS Status, using PHP