Fixed broken get gethostbyaddr (#681)

This commit is contained in:
Roman Kelesidis 2023-04-15 13:05:13 +07:00 committed by GitHub
commit bc6e8589a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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++;