Q: Somehow $_SERVER['REMOTE_ADDR'] is not giving me the IP address of this one user..? I've got a basic application form on my website that uses $_SERVER['REMOTE_ADDR'] to include the IP address of the user submitting the form.
I'm using the following in my form processor script.
// Create database object and connect to database.
$db = new Database($db_host, $db_username, $db_password, $db_name);
$db->connect();

// Collect POST data
$merchant_data['ip_address'] = $_SERVER['REMOTE_ADDR'];
$merchant_data['first_name'] = isset($_POST['first_name']) ? $_POST['first_name'] : '';
$merchant_data['last_name'] = isset($_POST['last_name']) ? $_POST['last_name'] : '';
$merchant_data['email_address'] = isset($_POST['email']) ? $_POST['email'] : '';
$merchant_data['phone_number'] = isset($_POST['phone']) ? $_POST['phone'] : '';
$merchant_data['customer_notes'] = isset($_POST['comments']) ? $_POST['comments'] : '';
$merchant_data['plan_name'] = isset($_POST['plan_name']) ? $_POST['plan_name'] : '';
$merchant_data['estimated_monthly_volume'] = $_SESSION['estimated_monthly_volume']; 
$merchant_data['interested_in'] = isset($_POST['interested_in']) ? $_POST['interested_in'] : '';
$merchant_data['additional_equipment_interest'] = isset($_POST['additional_equipment_interest']) ? serialize($_POST['additional_equipment_interest']) : '';
$additional_equipment_interest = isset($_POST['additional_equipment_interest']) ? $_POST['additional_equipment_interest'] : array();
$merchant_data['website_id'] = 1;

// Add new record in database.
$merchant_app_record_id = $db->query_insert('merchant_account_applications',$merchant_data);

// Close database connection
$db->close();

I've been getting some SPAM hits to this form lately by somebody, but somehow, this user's IP address is not getting logged in my system.
Every other user that goes through, though, does end up with the IP address logged.  
What could this person be doing to make it so my site can't grab their IP address?  I want to ban their IP but I can't get it.
Any information on how to get their IP or another way to ban a particular user would be greatly appreciated.

A: Use this: https://gist.github.com/cballou/2201933
This works in my blog site. I don't know why $_SERVER['REMOTE_ADDR'] cannot handle this problem, but the snippet in the github works very well.

A: I had this happen when a user was using a proxy (that he had set up himself) - instead of an IP address I was getting something like "neil@mars" because that's what he'd configured in his proxy.
In addition to 
$_SERVER['REMOTE_ADDR']

you can try
getenv('HTTP_X_FORWARDED_FOR')
getenv('HTTP_CLIENT_IP')

