XF 1.5 Remove one IP from database wherever it occurs?

alex2k5

Member
Have a proxy set up server side, so for a while every user was logged with the server's IP. Now when running the "other users" IP check from profile pages, it brings up thousands of users.

I've since added

Code:
$_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_X_FORWARDED_FOR"];

as per other thread's suggestions.

But, want to scrub the server IP so that feature can work properly again.

Any direction? Thanks!
 
You want the xf_ip table. You just need to find the value associated with that IP and delete all of those records.

I am uncertain if newer MySQL IP functions are appropriate here. But you can run this query to return the most used IP values which is probably good enough to determine which value is the offending IP:

Code:
SELECT ip, COUNT(*) AS 'Total', COUNT(DISTINCT user_id) AS 'Unique Users'
FROM xf_ip
GROUP BY ip
ORDER BY Total DESC
LIMIT 0,100

Once you have the value you can delete those records with this query:

Rich (BB code):
DELETE
FROM xf_ip
WHERE ip = X'4930c2c8'

Fill in the value you found in the first query.
 
Top Bottom