diff --git a/func.inc b/func.inc index 67e4cdc..8c10c4d 100644 --- a/func.inc +++ b/func.inc @@ -89,7 +89,7 @@ function getknownlinks() { return $knownlinks; } -function getasstats_top($ntop, $statfile, $selected_links, $list_asn = NULL) { +function getasstats_top($ntop, $statfile, $selected_links, $list_asn = NULL, $v = NULL) { try{ $db = new SQLite3($statfile); }catch(Exception $e){ @@ -104,9 +104,17 @@ function getasstats_top($ntop, $statfile, $selected_links, $list_asn = NULL) { $query_total = '0'; $query_links = ''; foreach($selected_links as $tag){ - $query_links .= "${tag}_in, ${tag}_out, ${tag}_v6_in, ${tag}_v6_out, "; + if ($v == 4 || $v == NULL) { + $query_links .= "${tag}_in, ${tag}_out, "; + } else { + $query_links .= "${tag}_v6_in, ${tag}_v6_out, "; + } $nlinks += 4; - $query_total .= " + ${tag}_in + ${tag}_out + ${tag}_v6_in + ${tag}_v6_out"; + if ($v == 4 || $v == NULL) { + $query_total .= " + ${tag}_in + ${tag}_out"; + } else { + $query_total .= " + ${tag}_v6_in + ${tag}_v6_out"; + } } if ( $list_asn ) { $where = implode(",", $list_asn); diff --git a/linkgraph.php b/linkgraph.php index 3e9692d..a8900f6 100644 --- a/linkgraph.php +++ b/linkgraph.php @@ -23,7 +23,11 @@ if (@$_GET['numhours']) $hours = (int)$_GET['numhours']; $statsfile = statsFileForHours($hours); -$topas = getasstats_top($numtop, $statsfile, array($_GET['link'])); +if (@$_GET['v'] == 6) { + $topas = getasstats_top($numtop, $statsfile, array($_GET['link']), $list_asn = NULL, $v=6); +}else { + $topas = getasstats_top($numtop, $statsfile, array($_GET['link'])); +} /* now make a beautiful graph :) */ header("Content-Type: image/png");