Paul...
There isn't a big difference between default fetch_alt_ip and yours.
Except yours never returns REMOTE_ADDR as alt_ip. But that's just one line of code, yet you change the whole function... why?
All you need to do is change:
$alt_ip = $_SERVER['REMOTE_ADDR'];
to
$alt_ip = $_SERVER['HTTP_FORWARDED'];
Tell me if I am wrong.
Secondly, what's the need for defining PROXYIP? There is a constant ALT_IP, why not use that?
Interstinly enough, vB does not use ALT_IP at all
I would do it like this: