From bc6e8589a53decf2f01a8cadf63573c7b1c69346 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sat, 15 Apr 2023 13:05:13 +0700 Subject: [PATCH] Fixed broken get gethostbyaddr (#681) --- modcp.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modcp.php b/modcp.php index b06b0eef7..e51b8cc7c 100644 --- a/modcp.php +++ b/modcp.php @@ -573,6 +573,8 @@ switch ($mode) { case 'ip': $anon = GUEST_UID; + $rdns_ip_num = (isset($_GET['rdns'])) ? $_GET['rdns'] : ''; + if (!$post_id) { bb_die($lang['NO_SUCH_POST']); } @@ -591,6 +593,8 @@ switch ($mode) { $ip_this_post = $lang['NOT_AVAILABLE']; } + $ip_this_post = ($rdns_ip_num == $ip_this_post) ? gethostbyaddr($ip_this_post) : $ip_this_post; + $poster_id = $post_row['poster_id']; $template->assign_vars(array( @@ -622,12 +626,13 @@ switch ($mode) { if (!$ip = \TorrentPier\Helpers\IPHelper::decodeIP($row['poster_ip'])) { $ip = $lang['NOT_AVAILABLE']; } + $ip = ($rdns_ip_num == $ip || $rdns_ip_num == 'all') ? gethostbyaddr($ip) : $ip; $template->assign_block_vars('iprow', array( 'ROW_CLASS' => !($i % 2) ? 'row4' : 'row5', 'IP' => $ip, 'POSTS' => $row['postings'], - 'U_LOOKUP_IP' => "modcp.php?mode=ip&" . POST_POST_URL . "=$post_id&" . POST_TOPIC_URL . "=$topic_id&rdns=" . $row['poster_ip'] . "&sid=" . $userdata['session_id'], + 'U_LOOKUP_IP' => "modcp.php?mode=ip&" . POST_POST_URL . "=$post_id&" . POST_TOPIC_URL . "=$topic_id&rdns=" . $ip . "&sid=" . $userdata['session_id'], )); $i++;