In other words, how can I tell if the person using my web application is on the server it resides on? If I remember correctly, PHPMyAdmin does something like this for security reasons.
Share
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.
You can use
$_SERVER['REMOTE_ADDR'], which contains theIP address of the client requesting it, as given by the web server.
Note: the original version of this answer suggested verifying the destination hostname using $_SERVER[‘HTTP_HOST’], which is unsafe because it could in some cases be spoofed by the requester.