RE: User Tracking with Admin 1.31 Released

alverman <[email protected]> 13 Sep 2003 23:11:57 -0000
Newsgroups gmane.comp.web.oscommerce.contributions
Message-ID <7ee2e87e1f8be5fbc3f007800ca736e9@osCommerce-Forums>
This message was sent from: Contributions
http://forums.oscommerce.com/viewtopic.php?p=229127#229127
----------------------------------------------------------------

I do not know in which log file you can see the info but this is the way I did, adding a db field to record the "referer_url" when the user enters the page (if there's a reason why it has not been done this way, please post).
I'm using [b]User Tracking with Admin 1.34[/b]

please [b]BACKUP[/b] and:

add a db field to user_tracking table :[code]referer_url varchar(128) NOT NULL default ''[/code]
in [b]catalog/includes/functions/user_tracking.php[/b] after line 57 (before $current_time = time(); ) add
[code]$HTTP_SERVER_VARS =& $_SERVER;
$wo_referer_url = ($HTTP_SERVER_VARS['HTTP_REFERER'] == '') ?  $wo_last_page_url : $HTTP_SERVER_VARS['HTTP_REFERER'];[/code]
at bottom page change the query to:
[code]tep_db_query("insert into " . TABLE_USER_TRACKING . " (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url, page_desc, referer_url) values ('" . $wo_customer_id . "', '" . $wo_full_name . "', '" . $wo_session_id . "', '" . $wo_ip_address . "', '" . $current_time . "', '" . $current_time . "', '" . $wo_last_page_url . "', '" . $page_desc . "', '" . $wo_referer_url . "')");[/code]
then in [b]admin/user_tracking.php[/b] the "$whos_online_query" (around line 103) change to:[code]tep_db_query("select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, page_desc, referer_url," .[/code] 
line 113 [b]below[/b]  $user_tracking[$whos_online['session_id']]['customer_id']=$whos_online['customer_id'];
 
add: [code]$user_tracking[$whos_online['session_id']]['referer_url']=$whos_online['referer_url'];[/code]

around line 250 replace [code]<td class="dataTableContent" align="left" valign="top" colspan=3><?php echo '<a href="'.$referer_url.'" target="_new">'. $referer_url .'</a>' ; ?>&nbsp;</td>[/code] 
with:[code]<td class="dataTableContent" align="left" valign="top" colspan=3><?php echo '<a href="'. $ut['value']['referer_url'] .'" target="_new">'. $ut['value']['referer_url'] .'</a>' ; ?>&nbsp;</td>[/code]
I'm not aware of a different way, maybe the same infos can be retrieved more easily but it seems to work so ...
... did I tell you to BACKUP first ?