Example #1
0
 case "trace":
     $result = shell_exec("traceroute {$ip}");
     preg_match_all("/(\\([0-9\\.]*\\))/", $result, $matches);
     for ($i = 0; $i < count($matches[0]); $i++) {
         $ips[] = $matches[0][$i];
     }
     $ips = str_replace(array("(", ")"), "", $ips);
     $out = "<b>Traceroute до URL: <a href=\"{$url}\" target=_blank>{$url}</a></b><br />\r\n";
     $out .= "<table width=100%>";
     $i = 0;
     $flparams = "";
     $j = -1;
     $last_ctry = "";
     $flctrys = array();
     foreach ($ips as $ip) {
         if ($cntry = $BILL->GetCountry($ip)) {
             $country = "<img src=\"img/flags/" . $cntry['ctry'] . ".gif\"/ alt=\"" . $cntry['country'] . "\"> ";
         } else {
             $country = $ip;
         }
         if (strtoupper($last_ctry) != strtoupper($cntry['ctry'])) {
             $j++;
             $last_ctry = strtoupper($cntry['ctry']);
         }
         $flctrys[$j]['count']++;
         $flctrys[$j]['ctry'] = strtoupper($cntry['ctry']);
         $out .= "<tr><td class=tbl1>" . $i++ . "</td><td class=tbl1>{$ip}</td><td class=tbl1>{$country}</td></tr>";
     }
     $out .= "</table>";
     $out .= "<a href=\"?p={$p}&act={$act}&action={$oldaction}&unique_id={$unique_id}\">назад</a><br/>";
     $flparams = "RU:1:0xFFFFFF";