[SOLVED] IP Address doesn't work

Hi folks,

the following code:

[indent]


echo 'Your IP adress is: '.CHttpRequest::getUserHostAddress();

[/indent]should show my IP-adress

The ‘funny’ result is:

[indent]


Your IP adress is: ::1 	

[/indent]? Any idea ?

Using win 7, and both stacks IP4 and IP6 are installed. Could that be the problem ?

Thx.

Scryii

[indent] [/indent]

The function getUserHostAddress() is not a static function. Try




Yii::app()->request->userHostAddress



Which is the expected output since you have ipv6 enabled : ::1 stands for 127.0.0.1 in ipv6. See wikipedia for more details.

Yepp - that it is.

After disabling the IPv6 stack, I get the known 127.0.0.1.

I will read more about v6 and include it in my application tp support v6.

Thx.

Scryii