1

I have a US based website when customer placed order, in their order "Placed from IP" showing my ip in each order also, I have few custom module for tracking order and user activity in these modules ip is showing mine. it's strange.I am not found the issue.Also when i'm printing ip from root folder then it's working fine.

My module code :

function getUserIP()
    {
        $client  = @$_SERVER['HTTP_CLIENT_IP'];
        $forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
        $remote  = $_SERVER['REMOTE_ADDR'];

        if(filter_var($client, FILTER_VALIDATE_IP))
        {
            $ip = $client;
        }
        elseif(filter_var($forward, FILTER_VALIDATE_IP))
        {
            $ip = $forward;
        }
        else
        {
            $ip = $remote;
        }
        return $ip;
    }

But my concern is Magento default sales/order code should be run fine.

4
  • what code are you using to get client ip? Jan 23, 2017 at 6:02
  • In sales order mageto's default code working
    – Kanika
    Jan 23, 2017 at 6:21
  • Please refer the below link.Best of Luck... go.eway.io/s/article/…
    – Jayesh
    Jan 23, 2017 at 7:21
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review May 27, 2019 at 8:57

1 Answer 1

0

I have fixed the above my issue.

There was a code placed in index.php

if($_SERVER['REMOTE_ADDR'] = '202.164.34.112'){
    Mage::setIsDeveloperMode(true);
    ini_set('display_errors', 1);
} 

I have commented this piece of code and all the thing are working fine now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.