I’m working on a system that relies in $_SERVER[‘REMOTE_ADDR’] to get the user address and check it against a white list of addresses.
Is this approach safe? Or is there a way of forcing values in superglobal variables?
Thank you,
Diogo
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The value itself should be safe from outside injection – it is served by the web server – , but the client IP can be spoofed.
Related good reading: What is the most accurate way to retrieve a user’s correct IP address in PHP?