Yii Framework Forum: User's Ip Address - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

User's Ip Address Rate Topic: -----

#1 User is offline   Nisanth thulasi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 68
  • Joined: 10-July 12
  • Location:Kochi

Posted 13 March 2013 - 04:01 AM

Retrieving User's IP address
CHttpRequest::getUserHostAddress(); 

Thanks
Nisanth Thulasi
0

#2 User is offline   Boaz 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 367
  • Joined: 23-January 11

Posted 13 March 2013 - 04:13 AM

This will give you highly inaccurate results for lots of users that are using VPN's, company's proxy/firewall and more... .
I've written back then an extension that includes a handy method that gives more accurate results back. If you're interested, check out PcMaxmindGeoIp extension and in specific, the method getRemoteIpAddress() provided by it.
Therapeutic PHP sessions My LinkedIn Profile
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users