In PHP I retrieve a user's IP address (
$_SERVER['REMOTE_ADDR']) to use it in some MySQL queries, but I do not validate them to be true IP addresses.
Should I validate user IP addresses before using them in MySQL queries, or will they always be valid IP addresses when I use
$_SERVER['REMOTE_ADDR']? I'm trying to prevent an SQL injection.
If I should validate, which PHP function do you recommend to use? Should I send the IP address through