Issue #3:  All IP addresses are blocked

Update the IP address check to use the $_SERVER value.