mes Posted March 7, 2005 Share Posted March 7, 2005 Just wondering if there is anyway to find out the ip address of someone who has placed an order.? Thanks Guys, mes Link to comment Share on other sites More sharing options...
boxtel Posted March 7, 2005 Share Posted March 7, 2005 Just wondering if there is anyway to find out the ip address of someone who has placed an order.? Thanks Guys, mes <{POST_SNAPBACK}> $their_ip_address = tep_get_ip_address(); Treasurer MFC Link to comment Share on other sites More sharing options...
mes Posted March 7, 2005 Author Share Posted March 7, 2005 sorry for this but where can i put that code to run it. Can i put that in the invoice? Thanks Boxtel, Mes Link to comment Share on other sites More sharing options...
boxtel Posted March 7, 2005 Share Posted March 7, 2005 sorry for this but where can i put that code to run it. Can i put that in the invoice? Thanks Boxtel, Mes <{POST_SNAPBACK}> you can put this : echo tep_get_ip_address(); anywhere you want the ip address to appear Treasurer MFC Link to comment Share on other sites More sharing options...
mes Posted March 7, 2005 Author Share Posted March 7, 2005 I have put it in the invoice as <?php echo tep_get_ip_address(); ?> but i just get the following error? Fatal error: Call to undefined function: tep_get_ip_address() any ideas? thanks mes Link to comment Share on other sites More sharing options...
mes Posted March 8, 2005 Author Share Posted March 8, 2005 any idea on how to define this function properly? cheers, mes Link to comment Share on other sites More sharing options...
boxtel Posted March 8, 2005 Share Posted March 8, 2005 I have put it in the invoice as <?php echo tep_get_ip_address(); ?> but i just get the following error? Fatal error: Call to undefined function: tep_get_ip_address() any ideas? thanks mes <{POST_SNAPBACK}> this function should be defined in your general.php file. It is in the default install. function tep_get_ip_address() { if (isset($_SERVER)) { if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } else { $ip = $_SERVER['REMOTE_ADDR']; } } else { if (getenv('HTTP_X_FORWARDED_FOR')) { $ip = getenv('HTTP_X_FORWARDED_FOR'); } elseif (getenv('HTTP_CLIENT_IP')) { $ip = getenv('HTTP_CLIENT_IP'); } else { $ip = getenv('REMOTE_ADDR'); } } return $ip; } Treasurer MFC Link to comment Share on other sites More sharing options...
bglkk Posted March 8, 2005 Share Posted March 8, 2005 I have put it in the invoice as <?php echo tep_get_ip_address(); ?> but i just get the following error? Fatal error: Call to undefined function: tep_get_ip_address() <{POST_SNAPBACK}> I just tried inserting this in admin/orders.php, and got the same error message. Yes, the function is defined in catalog/includes/functions/general.php...it is also called in includes/application_top.php. Wouldn't it also need to be defined in /catalog/admin/includes/functions/general.php if you're calling from an admin page? Just checking... :) "Buy the ticket, take the ride..." -HST Link to comment Share on other sites More sharing options...
boxtel Posted March 8, 2005 Share Posted March 8, 2005 I just tried inserting this in admin/orders.php, and got the same error message. Yes, the function is defined in catalog/includes/functions/general.php...it is also called in includes/application_top.php. Wouldn't it also need to be defined in /catalog/admin/includes/functions/general.php if you're calling from an admin page? Just checking... :) <{POST_SNAPBACK}> not really, this function gets the ip address of the person online. when you are in orders.php to look at orders, this function would get your ip address. if you want the ip address of the person who ordered to show in orders.php then you will have to use this function in checkout_process.php and insert it in the database when saving the order. Then in orders.php you can retrieve it again from the database to display it in your admin section. Treasurer MFC Link to comment Share on other sites More sharing options...
bglkk Posted March 8, 2005 Share Posted March 8, 2005 not really, this function gets the ip address of the person online. when you are in orders.php to look at orders, this function would get your ip address. if you want the ip address of the person who ordered to show in orders.php then you will have to use this function in checkout_process.php and insert it in the database when saving the order. Then in orders.php you can retrieve it again from the database to display it in your admin section. <{POST_SNAPBACK}> Thanks, got it...with a little help from the Order IP Recorder contribution. But I'm still puzzled by tep_get_ip_address(); Not used in Order IP Recorder, nor in Who's Online. It seems to be called only by application_top.php for the Check IP Address feature. What else is it good for, and how to use it without getting a fatal error? "Buy the ticket, take the ride..." -HST Link to comment Share on other sites More sharing options...
bglkk Posted March 8, 2005 Share Posted March 8, 2005 Found another call, in the Contact Us Choice contribution (catalog/contact_us.php). // add IP address and preamble text to message body $enquiry = sprintf(EMAIL_PREAMBLE_TEXT, $sender_type) . " " . tep_get_ip_address() . "\n-----------------------\n" . $enquiry; "Buy the ticket, take the ride..." -HST Link to comment Share on other sites More sharing options...
TCwho Posted March 8, 2005 Share Posted March 8, 2005 This contribution already does this. It shows the customers ip address when you view the order: http://www.oscommerce.com/community/contri...arch,ip+logging Drop_Shadow How Did You Hear About Us Email HTML Order Link ---- GMT -5:00 Link to comment Share on other sites More sharing options...
geoffwin Posted June 15, 2005 Share Posted June 15, 2005 I found this thread to be helpful and I can understand the process of calling the IP a little better now. I have used tep_get_ip_address(); to call the IP address for my page footer, it appears to call the IP OK but before the IP it always displays "unknown," eg Your IP address is:unknown, 203.219.255.2 I have looked at the defines for the tep_get_ip_address(); but cannot find any refeence to "unknown" Here is the define function tep_get_ip_address() { if (isset($_SERVER)) { if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } else { $ip = $_SERVER['REMOTE_ADDR']; } } else { if (getenv('HTTP_X_FORWARDED_FOR')) { $ip = getenv('HTTP_X_FORWARDED_FOR'); } elseif (getenv('HTTP_CLIENT_IP')) { $ip = getenv('HTTP_CLIENT_IP'); } else { $ip = getenv('REMOTE_ADDR'); } } return $ip; Any idea why it displays "unknown" and can I resolve / remove this thanks Geoff Geoff Telegraph Point 2441 Australia Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.