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

XF 1.1 Can we search for partial IP addresses?

Discussion in 'Troubleshooting and Problems' started by Rudy, Mar 19, 2013.

  1. Rudy

    Rudy 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?
    nrep likes this.
  2. Kent

    Kent Active Member

    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:

    Jake Bunce likes this.
  3. Rudy

    Rudy Well-Known Member

    The staff needs the ability to search the membership for partial IP addresses--that's what I'm looking for. It's likely not available as of yet?
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  5. Rudy

    Rudy Well-Known Member

    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... ;)

Share This Page