X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Logging IP numbers (https://forum.x-cart.com/showthread.php?t=863)

DataViking 04-27-2004 11:54 PM

Thanks, I will try this

POSDepot 05-27-2004 08:21 AM

I'm getting this error when I make the changes above to func.php

"INVALID SQL: 1136 : Column count doesn't match value count at row 1"

Running 3.5.3 Gold

Any ideas anyone?

Randy

B00MER 05-27-2004 08:55 AM

Make sure the columns specified in the SQL query exist and match the values. "insert into $sql_tbl[orders] (columns, columns2) VALUES (values, values2)"

junaid 06-03-2004 04:15 AM

i m getting MYSQL 1136 Error here is my func.php
Quote:

db_query("insert into $sql_tbl[orders] (login, membership, total, giftcert_discount, giftcert_ids, subtotal, shipping_cost, shippingid, tax, tax_gst, tax_pst, total_vat, taxes_applyed, discount, coupon, coupon_discount, date, status, payment_method, flag, details, title, firstname, lastname, company, b_title, b_firstname, b_lastname, b_address, b_city, b_state, b_country, b_zipcode, s_title, s_firstname, s_lastname, s_address, s_city, s_state, s_country, s_zipcode, phone, fax, email, url, reg_numbers, vat_applied) values ('".addslashes($userinfo["login"])."', '".addslashes($userinfo["membership"])."', '$current_order[total_cost]', '$giftcert_discount', '".@$giftcert_str."', '$current_order[subtotal]','$current_order[shipping_cost]', '$cart[shippingid]', '$current_order[tax_cost]', '$current_order[tax_gst]', '$current_order[tax_pst]', '$current_order[total_vat]', '$taxes_applyed', '$current_order[discount]', '".addslashes(@$current_order["coupon"])."', '$current_order[coupon_discount]', '".time()."', '$order_status', '".addslashes($payment_method)."', 'N', '".addslashes(text_crypt($order_details))."', '".addslashes($userinfo["title"])."', '".addslashes($userinfo["firstname"])."', '".addslashes($userinfo["lastname"])."', '".addslashes($userinfo["company"])."', '".addslashes($userinfo["b_title"])."', '".addslashes($userinfo["b_firstname"])."', '".addslashes($userinfo["b_lastname"])."', '".addslashes($userinfo["b_address"])."', '".addslashes($userinfo["b_city"])."', '".addslashes($userinfo["b_state"])."', '".addslashes($userinfo["b_country"])."', '".addslashes($userinfo["b_zipcode"])."', '".addslashes($userinfo["s_title"])."', '".addslashes($userinfo["s_firstname"])."', '".addslashes($userinfo["s_lastname"])."', '".addslashes($userinfo["s_address"])."', '".addslashes($userinfo["s_city"])."', '".addslashes($userinfo["s_state"])."', '".addslashes($userinfo["s_country"])."', '".addslashes($userinfo["s_zipcode"])."', '".addslashes($userinfo["phone"])."', '".addslashes($userinfo["fax"])."', '$userinfo[email]', '".addslashes($userinfo["url"])."','$reg_numbers', '$current_order[vat_applied]','$_SERVER[REMOTE_ADDR]')");
can anybody help me on this

B00MER 06-08-2004 01:01 PM

Code:

db_query("insert into $sql_tbl[orders] (login, membership, total, giftcert_discount, giftcert_ids, subtotal, shipping_cost, shippingid, tax, tax_gst, tax_pst, total_vat, taxes_applyed, discount, coupon, coupon_discount, date, status, payment_method, flag, details, title, firstname, lastname, company, b_title, b_firstname, b_lastname, b_address, b_city, b_state, b_country, b_zipcode, s_title, s_firstname, s_lastname, s_address, s_city, s_state, s_country, s_zipcode, phone, fax, email, url, reg_numbers, vat_applied, ip) values ('".addslashes($userinfo["login"])."', '".addslashes($userinfo["membership"])."', '$current_order[total_cost]', '$giftcert_discount', '".@$giftcert_str."', '$current_order[subtotal]','$current_order[shipping_cost]', '$cart[shippingid]', '$current_order[tax_cost]', '$current_order[tax_gst]', '$current_order[tax_pst]', '$current_order[total_vat]', '$taxes_applyed', '$current_order[discount]', '".addslashes(@$current_order["coupon"])."', '$current_order[coupon_discount]', '".time()."', '$order_status', '".addslashes($payment_method)."', 'N', '".addslashes(text_crypt($order_details))."', '".addslashes($userinfo["title"])."', '".addslashes($userinfo["firstname"])."', '".addslashes($userinfo["lastname"])."', '".addslashes($userinfo["company"])."', '".addslashes($userinfo["b_title"])."', '".addslashes($userinfo["b_firstname"])."', '".addslashes($userinfo["b_lastname"])."', '".addslashes($userinfo["b_address"])."', '".addslashes($userinfo["b_city"])."', '".addslashes($userinfo["b_state"])."', '".addslashes($userinfo["b_country"])."', '".addslashes($userinfo["b_zipcode"])."', '".addslashes($userinfo["s_title"])."', '".addslashes($userinfo["s_firstname"])."', '".addslashes($userinfo["s_lastname"])."', '".addslashes($userinfo["s_address"])."', '".addslashes($userinfo["s_city"])."', '".addslashes($userinfo["s_state"])."', '".addslashes($userinfo["s_country"])."', '".addslashes($userinfo["s_zipcode"])."', '".addslashes($userinfo["phone"])."', '".addslashes($userinfo["fax"])."', '$userinfo[email]', '".addslashes($userinfo["url"])."','$reg_numbers', '$current_order[vat_applied]','$_SERVER[REMOTE_ADDR]')");

NuAlpha 06-09-2004 06:23 PM

Here is a slight improvement for this mod. Add the following directly above "db_query("INSERT INTO $sql_tbl[orders]" in func.php...
Code:

$full_remote_address = $HTTP_SERVER_VARS['REMOTE_ADDR']; // Add all remote address information. (6/9/2004)
if (!empty($HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR']) && $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'] != 'unknown' && $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'] != $HTTP_SERVER_VARS['REMOTE_ADDR'])
        $full_remote_address .= ','.$HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'];
if (!empty($HTTP_SERVER_VARS['HTTP_CLIENT_IP']) && $HTTP_SERVER_VARS['HTTP_CLIENT_IP'] != 'unknown' && $HTTP_SERVER_VARS['HTTP_CLIENT_IP'] != $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'] && $HTTP_SERVER_VARS['HTTP_CLIENT_IP'] != $HTTP_SERVER_VARS['REMOTE_ADDR'])
        $full_remote_address .= ','.$HTTP_SERVER_VARS['HTTP_CLIENT_IP'];


Change...
Code:

'$_SERVER[REMOTE_ADDR]'
...to...
Code:

'".addslashes($full_remote_address)."'

After that, you will need to change the IP field of your database to be VARCHAR 48.

This code is 3.5.8 compatible. If you are using a different version of Xcart, and don't plan to upgrade to 3.5.8, you may wish to change $HTTP_SERVER_VARS to $_SERVER.

If you want more thorough login failure reports, you can also replace the contents of "skin1/mail/html/login_error.tpl" with the following...
Code:


{$lng.eml_login_error}</p>
<table border="0" cellpadding="2" cellspacing="1">
<tr>
<td width="15%" align="right" nowrap>{$lng.lbl_remote_addr}:</td>
<td width="2"></td>
<td>{$smarty.server.REMOTE_ADDR}</td>
</tr>
{if $smarty.server.HTTP_X_FORWARDED_FOR ne "" and $smarty.server.HTTP_X_FORWARDED_FOR ne "unknown"}
<tr>
<td align="right" nowrap>{$lng.lbl_http_x_forwarded_for}:</td>
<td></td>
<td>{$smarty.server.HTTP_X_FORWARDED_FOR}</td>
</tr>
{/if}
{if $smarty.server.HTTP_CLIENT_IP ne "" and $smarty.server.HTTP_CLIENT_IP ne "unknown" and $smarty.server.HTTP_CLIENT_IP ne $smarty.server.HTTP_X_FORWARDED_FOR}
<tr>
<td align="right" nowrap>{$lng.lbl_http_client_ip}:</td>
<td></td>
<td>{$smarty.server.HTTP_CLIENT_IP}</td>
</tr>
{/if}
</table>


In the file "skin1/mail/login_error.tpl", replace the contents with the following...
Code:

{include file="mail/mail_header.tpl" email_needs="no_header"}

{$lng.eml_login_error}

{$lng.lbl_remote_addr}: {$smarty.server.REMOTE_ADDR}
{if $smarty.server.HTTP_X_FORWARDED_FOR ne "" and $smarty.server.HTTP_X_FORWARDED_FOR ne "unknown"}
{$lng.lbl_http_x_forwarded_for}: {$smarty.server.HTTP_X_FORWARDED_FOR}
{/if}
{if $smarty.server.HTTP_CLIENT_IP ne "" and $smarty.server.HTTP_CLIENT_IP ne "unknown" and $smarty.server.HTTP_CLIENT_IP ne $smarty.server.HTTP_X_FORWARDED_FOR}
{$lng.lbl_http_client_ip}: {$smarty.server.HTTP_CLIENT_IP}
{/if}

{include file="mail/signature.tpl" email_needs="no_signature"}


You will also need to create the language variable "lbl_http_client_ip" which should contain the text "HTTP_CLIENT_IP".

I do give the Xcart developers explicit permission to use these code snippets in the Xcart software and or modify them for their uses.

If anyone has any improvements on this, then please post them here. Thanks! :)

GM 06-10-2004 02:33 AM

You can also add this:
Code:

<tr valign=middle>
<td align=right>{$lng.lbl_user_ip}</td>
<td><font class=Star>*</font></td>
<td nowrap>
<input type=text name=ip readonly size=32 maxlength=128 value="{$smarty.server.REMOTE_ADDR}"></td>
</tr>

to skin1/main/register_contact_info.tpl and it will send the IP in emails etc. :D

also add
Code:

{$lng.lbl_user_ip}:      {$order.ip}
to
skin1/mail/order_invoice.tpl

then create an entry in languages/labels/lbl_user_ip (User IP)

Here's what you get--> http://www.goldmisers.com/customer/register.php


[update] I stayed up all night and incorporated this into my whole site but unfortunately didn't keep track of what I did :oops: anyway, you can figure it out (ie. skin1/mail etc.) I made seperate email forms for different things like "Suggestions" and simple questions with minimul forms for the user to fill out, all the way to the full blown "contact us" form that I use for shipping enquiries only and I incorporated this mod into it to help prevent fraud on that level. It's actually pretty easy to figure out, just play around with it.
One variable would be for example:
Code:

{$lng.lbl_user_ip}:      {$userinfo.ip}
I don't even know if I'm making any sense right now... gotta' go get some sleep 8O I'm starting to see the Matrix 8)

cmtrade 06-16-2004 03:51 AM

Stopped working from some reason
 
The IP logging mod suddenly stopped working on v3.5.8

Any ideas?

Thanks,
Dan.

Emerson 06-16-2004 05:41 AM

Re: Stopped working from some reason
 
Quote:

Originally Posted by cmtrade
The IP logging mod suddenly stopped working on v3.5.8

Any ideas?

Thanks,
Dan.


Same here! :(

B00MER 06-16-2004 06:28 AM

First if you haven't patched the database apply the following SQL query in the patch/upgrade area of the X-Cart admin:

Code:

ALTER TABLE `xcart_orders` ADD `ip` VARCHAR( 15 ) NOT NULL ;

After the patch is successful...

Next, Edit include/func.php find:

Code:

return $orderids;

insert:

Code:

db_query("UPDATE $sql_tbl[orders] SET ip='$_SERVER[REMOTE_ADDR]' WHERE orderid = '$orderid'");

Above the first found line of code "return $orderids;".

This should make the mod work on all future versions as well since its not apart of the original insert for orders to avoid future confusion.


All times are GMT -8. The time now is 11:53 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.