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 securi
I'm sorry but all these answers seem terrible to me. I would suggest rephrasing the question because in a sense all machines are "localhost".
The question should be; How do I run different code paths depending on which machine it is executed on.
In my opinion, the easiest way is to create a file called DEVMACHINE or whatever you want really and then simply check
file_exists('DEVMACHINE')
Remember to exclude this file when uploading to the live hosting environment!
This solution is not depending on network configuration, it can not be spoofed and makes it easy to switch between running "live-code" and "dev-code".