while ($row = $stmt->fetchObject()) {
    $systemId = trim($row->fromSolarSystemID);
    $jumpArray[$systemId] = explode(",", strtoupper($row->toSolarSystemID));
}
foreach ($toarray as $to) {
    $jumpNum = 1;
    $route = array();
    foreach ($jumpArray[$originid] as $n) {
        if ($n == $to) {
            $jumpNum = 2;
            $route[] = "{$to}";
            break;
        }
    }
    if ($jumpNum == 1) {
        foreach (graph_find_path($jumpArray, $originid, $to, $max) as $n) {
            if ($jumpNum > 1) {
                $route[] = $n;
            }
            $jumpNum++;
        }
    }
    if ($jumpNum < $maxjump) {
        $maxjump = $jumpNum - 1;
        $finaldestination = $to;
        $routeplan = $route;
    }
}
?>
<html>
<head><title>Route planner - Regional</title>
Exemple #2
0
     array_push($jumpArray[$systemName], $systemId);
 }
 header("Content-type: text/xml");
 $xml_output = "<?xml version=\"1.0\"?>\n\t<jump_route>\n";
 $jumpNum = 1;
 foreach ($jumpArray[$from] as $n) {
     if ($n == $to) {
         $jumpNum = 2;
         $xml_output_body = "\t<jump>\n";
         $xml_output_body .= "\t\t<system>{$to}</system>\n";
         $xml_output_body .= "\t</jump>\n";
         break;
     }
 }
 if ($jumpNum == 1) {
     foreach (graph_find_path($jumpArray, $from, $to) as $n) {
         if ($jumpNum > 1) {
             $xml_output_body .= "\t<jump>\n";
             $xml_output_body .= "\t\t<system>" . $n . "</system>\n";
             $xml_output_body .= "\t\t<security>" . $nameArray[$idArray[$n]][3] . "</security>\n";
             $xml_output_body .= "\t</jump>\n";
         }
         $jumpNum++;
     }
 }
 if ($jumpNum > 1) {
     $xml_output_body = "\t<route_possible>true</route_possible>\n\t<jump>\n\t\t<system>{$from}</system>\n\t\t<security>" . $nameArray[$idArray[$from]][3] . "</security>\n\t</jump>\n" . $xml_output_body;
 } else {
     $xml_output_body = "\t<route_possible>false</route_possible>\n" . $xml_output_body;
 }
 $time_end = microtime_float();