Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Logging IP numbers

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #21  
Old 04-27-2004, 11:54 PM
  DataViking's Avatar 
DataViking DataViking is offline
 

eXpert
  
Join Date: Jan 2003
Location: Las Vegas, NV
Posts: 361
 

Default

Thanks, I will try this
__________________
Web Design Web Design and Custom X-Cart Projects

http://www.dataviking.com

Mention the forums for discounts!
x-cart Version 4.1.8
Reply With Quote
  #22  
Old 05-27-2004, 08:21 AM
 
POSDepot POSDepot is offline
 

Advanced Member
  
Join Date: Sep 2002
Posts: 52
 

Default

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
Reply With Quote
  #23  
Old 05-27-2004, 08:55 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

Make sure the columns specified in the SQL query exist and match the values. "insert into $sql_tbl[orders] (columns, columns2) VALUES (values, values2)"
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #24  
Old 06-03-2004, 04:15 AM
 
junaid junaid is offline
 

Advanced Member
  
Join Date: Dec 2003
Posts: 96
 

Default

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
__________________
xcart 4.18 on linux
Reply With Quote
  #25  
Old 06-08-2004, 01:01 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

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]')");
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #26  
Old 06-09-2004, 06:23 PM
 
NuAlpha NuAlpha is offline
 

X-Adept
  
Join Date: Aug 2003
Location: US
Posts: 598
 

Default

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!
__________________
X-Cart Pro 4.5.5 Platinum
X-Payments 1.0.6
PHP 5.3.14
MySQL 5.1.68
Apache 2.2.23
Reply With Quote
  #27  
Old 06-10-2004, 02:33 AM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

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.

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 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 I'm starting to see the Matrix
__________________
v. 4.0.14 (GM Style)
O.S. Linux
Build Your Own Diamond Ring
Reply With Quote
  #28  
Old 06-16-2004, 03:51 AM
 
cmtrade cmtrade is offline
 

Advanced Member
  
Join Date: Dec 2003
Location: Florida
Posts: 30
 

Default Stopped working from some reason

The IP logging mod suddenly stopped working on v3.5.8

Any ideas?

Thanks,
Dan.
Reply With Quote
  #29  
Old 06-16-2004, 05:41 AM
 
Emerson Emerson is offline
 

X-Man
  
Join Date: Mar 2004
Location: Atlanta, GA
Posts: 2,209
 

Default 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!
__________________
Emerson
Total Server Solutions LLC- Quality X-Cart Hosting
Recommended X-Cart Hosting Provider - US and UK servers
Does your host backup your site? We do EVERY HOUR!!!
Shared Hosting | Managed Cloud | Dedicated Servers
Reply With Quote
  #30  
Old 06-16-2004, 06:28 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

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.
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:12 PM.

   

 
X-Cart forums © 2001-2020