1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I search for IP addresses?

Discussion in 'XenForo Questions and Support' started by Jaxel, Dec 18, 2010.

  1. Jaxel

    Jaxel Well-Known Member

    I have an IP address... but I don't have a user. How would I search for the IP address?
     
    muthu likes this.
  2. Brogan

    Brogan XenForo Moderator Staff Member

    There is no way of searching for a user based on IP address.

    You could check in the xf_ip table.
     
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Here is a query you can run on your database to retrieve a list of all users that have used a particular IP address:

    Code:
    SELECT user.username, INET_NTOA(ip.ip)
    FROM xf_ip AS ip
    LEFT JOIN xf_user AS user ON (user.user_id = ip.user_id)
    WHERE ip.ip = INET_ATON('xxx.xxx.xxx.xxx')
    GROUP BY user.user_id
    
    Replace xxx.xxx.xxx.xxx with the IP you want to search for.
     
    muthu, Alien, Spenser and 2 others like this.
  4. Kane Hart

    Kane Hart Active Member

    How would I use wildcard?
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Use this for a range:

    Code:
    SELECT user.username, INET_NTOA(ip.ip)
    FROM xf_ip AS ip
    LEFT JOIN xf_user AS user ON (user.user_id = ip.user_id)
    WHERE ip.ip BETWEEN INET_ATON('xxx.xxx.xxx.1') AND INET_ATON('xxx.xxx.xxx.255')
    GROUP BY user.user_id
    
    You have to specify the beginning and end of the range.
     

Share This Page