
12-18-2009, 11:51 PM
|
|
|
|
 X-Adept
|
|
Join Date: Dec 2008
Posts: 807
|
|
|
Re: Display Customer IP during checkout
Quote:
Originally Posted by B00MER
I don't think the default takes Proxies or IP's behind LAN's into consideration. Here's a function that can easily be used in config.php to grab the absolute IP of the user. Thanks to NuLime for the function.
Code:
function fetch_remote_address() {
$_SERVER = $GLOBALS['HTTP_SERVER_VARS'];
# Record basic remote address.
$remote_address = $_SERVER['REMOTE_ADDR'];
# Take proxies into consideration or IPs behind a LAN.
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != 'unknown' && $_SERVER['HTTP_X_FORWARDED_FOR'] != $_SERVER['REMOTE_ADDR']) {
$HXFF_temp = preg_replace('/, ?unknown/i','',$_SERVER['HTTP_X_FORWARDED_FOR']); // Remove any trailing 'unknowns'.
$remote_address .= ','.$HXFF_temp;
}
if (isset($_SERVER['HTTP_CLIENT_IP']) && $_SERVER['HTTP_CLIENT_IP'] != 'unknown' && $_SERVER['HTTP_CLIENT_IP'] != $_SERVER['HTTP_X_FORWARDED_FOR'] && $_SERVER['HTTP_CLIENT_IP'] != $_SERVER['REMOTE_ADDR']) {
$HCI_temp = preg_replace('/, ?unknown/i','',$_SERVER['HTTP_CLIENT_IP']); // Remove any trailing 'unknowns'.
$remote_address .= ','.$HCI_temp;
}
return $remote_address;
}
|
Quote:
Originally Posted by anandat
That means you will have to put {$customers_ip} in .tpl file where you want to display IP address.
For example if you want to show IP on checkout page then place following code at the end of the file cart_totals.tpl
which is at skin1/customer/main/cart_totals.tpl
Code:
<font color=red>*NOTE*</font> Your IP address : {$customers_ip} is tracked during the checkout process as part of our anti-fraud technology.
|
Hi anandat can you help me-
1) what is the exact code for displaying ip address?
2)Can you able to do it successfully ?
3)Is it possible to track customers private ip address from this?
Actually I cannot able to do display the ip address.I want to do this.
Can you help me?
Can anyone help me...
__________________
4.6.1 Platinum
|
|