Update admin.php

Also add same geoip extra check for file download
This commit is contained in:
Brian Huisman 2023-05-03 11:41:25 -04:00
parent 8caf5440d3
commit 31421e47bc

View file

@ -253,10 +253,12 @@ if (!$_SESSION['admin_username']) {
$line['stamp'] = date('c', $line['stamp']); $line['stamp'] = date('c', $line['stamp']);
if ($_GEOIP2) { if ($_GEOIP2) {
$line['country'] = '';
try { try {
$geo = $_GEOIP2->country($line['ipaddr']); $geo = $_GEOIP2->country($line['ipaddr']);
} catch(Exception $e) { $geo = false; } } catch(Exception $e) { $geo = false; }
$line['country'] = ($geo) ? $geo->raw['country']['names']['en'] : ''; if (!empty($geo->raw['country']['names']['en']))
$line['country'] = $geo->raw['country']['names']['en'];
} }
fputcsv($output, $line); fputcsv($output, $line);