View Single Post
  #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