replace direct $SERVER["REMOTE_ADDR"] with function
another $SERVER ip detection replacement
correction on scope for the ip validation