Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Miscellaneous
FindRetros
Help & Support
ForceVoting - Stuck on Redirection
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="JayC" data-source="post: 463079" data-attributes="member: 36373"><p>Hello,</p><p></p><p>I am using this function to get the current user's IP address:</p><p>[CODE]final public function GetCurrentIP(){</p><p> if(!empty($_SERVER['HTTP_CLIENT_IP'])){</p><p> $ip = $_SERVER['HTTP_CLIENT_IP'];</p><p> }elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){</p><p> $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];</p><p> }else{</p><p> $ip = $_SERVER['REMOTE_ADDR'];</p><p> }</p><p> </p><p> return $ip;</p><p> }[/CODE]</p><p></p><p>The code works for most users, but some users have a IPv4 IP returning from my method, but their public IP address is an IPv6 (which I believe is what findretros is getting).</p><p></p><p>I am using the code on the Api.findretros to I just modified it to get the IP address from this function (because my REMOTE_ADDR IP is a VPN).</p><p></p><p>The IP I am using is the HTTP_X_FORWARDED_FOR</p><p></p><p>Thanks,</p><p>Jay</p></blockquote><p></p>
[QUOTE="JayC, post: 463079, member: 36373"] Hello, I am using this function to get the current user's IP address: [CODE]final public function GetCurrentIP(){ if(!empty($_SERVER['HTTP_CLIENT_IP'])){ $ip = $_SERVER['HTTP_CLIENT_IP']; }elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; }else{ $ip = $_SERVER['REMOTE_ADDR']; } return $ip; }[/CODE] The code works for most users, but some users have a IPv4 IP returning from my method, but their public IP address is an IPv6 (which I believe is what findretros is getting). I am using the code on the Api.findretros to I just modified it to get the IP address from this function (because my REMOTE_ADDR IP is a VPN). The IP I am using is the HTTP_X_FORWARDED_FOR Thanks, Jay [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Miscellaneous
FindRetros
Help & Support
ForceVoting - Stuck on Redirection
Top