• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Search for an IP (query)

Jake Bunce

XenForo moderator
Staff member
#1
There is currently no utility in the software to search for an IP address, but you can use a query.

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.

Use this if you want to specify a range of IPs:

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.

You will get results like this:

Screen shot 2011-05-03 at 10.05.27 AM.png