From 458fad51bbfbfc5dd9854cb0ab46e99519b2057b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=AA=E5=AD=90?= Date: Sat, 15 Feb 2025 19:56:41 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E8=AF=84=E8=AE=BA=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comments.php | 5 +++-- functions.php | 36 ++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/comments.php b/comments.php index f49a20d..886f189 100644 --- a/comments.php +++ b/comments.php @@ -113,9 +113,10 @@ function threadedComments($comments, $options) {
date('Y-m-d H:i'); ?>
- + + ip; $location = get_ip_location($ip); display_location($location); ?> reply(''); ?> diff --git a/functions.php b/functions.php index e048d41..4e797b4 100644 --- a/functions.php +++ b/functions.php @@ -389,21 +389,21 @@ function commentApprove($widget, $email = NULL) } /** 获取评论者地址 */ -function get_ip_location($ip) { - $apiUrl = "https://www.nazo.run/ip/{$ip}"; - $response = file_get_contents($apiUrl); - $data = json_decode($response, true); - - if ($data && $data['code'] == 0) { - return array( - 'country' => $data['data']['country'], - 'region' => $data['data']['region'], - 'city' => $data['data']['city'] - ); - } -} -function display_location($location) { - echo htmlspecialchars($location['country'] ?? 'Unknown') . ' ' . - htmlspecialchars($location['region'] ?? ' ') . ' ' . - htmlspecialchars($location['city'] ?? ' '); -} \ No newline at end of file +//function get_ip_location($ip) { +// $apiUrl = "https://www.nazo.run/ip/{$ip}"; +// $response = file_get_contents($apiUrl); +// $data = json_decode($response, true); +// +// if ($data && $data['code'] == 0) { +// return array( + // 'country' => $data['data']['country'], +// 'region' => $data['data']['region'], +// 'city' => $data['data']['city'] +// ); +// } +//} +//function display_location($location) { +// echo htmlspecialchars($location['country'] ?? 'Unknown') . ' ' . +// htmlspecialchars($location['region'] ?? ' ') . ' ' . +// htmlspecialchars($location['city'] ?? ' '); +//} \ No newline at end of file