XF 1.5 Query to remove ip address from all users?

Brent W

Well-known member
While setting up RailGun we briefly had it live where it wasn't forwarding the users ip address but instead our servers ip address. This means that many members show up as sharing our servers ip address. How can I delete that IP address from all users accounts?
 
Code:
DELETE FROM xf_ip WHERE ip = UNHEX(LPAD(HEX(INET_ATON('1.2.3.4')), 8, '0'));
Change 1.2.3.4 as needed.

I haven't tested this yet, so I'd recommend using the SELECT version to confirm it's grabbing what you expect and, as usual, I'd recommend backing up before running this.
 
Code:
DELETE FROM xf_ip WHERE ip = UNHEX(LPAD(HEX(INET_ATON('1.2.3.4')), 8, '0'));
Change 1.2.3.4 as needed.

I haven't tested this yet, so I'd recommend using the SELECT version to confirm it's grabbing what you expect and, as usual, I'd recommend backing up before running this.

Worked perfectly.
 
Code:
DELETE FROM xf_ip WHERE ip = UNHEX(LPAD(HEX(INET_ATON('1.2.3.4')), 8, '0'));
Change 1.2.3.4 as needed.

I haven't tested this yet, so I'd recommend using the SELECT version to confirm it's grabbing what you expect and, as usual, I'd recommend backing up before running this.

I am not able to do this. I get 0 rows affected. (Query took 0.0088 seconds.)

What exactly do I need to replace here

DELETE FROM xf_ip WHERE ip = UNHEX(LPAD(HEX(INET_ATON('1.2.3.4')), 8, '0'));
 
I am not able to do this. I get 0 rows affected. (Query took 0.0088 seconds.)

What exactly do I need to replace here

DELETE FROM xf_ip WHERE ip = UNHEX(LPAD(HEX(INET_ATON('1.2.3.4')), 8, '0'));
nvm this worked for me

SQL:
DELETE
FROM xf_ip
WHERE ip = X'1234567a'
 
Code:
DELETE FROM xf_ip WHERE ip = UNHEX(LPAD(HEX(INET_ATON('1.2.3.4')), 8, '0'));
Change 1.2.3.4 as needed.

I haven't tested this yet, so I'd recommend using the SELECT version to confirm it's grabbing what you expect and, as usual, I'd recommend backing up before running this.

Hi @Mike it seems this query stills work for XenForo 2.2

I want to delete some IP addresses from xf_ip, but was wondering what happens to references? For example, xf_post.ip has no foreign key on xf_ip so if you delete something from xf_ip the post will refer to a non existing record. Is that a problem?
 
Back
Top Bottom