Weird, is that a know issue?
Weird, is that a know issue?
I'm not sure what you meant. Why issue?
Sorry for unclear description.
[_remote_ip] gives me the ip of my webserver, I expected the ip of the user who fills in the form.
Took a look at the module in special-mail-tags.php
There $_SERVER['REMOTE_ADDR'] is used. This can cause the described issue, it returns an internal proxy-ip of the provider (actually not my webserver) in my case. See e.g. here.
Possible replacement for current [_remote_ip] handling:
if ( '_remote_ip' == $name ) {
$_ip_addr = $_SERVER['REMOTE_ADDR'];
if ( array_key_exists( 'HTTP_X_FORWARDED_FOR', $_SERVER ) )
$_ip_addr = array_pop( explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] ) );
$output = preg_replace( '/[^0-9a-f.:, ]/', '', $_ip_addr );
}
Added also another field [_remote_host] which returns the hostname, if possible, otherwise the ip:
elseif ( '_remote_host' == $name ) {
$_ip_addr = $_SERVER['REMOTE_ADDR'];
if ( array_key_exists( 'HTTP_X_FORWARDED_FOR', $_SERVER ) )
$_ip_addr = array_pop( explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] ) );
$output = @gethostbyaddr( $_ip_addr );
}
Example mail-tags: IP: [_remote_host] ([_remote_ip])
Example result: IP: some.provider.domain.net (xx.xxx.xxx.xx)
Feel free to use the code. Thanks for your great plugin!
That makes sense. Thank you.
After some more research it turns out that this problem is known to WordPress developers since quite a while with no solution yet available.
A comment has been added to php source of /wp-includes/comment.php which points to http://core.trac.wordpress.org/ticket/9235
A possible "easy" solution besides patching wp-config.php or similar seems to be a plugin like Proxy Real IP: http://wordpress.org/extend/plugins/proxy-real-ip/
You must log in to post.