diff options
author | Pressy <lwt-pressy@users.noreply.github.com> | 2017-10-31 15:48:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-31 15:48:02 +0300 |
commit | da9ce8e9ce41428b5d9c061071b0ae9e54cea034 (patch) | |
tree | 91a3d1a48d9ba3f29d6477f47f5d17c6940cfca3 | |
parent | 2fde908b1f83e707ce12c8fde25491b5e032a666 (diff) |
certain ipv6 adresses where returned as null, so I switch using mysql to convert the ipv6 adress into a string. (#10)
-rw-r--r-- | dmarcts-report-viewer.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/dmarcts-report-viewer.php b/dmarcts-report-viewer.php index fda597f..fc6e88b 100644 --- a/dmarcts-report-viewer.php +++ b/dmarcts-report-viewer.php @@ -120,7 +120,7 @@ function tmpl_reportData($reportnumber, $allowed_reports, $host_lookup = 1, $sor $reportdata[] = " <tbody>"; global $mysqli; - $sql = "SELECT * FROM rptrecord where serial = $reportnumber"; + $sql = "SELECT *, INET6_NTOA(ip6) as ip6s FROM rptrecord where serial = $reportnumber"; $query = $mysqli->query($sql) or die("Query failed: ".$mysqli->error." (Error #" .$mysqli->errno.")"); while($row = $query->fetch_assoc()) { $row = array_map('htmlspecialchars', $row); @@ -135,11 +135,12 @@ function tmpl_reportData($reportnumber, $allowed_reports, $host_lookup = 1, $sor $status="yellow"; }; - if ( $row['ip'] ) { + if ( $row['ip'] > 0 ) { $ip = long2ip($row['ip']); - } - if ( $row['ip6'] ) { - $ip = inet_ntop($row['ip6']); + } elseif ( $row['ip6s'] ) { + $ip = $row['ip6s']; + } else { + $ip = "-"; } $reportdata[] = " <tr class='".$status."'>"; |