2017-02-14 45 views
0

它不檢查端口用於RDP = 3389,對於FTP是,網絡是,TELNET是誰能告訴我爲什麼它不只是RDP端口3389的fsockopen PHP檢查開放端口,RDP不工作

if($type == "rdp") { 
    $sql = mysql_query("select * from stuff where stuff_id = '$id'"); 
    $rows = mysql_fetch_assoc($sql); 
    $server = trim($rows['addinfo']); 
    $host = "RDP IP"; 
    $port = "3389"; 
    $timeout = 2; 
    $tbegin = microtime(true); 
    $fp = fsockopen($host, $port, $errno, $errstr, $timeout); 
    $responding = 1; 

    if (!$fp) { $responding = 0; } 

    $tend = microtime(true); 
    fclose($fp); 
    $mstime = ($tend - $tbegin) * 1000; 
    $mstime = round($mstime, 2); 
    if($responding) 
    { 
     echo "<a href='#' class='btn btn-success'>Connected</a>"; 
    } 
    else 
    { 
     echo "<a href='#' class='btn btn-danger'>Checker Fail !</a>"; 
    } 
+0

確保端口已打開。 – Jer

+0

100%開放的港口 – JoeFixer

回答

0

工作似乎腳本嘗試連接到「RDP IP」而不是使用服務器變量。