Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

IP logging with M1??


mcgyver7923

Recommended Posts

Hello,

I have found some code regarding IP logging in earlier versions of OSC, but I cannot figure out how to implement it into M1 with the new array setup (I think this is what is different). Below is the code that is supposed to be placed within the checkout_process.php file. I have created an extra field in the table "orders" in the databse called "customer_ip_address" TYPE=varchar Length=15.

 

here's the entire (all on ONE line) string with the appropriate edits:

 

tep_db_query("insert into " . TABLE_ORDERS . " (customers_id, customers_name, customers_street_address, customers_suburb, custom

ers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_

format_id, delivery_name, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_cou

ntry, delivery_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, date_purchased, shipping_cost, shippin

g_method, orders_status, comments, currency, currency_value,customer_ip_address) values ('" . $customer_id . "', '" . $customer_na

me . "', '" . $customer_values['customers_street_address'] . "', '" . $customer_values['customers_suburb'] . "', '" . $customer_va

lues['customers_city'] . "', '" . $customer_values['customers_postcode'] . "', '" . $cust_state . "', '" . $customers_country['cou

ntries_name'] . "', '" . $customer_values['customers_telephone'] . "', '" . $customer_values['customers_email_address'] . "', '" .

$cust_fmt_id . "', '" . $delivery_name . "', '" . $delivery_values['street_address'] . "', '" . $delivery_values['suburb'] . "',

'" . $delivery_values['city'] . "', '" . $delivery_values['postcode'] . "', '" . $del_state . "', '" . $delivery_country['countrie

s_name'] . "', '" . $del_fmt_id . "', '" . $payment . "', '" . $GLOBALS['cc_type'] . "', '" . $GLOBALS['cc_owner'] . "', '" . $GLO

BALS['cc_number'] . "', '" . $GLOBALS['cc_expires'] . "', now(), '" . $GLOBALS['shipping_cost'] . "', '" . $GLOBALS['shipping_meth

od'] . "', '" . DEFAULT_ORDERS_STATUS_ID . "', '" . addslashes($comments) . "', '" . $currency . "', '" . $currencies->get_value($

currency) . "','" . $REMOTE_ADDR . "')");

 

You need to edit this line in two places. First, right after the currency_value statement insert the following:

 

,customer_ip_address

 

continue to seach through the line and after $currencies->get_value($

currency) . "' add the following:

 

,'" . $REMOTE_ADDR . "'

 

Now make an order and using phpMyaAdmin you should see the ip address of the machine you used to make the order in the new field in the orders table. What makes this useful is that if a customer uses a number of machines, you'll get the ip address of each one (also, if a customer only uses a single ip address a bogus order will stick out like a sore thumb...)

 

I just can't figure out where to edit the code with these modifications in M1. Any help will be greatly appreciated!!! :lol: :wink:

 

-Richard

-Richard

---------------------------------------------------

Where would I be without the Forums?!?!

Link to comment
Share on other sites

Druide,

I don't really need all that user tracking information. What I need is for the IP to be logged with each order. Maybe someone who knows PHP would be able to figure out how to add the additions stated above to M1. Thank you for your help though. Any more ideas would be greatly appreciated :wink: :D !!

 

-Richard

-Richard

---------------------------------------------------

Where would I be without the Forums?!?!

Link to comment
Share on other sites

it applies with customers status 3.x that store ip&host for each order and reported in admin

 

i think this part will work even with ms1

you'll have to search inside the all contrib where and how i have added this kind of feature.

 

ip & host are also stored in customers login history too

 

the feature is also used with dos_payment that will allow a customer to confirm an order (cod, western union, bank t/t ) when required and then tore the ip & host inside order for confirmation

Link to comment
Share on other sites

Elari,

Thanks but your mod has many more features then I need. I don't want to mess with all that when all I want is to log the IP. Great work with all that stuff though!!! Any other suggestions? I just need to know where to insert that code in my checkout_proccess.php? Can anyone help me with that? Thank you!!

 

-Richard

-Richard

---------------------------------------------------

Where would I be without the Forums?!?!

Link to comment
Share on other sites

At approx line 95 checkout_process.php

 

REPLACE

 

    'currency_value' => $order->info['currency_value']);

 

WITH

 

                          'currency_value' => $order->info['currency_value'],

                         'customer_ip_address' => $REMOTE_ADDR);

 

HTH

Paul

Link to comment
Share on other sites

Paul_w,

 

Thanks so much for the code!!! :D :D :D It works like a champ!!! Any idea how to get that to show on the order in order history?? So I don't have to use PHPMyAdmin to query and get the data out of the tables? Thanks again!!!

 

-Richard

-Richard

---------------------------------------------------

Where would I be without the Forums?!?!

Link to comment
Share on other sites

I mean in the admin area when you look at a customer's previous orders. So that if I have to revert back to an order I can do it by the customer's name and browse there orders and pull the IP very quickly.

 

Thanks!!!!

 

-Richard

:wink: :D

-Richard

---------------------------------------------------

Where would I be without the Forums?!?!

Link to comment
Share on other sites

I mean in the admin area when you look at a customer's previous orders.  

 

I didn't know you could do that....

 

I can't find that page! How do I get to it?

Link to comment
Share on other sites

I'm not sure. There has to be a php page that is depicting what information to show on the orders. I'm just not sure which one. :roll: I'll try and figure it out but I still wouldn't know what code to add for adding the IP :cry: . Let me know if you figure it out :) , and I'll do the same!!!

 

-Richard

-Richard

---------------------------------------------------

Where would I be without the Forums?!?!

Link to comment
Share on other sites

You get to a customer's orders by going into the Customers section of the Admin menu and either selecting Customers, picking your customer and selecting orders then edit, or by going directly to Orders and selecting edit for the relevant order.

 

To get the IP address displayed you should change the following 3 files (after taking copies!):

 

In admin/includes/languages/english.php add the line

define('ENTRY_IP_ADDRESS', 'IP Address:');

after the line beginning

define('ENTRY_PASSWORD_CONFIRMATION' .......

which is round about line 173

 

In admin/includes/classes/order.php you need a couple of changes:

  • find the first tep_db_query call (line 27-ish)

[*]add your new field (which is customer_ip_address I believe) anywhere in the select part of the statement - I suggest just in front of delivery_name

[*]go down to line 48-ish which begins $this->customer = array('name' ....

[*]within that array statement insert the line

'ip_address' => $order['customer_ip_address'],

before the line beginning 'email_address' => ....

 

In admin/orders.php, we can add the IP address just below the customers email address by:

  • , line 141-ish

[*]2 lines down there is a </tr> tag, followed by a </table> tag on the following line; between these 2 tags insert the following 4 lines

<tr>

<td class="main"><b><?php echo ENTRY_IP_ADDRESS; ?></b></td>

<td class="main"><?php echo $order->customer['ip_address']; ?></td>

</tr>

 

Try it out.

Regards, Wizzud

"It is better to remain silent and be thought a fool, than to open your mouth and remove all doubt."

Link to comment
Share on other sites

Wizzud,

 

Thank you sir!!! It works, and like a champ!! This will make it very easy to go back and retrieve an IP from an old order. Do you think I should contribute the combination of your code, some code from Paul_w and also the code from Joeseph Backo? I know as far as security goes this doesn't help much because of dynamic IP's but there are other uses for this mod. For instance I will be selling pre-paid wireless, and even though my customer will have to enter the proper billing address it will be interesting to see where they are buying from considering my coverage is nationwide. Using this handy URL given to the forum by Salvatore Iozzia [/url]http://visualroute.visualware.com/ you can easily see where purchases are originating from. Anyway you never know when this may come in handy. If anyone else is interested in this I will put it together and contribute. This effectively logs the IP address your customer is using at the time the order is placed, and then places it on the order in admin/orders for easy viewing. Thanks to you all for your help!!

:wink:

-Richard

---------------------------------------------------

Where would I be without the Forums?!?!

Link to comment
Share on other sites

No problem. Glad to be of assistance. Package it by all means.

Regards,

Wizzud.

Regards, Wizzud

"It is better to remain silent and be thought a fool, than to open your mouth and remove all doubt."

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...