That's odd, anyway...
Create a page with just:
<?
php
phpinfo();
echo($_SERVER['REMOTE_ADDR']);
?>
and see if that page returns the values you want.
About the edit...
$user_ip = $_SERVER['REMOTE_ADDR'];// Get the users IP.
there's remote_addr and there's http_x_forwarded_for.
For example, I am required by my ISP to use a proxy server (so in this case remote_addr will return the proxy's server IP address ). If I would browse your website I would also send you a variable called http_x_forwarded_for which is my real IP address and not the proxy's.
So I'm not sure what you are using this script for but you might want to check both.
Mind you, this isn't bulletproof even when using both remote_addr and http_x_forwarded_for.
Hope that made sence,
Breezing