Added support for IPv6.

This needs PHP 5 >= 5.2.0, because of filter_var.