Quantcast
Channel: WordPress.org Forums » [Contact Form 7] Support
Viewing all articles
Browse latest Browse all 49500

vrazinkov on "[Plugin: Contact Form 7] Client IP detection"

$
0
0

Hello!

Client IP address detection is not working correctly if a site is running behind a proxy.
For this to be corrected modules\special-mail-tags.php should be altered as follows:

if ( '_remote_ip' == $name )
		if ( $_SERVER['HTTP_CLIENT_IP'] ) $output = preg_replace( '/[^0-9a-f.:, ]/', '', $_SERVER['HTTP_CLIENT_IP'] );
		else if ( $_SERVER['HTTP_X_FORWARDED_FOR'] ) $output = preg_replace( '/[^0-9a-f.:, ]/', '', $_SERVER['HTTP_X_FORWARDED_FOR'] );
		else if ( $_SERVER['REMOTE_ADDR'] ) $output = preg_replace( '/[^0-9a-f.:, ]/', '', $_SERVER['REMOTE_ADDR'] );
		else $output = "Undetected IP address";

If someone has any better proposal, please feel free to share your ideas.

http://wordpress.org/plugins/contact-form-7/


Viewing all articles
Browse latest Browse all 49500

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>