• Resolved Robert Skiba

    (@robertskiba)


    Hi Peter,

    I really like your plugin and I’ll translate it into german in the next days.

    But there is one thing: Could you please add the option to whitelist Full Qualified Domain Names like “mydomain.dyndns.org”.

    It would make thinks lots easier for developers to whitelist the Dynamic DNS Name if you don’t have a fixed IP Address. Until now, I have to change the IP Address manually if my DSL Modem gets a new one after some days.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Peter Hardy-vanDoorn

    (@petervandoorn)

    Hi @robertskiba

    Thanks for your kind words and the offer to translate the plugin.

    I’ve had a look into offering FQDN functionality, but I’m afraid that I don’t think it’s going to be possible to add it to the plugin.

    The reason is that this information is not always part of the $_SERVER global. The documentation does say that there is a 'REMOTE_HOST' variable, but that it is not on by default and the server must be configured to provide it.

    There is the gethostbyaddr() PHP function to fetch that information via the IP address, but my reading on the subject has found that it can put quite a heavy load on a site, especially if the DNS for the hosting environment is not properly configured. This could cause long page loads and even timeout failures. This is probably why 'REMOTE_HOST' is turned off by default.

    My own testing has also shown that gethostbyaddr() doesn’t always work – for my own (hosted) server, it only ever gave me back the IP address that I had given it!!

    So, sorry to disappoint, but I think it would add too much possibility for causing problems for the end user of the plugin.

    However, that’s not to say that you couldn’t do it yourself by using the wpjf3_matches hook and writing your own function to test for it. If your server is configured to supply it you can test $_SERVER['REMOTE_HOST'] or, if not, you could use gethostbyaddr($_SERVER['REMOTE_ADDR'])

    For example (I haven’t tested this):

    function my_wpjf3_fqdn_matches( $wpjf3_matches ) {
    	$remote_fqdn = isset( $_SERVER[ 'REMOTE_HOST' ] ) ? $_SERVER[ 'REMOTE_HOST' ] : gethostbyaddr( $_SERVER[ 'REMOTE_ADDR' ] );
    	$my_fqdn = "mydomain.dyndns.org";
    	if ( !empty( $remote_fqdn ) ) {
    		if ( stristr( $remote_fqdn, $my_fqdn ) ) 
    			$wpjf3_matches[] = "<!-- FQDN -->";
    	}
    	return $wpjf3_matches;
    }
    add_filter( "wpjf3_matches", "my_wpjf3_fqdn_matches" );
    Thread Starter Robert Skiba

    (@robertskiba)

    Why don’t you make it much less complicated:

    Lookup and resolve the FQDN-Name (maybe example.mydomain.com), that’s fast and after that, you can compare the IP-address with your existing logic…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘FQDN’ is closed to new replies.