Example #1
0
function MakeResult()
{
    if (!isset($_GET["id"]) || !isset($_GET["action"])) {
        return;
    }
    if ($_GET['action'] == 'ping' && isset($_GET['ip'])) {
        $result = Ping($_GET['ip']);
        echo "ping_" . $_GET["id"] . "|<b style='color: " . ($result == "Да" ? 'green' : 'red') . ";'>" . $result . "</b>";
    }
}
Example #2
0
        break;
    case '3':
        // Request to remove
        RequestToRemove($msgs[1], $date);
        break;
    case '4':
        //Request GameList and data
        requstGameList($msgs[1], $date, $msgs[2], $msgs[3]);
        break;
    case '5':
        //JoinGame
        JoinGame($msgs[1], $msgs[2], $msgs[3], $date);
        break;
    case '6':
        //ping!
        Ping($msgs[1], $date);
        break;
    default:
        foreach ($msgs as $key) {
            echo "Erorr: " + $key;
        }
        break;
}
function JoinGame($Id, $Char, $Hash, $timestamp)
{
    $once = false;
    include "conf.php";
    $conn = new mysqli($serverip, $username, $password, $dbname, $Port);
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
Example #3
0
 if (strlen($allrecvbut) >= 8 + $len) {
     $json = substr($allrecvbut, 8, $len);
     ConsoleOut($json, 'debug');
     $js = json_decode($json, true);
     //远程主连接
     if ($sockinfo['type'] == 1) {
         if ($js['Type'] == 'ReqProxy') {
             $newsock = connectremote($seraddr, $port);
             if ($newsock) {
                 $socklist[] = array('sock' => $newsock, 'linkstate' => 0, 'type' => 2);
             }
         }
         if ($js['Type'] == 'AuthResp') {
             $ClientId = $js['Payload']['ClientId'];
             $pingtime = time();
             sendpack($sock, Ping());
             foreach ($Tunnels as $tunnelinfo) {
                 //注册端口
                 sendpack($sock, ReqTunnel($tunnelinfo['protocol'], $tunnelinfo['hostname'], $tunnelinfo['subdomain'], $tunnelinfo['httpauth'], $tunnelinfo['rport']));
             }
         }
         if ($js['Type'] == 'NewTunnel') {
             if ($js['Payload']['Error'] != null) {
                 ConsoleOut('隧道建立失败:' . $js['Payload']['Error']);
                 sleep(30);
             } else {
                 ConsoleOut('隧道建立成功:' . $js['Payload']['Url']);
             }
         }
     }
     //远程代理连接