Commit af3fa032 authored by Armando Luescher's avatar Armando Luescher Committed by GitHub

Merge pull request #64 from diasporg/whoisfix

fix using the whois column for random location data
parents 426122d5 af3906c3
......@@ -27,7 +27,9 @@ while ($row = pg_fetch_array($result)) {
echo 'Months Monitored: ' . $row['monthsmonitored'] . '<br>';
echo 'Response Time: ' . $row['responsetimelast7'] . '<br>';
echo 'User Rating: ' . $row['userrating'] . '<br>';
echo 'Server Location: ' . $row['country'] . '<br>';
echo 'Server Country: ' . $row['country'] . '<br>';
echo 'Server State: ' . $row['state'] . '<br>';
echo 'Server City: ' . $row['city'] . '<br>';
echo 'Latitude: ' . $row['lat'] . '<br>';
echo 'Longitude: ' . $row['long'] . '<br>';
}
......
......@@ -240,15 +240,11 @@ while ($row = pg_fetch_all($result)) {
echo '<br>';
}
if ($location) {
$ipdata = 'Country: ' . $location['country_name'] . "\n";
$whois = 'Country: ' . $location['country_name'] . "\n Lat:" . $location['latitude'] . ' Long:' . $location['longitude'];
$country = $location['country_code'];
$city = isset($location->city) ? iconv('UTF-8', 'UTF-8//IGNORE', $location->city) : null;
$state = '';
$months = 0;
$uptime = 0;
$lat = $location['latitude'];
$long = $location['longitude'];
$country = isset($location['country_code']) ? iconv('UTF-8', 'UTF-8//IGNORE', $location['country_code']) : null;
$city = isset($location['city']) ? iconv('UTF-8', 'UTF-8//IGNORE', $location['city']) : null;
$state = isset($location['region']) ? iconv('UTF-8', 'UTF-8//IGNORE', $location['region']) : null;
$lat = isset($location['latitude']) ? $location['latitude']: null;
$long = isset($location['longitude']) ? $location['longitude'] : null;
//if lat and long are just a generic country with no detail lets make some tail up or openmap just stacks them all on top another
if (strlen($lat) < 4) {
$lat = $lat + (rand(1, 15) / 10);
......
......@@ -56,9 +56,9 @@ $numrows = pg_num_rows($result);
echo '<td>' . $row['uptimelast7'] . '%</td>';
echo '<td data-toggle="tooltip" data-placement="bottom" title="active six months: ' . $row['active_users_halfyear'] . ', active one month: ' . $row['active_users_monthly'] . '">' . $row['active_users_halfyear'] . '</td>';
if ($country_code === $row['country']) {
echo '<td class="text-success" data-toggle="tooltip" data-placement="bottom" title="' . $row['whois'] . '"><b>' . $row['country'] . '</b></td>';
echo '<td class="text-success" data-toggle="tooltip" data-placement="bottom" title="City: '. ($row['city'] ?? 'n/a') . ' State: ' . ($row['state'] ?? 'n/a') . '"><b>' . $row['country'] . '</b></td>';
} else {
echo '<td data-toggle="tooltip" data-placement="bottom" title="' . $row['whois'] . '">' . $row['country'] . '</td>';
echo '<td data-toggle="tooltip" data-placement="bottom" title="City: '. ($row['city'] ?? 'n/a') . ' State: ' . ($row['state'] ?? 'n/a') . '">' . $row['country'] . '</td>';
}
echo '<td>';
$row['service_facebook'] === 't' && print '<div class="smlogo smlogo-facebook" title="Publish to Facebook" alt="Publish to Facebook"></div>';
......
......@@ -96,9 +96,9 @@ $numrows = pg_num_rows($result);
echo '</a></td>';
echo '<td>' . $row['score'] . '/100</td>';
if ($country_code === $row['country']) {
echo '<td class="text-success" data-toggle="tooltip" data-placement="bottom" title="' . $row['whois'] . '"><b>' . $row['country'] . '</b></td>';
echo '<td class="text-success" data-toggle="tooltip" data-placement="bottom" title="City: '. ($row['city'] ?? 'n/a') . ' State: ' . ($row['state'] ?? 'n/a') . '"><b>' . $row['country'] . '</b></td>';
} else {
echo '<td data-toggle="tooltip" data-placement="bottom" title="' . $row['whois'] . '">' . $row['country'] . '</td>';
echo '<td data-toggle="tooltip" data-placement="bottom" title="City: '. ($row['city'] ?? 'n/a') . ' State: ' . ($row['state'] ?? 'n/a') . '">' . $row['country'] . '</td>';
}
echo '<td>';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment