Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need help installing IP Address Collector


Criz

Recommended Posts

Hi Everyone!

 

I would like to grab the ip address of customers placing an order (in order to further prevent fraud). I ran into the contribution IP Address Collector v1.0. If anyone has other suggestions for grabbing an ip address :wink: more than welcome. If not, please help me out with the problem below.

 

I am installing it at this moment, but I am experiencing some problems when editing orders.php. I have to replace a piece of code with a new one. It is not clear for me what I exactly need to replace, because the code structure looks really different. Following I include the new code I have to put in the file (located around line 50)

 

// NEW TEP_DB_QUERY ADDED BY BURT - REPLACE THE OLD ONE

tep_db_query("insert into " . TABLE_ORDERS . " (customers_id, customers_name, customers_street_address, customers_suburb, customers_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_country, delivery_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, date_purchased, orders_status, comments, currency, currency_value, ip_address)

values ('" . $customer_id . "', '" . $order->customer['firstname'] . ' ' . $order->customer['lastname'] . "', '" . $order->customer['street_address'] . "', '" . $order->customer['suburb'] . "', '" . $order->customer['city'] . "', '" . $order->customer['postcode'] . "', '" . $order->customer['state'] . "', '" . $order->customer['country'] . "', '" . $order->customer['telephone'] . "', '" . $order->customer['email_address'] . "', '" . $order->customer['format_id'] . "', '" . $order->delivery['firstname']

. ' ' . $order->delivery['lastname'] . "', '" . $order->delivery['street_address'] . "', '" . $order->delivery['suburb'] . "', '" . $order->delivery['city'] . "', '" . $order->delivery['postcode'] . "', '" . $order->delivery['state'] . "', '" . $order->delivery['country'] . "', '" . $order->delivery['format_id'] . "', '" . $order->info['payment_method'] . "', '" . $order->info['cc_type'] . "', '" . $order->info['cc_owner'] . "', '" . $order->info['cc_number'] . "', '" . $order->info['cc_expires'] . "', now(), '" . DEFAULT_ORDERS_STATUS_ID . "', '" . addslashes($order->info['comments']) . "', '" . $order->info['currency'] . "', '" . $order->info['currency_value'] . "', '" . $ip . "')");

// END BURT

 

This is the current code I have around that line:

 

$sql_data_array = array('customers_id' => $customer_id,

'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],

'customers_street_address' => $order->customer['street_address'],

'customers_suburb' => $order->customer['suburb'],

'customers_city' => $order->customer['city'],

'customers_postcode' => $order->customer['postcode'],

'customers_state' => $order->customer['state'],

'customers_country' => $order->customer['country']['title'],

'customers_telephone' => $order->customer['telephone'],

'customers_email_address' => $order->customer['email_address'],

'customers_address_format_id' => $order->customer['format_id'],

'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],

'delivery_street_address' => $order->delivery['street_address'],

'delivery_suburb' => $order->delivery['suburb'],

'delivery_city' => $order->delivery['city'],

'delivery_postcode' => $order->delivery['postcode'],

'delivery_state' => $order->delivery['state'],

'delivery_country' => $order->delivery['country']['title'],

'delivery_address_format_id' => $order->delivery['format_id'],

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

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

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

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

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

'date_purchased' => 'now()',

'orders_status' => DEFAULT_ORDERS_STATUS_ID,

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

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

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

tep_db_perform(TABLE_ORDERS, $sql_data_array);

$insert_id = tep_db_insert_id();

for ($i=0; $i<sizeof($order_totals); $i++) {

$sql_data_array = array('orders_id' => $insert_id,

'title' => $order_totals[$i]['title'],

'text' => $order_totals[$i]['text'],

'value' => $order_totals[$i]['value'],

'class' => $order_totals[$i]['code'],

'sort_order' => $order_totals[$i]['sort_order']);

tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);

}

 

$customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';

$sql_data_array = array('orders_id' => $insert_id,

'new_value' => DEFAULT_ORDERS_STATUS_ID,

'date_added' => 'now()',

'customer_notified' => $customer_notification);

tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

 

Please help me out here, and sorry for the mess with all the codes :wink:

 

Thanks,

 

Chris

Link to comment
Share on other sites

Hi Criz,

 

First you would need to change:

 

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

to:

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

 

then after that add:

'ip_address' => $ip );

 

For Example:

 

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

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

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

                         'ip_address' => $ip );

 

David

Link to comment
Share on other sites

  • 5 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...