Whois Localization

Get help with installation and running phpBB 3.3.x here. Please do not post bug reports, feature requests, or extension related questions here.
saavannah
Registered User
Posts: 26
Joined: Sun Oct 27, 2024 5:03 am

Whois Localization

Post by saavannah »

Hello, Is it possible to view the location of a member's IP address when clicking the Whois button (located in "Who is online," for example)?

Currently, this button opens an empty window. Does it need to be linked to a specific address?

Thank you for your help,
Well done is better than well said.
User avatar
warmweer
Jr. Extension Validator
Posts: 11988
Joined: Fri Jul 04, 2003 6:34 am
Location: somewhere in the space-time continuum

Re: Whois Localization

Post by warmweer »

saavannah wrote: Thu Dec 05, 2024 11:50 am Hello, Is it possible to view the location of a member's IP address when clicking the Whois button (located in "Who is online," for example)?
An IP is assigned by the ISP (which usually has the customer's address). The ISP may allow to see the approximate location but that should never be the client's address.
saavannah wrote: Thu Dec 05, 2024 11:50 am Currently, this button opens an empty window. Does it need to be linked to a specific address?
Which button are you referring to?
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
KevC
Support Team Member
Support Team Member
Posts: 72638
Joined: Fri Jun 04, 2004 10:44 am
Location: Oxford, UK

Re: Whois Localization

Post by KevC »

By default that pop up window shows you the full whois information if it's available.

Once in a while you might get one that is ambiguous if they're behind a firewall of some sort but it's usually correct about the country location.

Are you sure you're own hosting isn't blocking the information through cloudflare or similar?
-:|:- Support Request Template -:|:-
Image
"Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb"
saavannah
Registered User
Posts: 26
Joined: Sun Oct 27, 2024 5:03 am

Re: Whois Localization

Post by saavannah »

KevC wrote: Thu Dec 05, 2024 12:15 pm
Are you sure you're own hosting isn't blocking the information through cloudflare or similar?
Yes.
Well done is better than well said.
User avatar
ssl
Registered User
Posts: 2057
Joined: Sat Feb 08, 2020 2:15 pm
Location: Le Lude, Pays de la Loire - France
Name: Fred Rimbert

Re: Whois Localization

Post by ssl »

There's a good chance it's related to your hosting.

Try what is indicated in this message, namely create a test.php file at the root of your forum, containing this code:

Code: Select all

<?php
function user_ipwhois($ip)
{
    if (empty($ip))
    {
        return '';
    }

    if (preg_match('#^(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$#', $ip))
    {
        // IPv4 address
        $whois_host = 'whois.arin.net.';
    }
    else
    {
        return '';
    }

    $ipwhois = '';

    if (($fsk = @fsockopen($whois_host, 43)))
    {
        // CRLF as per RFC3912
        fputs($fsk, "$ip\r\n");
        while (!feof($fsk))
        {
            $ipwhois .= fgets($fsk, 1024);
        }
        @fclose($fsk);
    }

    $match = array();

    // Test for referrals from $whois_host to other whois databases, roll on rwhois
    if (preg_match('#ReferralServer: whois://(.+)#im', $ipwhois, $match))
    {
        if (strpos($match[1], ':') !== false)
        {
            $pos    = strrpos($match[1], ':');
            $server    = substr($match[1], 0, $pos);
            $port    = (int) substr($match[1], $pos + 1);
            unset($pos);
        }
        else
        {
            $server    = $match[1];
            $port    = 43;
        }

        $buffer = '';

        if (($fsk = @fsockopen($server, $port)))
        {
            fputs($fsk, "$ip\r\n");
            while (!feof($fsk))
            {
                $buffer .= fgets($fsk, 1024);
            }
            @fclose($fsk);
        }

        // Use the result from $whois_host if we don't get any result here
        $ipwhois = (empty($buffer)) ? $ipwhois : $buffer;
    }

    $ipwhois = htmlspecialchars($ipwhois);

    return trim($ipwhois);
}
echo '<pre>' . user_ipwhois('8.8.8.8') . '</pre>'; 

Then go to https://yourdomain.com/test.php

You are supposed to return a page with a message like this:

Code: Select all

#
# ARIN WHOIS data and services are subject to the Terms of Use
# available at: https://www.arin.net/resources/registry/whois/tou/
#
# If you see inaccuracies in the results, please report at
# https://www.arin.net/resources/registry/whois/inaccuracy_reporting/
#
# Copyright 1997-2024, American Registry for Internet Numbers, Ltd.
#


#
# Query terms are ambiguous.  The query is assumed to be:
#     "n 8.8.8.8"
#
# Use "?" to get help.
#

NetRange:       8.8.8.0 - 8.8.8.255
CIDR:           8.8.8.0/24
NetName:        GOGL
NetHandle:      NET-8-8-8-0-2
Parent:         NET8 (NET-8-0-0-0-0)
NetType:        Direct Allocation
OriginAS:       
Organization:   Google LLC (GOGL)
RegDate:        2023-12-28
Updated:        2023-12-28
Ref:            https://rdap.arin.net/registry/ip/8.8.8.0



OrgName:        Google LLC
OrgId:          GOGL
Address:        1600 Amphitheatre Parkway
City:           Mountain View
StateProv:      CA
PostalCode:     94043
Country:        US
RegDate:        2000-03-30
Updated:        2019-10-31
Comment:        Please note that the recommended way to file abuse complaints are located in the following links. 
Comment:        
Comment:        To report abuse and illegal activity: https://www.google.com/contact/
Comment:        
Comment:        For legal requests: http://support.google.com/legal 
Comment:        
Comment:        Regards, 
Comment:        The Google Team
Ref:            https://rdap.arin.net/registry/entity/GOGL


OrgAbuseHandle: ABUSE5250-ARIN
OrgAbuseName:   Abuse
OrgAbusePhone:  +1-650-253-0000 
OrgAbuseEmail:  [email protected]
OrgAbuseRef:    https://rdap.arin.net/registry/entity/ABUSE5250-ARIN

OrgTechHandle: ZG39-ARIN
OrgTechName:   Google LLC
OrgTechPhone:  +1-650-253-0000 
OrgTechEmail:  [email protected]
OrgTechRef:    https://rdap.arin.net/registry/entity/ZG39-ARIN


#
# ARIN WHOIS data and services are subject to the Terms of Use
# available at: https://www.arin.net/resources/registry/whois/tou/
#
# If you see inaccuracies in the results, please report at
# https://www.arin.net/resources/registry/whois/inaccuracy_reporting/
#
# Copyright 1997-2024, American Registry for Internet Numbers, Ltd.
#

If it's a blank page, check with your host.
Sorry for my English ... I do my best! :anger_right:

:point_right_tone3: phpBB: 3.3.14 | PHP: 8.3.12
:point_right_tone4: [Kill spam on phpBB] - [Some French translation of extensions]
"Mistress, Mistress someone is bothering me in pm"
saavannah
Registered User
Posts: 26
Joined: Sun Oct 27, 2024 5:03 am

Re: Whois Localization

Post by saavannah »

Mission accomplished successfully, thank you ssl
Well done is better than well said.

Return to “[3.3.x] Support Forum”