XF 1.1 Can we search for partial IP addresses?

Wildcat Media

Well-known member
Is there a way to search for partial IP addresses? Some of the staff uses it to cross-check suspicious members. I tried a wildcard (like 127.0.0.*) and that didn't work, and neither did entering just a partial bit of the address (127.0.0).

Could this be because of the way the IP address is stored?
I don't think there is a way to do that, but you can use a query:
SELECT `xf_user`.`username`
FROM `xf_ip`
JOIN `xf_user` ON (`xf_user`.`user_id` = `xf_ip`.`user_id`)
WHERE `ip` >= INET_ATON('') AND `ip` <= INET_ATON('')
GROUP BY `xf_ip`.`user_id`
LIMIT 100;
I'm not sure how this query may perform on larger databases. With 100 results this query took 0.78 seconds on my database with 1216900 rows.

XenForo stores IP addresses a number, so this searches inclusively from 1443966976 to 1443971071.

These may also help you:

This sounds like a good idea for a feature request. I wanted to be sure it wasn't already available before I submitted it. Thanks!

I don't think any forum moderation staff is going to know how to run queries, or have the permissions to... ;)
Top Bottom