Avoid SQL injection in get_ip()

HTTP_X_FORWARDED_FOR is a client data you should absolutely not trust.
It's used in some query sql and can lead to SQL injection.