checking for IP address before validating mysql DB connection