|
|
@@ -12,6 +12,19 @@ $baseUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : '
|
|
|
|
|
|
$trackingLink = $baseUrl . 'track.php';
|
|
|
|
|
|
+function countryCodeToFlag($countryCode)
|
|
|
+{
|
|
|
+ if (!$countryCode || !preg_match('/^[A-Za-z]{2}$/', $countryCode)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ $countryCode = strtoupper($countryCode);
|
|
|
+ $flag = '';
|
|
|
+ foreach (str_split($countryCode) as $letter) {
|
|
|
+ $flag .= mb_chr(0x1F1E6 + (ord($letter) - ord('A')), 'UTF-8');
|
|
|
+ }
|
|
|
+ return $flag;
|
|
|
+}
|
|
|
+
|
|
|
$trackedKeys = [];
|
|
|
if (is_file($keysFile) && is_readable($keysFile)) {
|
|
|
$raw = file_get_contents($keysFile);
|
|
|
@@ -60,7 +73,7 @@ if (is_file($logFile) && is_readable($logFile)) {
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
<title>Click Tracker – Admin</title>
|
|
|
<style>
|
|
|
- body { font-family: system-ui, sans-serif; margin: 1rem 2rem; max-width: 1200px; }
|
|
|
+ body { font-family: system-ui, sans-serif; margin: 1rem 2rem; max-width: 1800px; }
|
|
|
h1 { margin-top: 0; }
|
|
|
.form-group { margin-bottom: 1rem; }
|
|
|
.form-group label { display: block; margin-bottom: 0.25rem; font-weight: 500; }
|
|
|
@@ -73,7 +86,8 @@ if (is_file($logFile) && is_readable($logFile)) {
|
|
|
th { background: #f5f5f5; font-weight: 600; }
|
|
|
tr:nth-child(even) { background: #fafafa; }
|
|
|
.col-time { white-space: nowrap; }
|
|
|
- .col-ua, .col-referrer, .col-target { max-width: 280px; word-break: break-all; }
|
|
|
+ .col-ua { max-width: 500px; word-break: break-all; }
|
|
|
+ .col-referrer, .col-target { max-width: 400px; word-break: break-all; }
|
|
|
.empty { color: #666; font-style: italic; margin-top: 1rem; }
|
|
|
</style>
|
|
|
</head>
|
|
|
@@ -131,7 +145,7 @@ if (is_file($logFile) && is_readable($logFile)) {
|
|
|
<tr>
|
|
|
<td class="col-time"><?php echo htmlspecialchars($t['timestamp'] ?? '-'); ?></td>
|
|
|
<td><?php echo htmlspecialchars($t['key'] ?? '-'); ?></td>
|
|
|
- <td><?php echo htmlspecialchars($t['ip'] ?? '-'); ?><?php if (!empty($t['ip_forwarded'])) echo ' <small>(X-Forwarded: ' . htmlspecialchars($t['ip_forwarded']) . ')</small>'; ?></td>
|
|
|
+ <td><?php $flag = countryCodeToFlag($t['country_code'] ?? null); ?><?php if ($flag): ?><span title="<?php echo htmlspecialchars($t['country_code']); ?>"><?php echo $flag; ?></span> <?php endif; ?><?php echo htmlspecialchars($t['ip'] ?? '-'); ?><?php if (!empty($t['ip_forwarded'])) echo ' <small>(X-Forwarded: ' . htmlspecialchars($t['ip_forwarded']) . ')</small>'; ?></td>
|
|
|
<td class="col-ua"><?php echo htmlspecialchars($t['user_agent'] ?? '-'); ?></td>
|
|
|
<td class="col-referrer"><?php echo htmlspecialchars($t['referrer'] ?? '-'); ?></td>
|
|
|
<td class="col-target"><?php echo htmlspecialchars($t['target_url'] ?? '-'); ?></td>
|