lesterchan / wp-polls

Adds an AJAX poll system to your WordPress blog. You can also easily add a poll into your WordPress's blog post/page.
https://wordpress.org/plugins/wp-polls/
93 stars 78 forks source link

Supports to get IP from nxging #36

Closed heliobentzen closed 6 years ago

heliobentzen commented 9 years ago

It's not possilbe get an IP using nxging as webserver. IP displayed is the same IP from host.

lesterchan commented 9 years ago

How is the IP being passed in the header? Most uses HTTP_X_FORWARDED_FOR if not REMOTE_IP

Upload this file https://gist.github.com/lesterchan/890b6a1d0b7e33d761b7 to your server, see if it does get the IP.

heliobentzen commented 9 years ago

I'm looking now this function:

if(!function_exists('get_ipaddress')) { function get_ipaddress() { if (empty($_SERVER["HTTP_X_FORWARDED_FOR"])) { $ip_address = $_SERVER["REMOTE_ADDR"]; } } else { $ip_address = $_SERVER["HTTP_X_FORWARDED_FOR"]; } if(strpos($ip_address, ',') !== false) { $ip_address = explode(',', $ip_address); $ip_address = $ip_address[0]; } return esc_attr($ip_address); } }

I tried use HTTP_X_REAL_IP instead REMOTE_ADDR, but get it empty.