Druide Posted March 11, 2003 Share Posted March 11, 2003 http://www.oscommerce.com/community/contributions,1055 Let me know if you like the new version :) or if you find a bug or so too ofcourse... Quote Robert We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;) Link to comment Share on other sites More sharing options...
gdfwilliams Posted March 11, 2003 Share Posted March 11, 2003 Robert - Thanks again for your work on this. Perhaps now is the time to start proposing additional improvements? I have implemented the [view session] fix that you proposed yesterday. While it works well, it detracts slightly from the functionality, IMHO. The advantage to seeing complete sessions is that you can scan through the list, skip over 1-time grabs (like spiders) and focus on the sessions with a lot of action. [view sessions] requires that you look into each session to determine the level of participation by the user. I would propose that this be solved in one of two ways: quick and nasty fix: just implement a click count per session. All it would have to do is count the number of clicks in the session and display it by default. Something like this: A slightly more elegent solution would be to span the results over multiple pages, displaying all session activity by default as before. So, display X# of sessions per page, with the standard span bar to navigate between them: I suppose both solutions could be combined to really optimize usability... Can you think of a way to separate spider traffic? - Greg Quote Link to comment Share on other sites More sharing options...
gdfwilliams Posted March 11, 2003 Share Posted March 11, 2003 to implement click count as described above: Replace: <tr> <td class="dataTableContent" align="right" valign="top"><b><?php echo TABLE_HEADING_IP_ADDRESS ?></b></td> <td class="dataTableContent" valign="top"><a href="http://www.dnsstuff.com/tools/whois.ch?ip=<?php echo $ut['value']['ip_address']; ?>" target="_new"><?php echo $ut['value']['ip_address']; ?></a></td> <td class="dataTableContent" colspan=2 rowspan=2 align="center"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="dataTableContent" align="right" valign="top"><b><?php echo TABLE_HEADING_ENTRY_TIME; ?></b></td> <td class="dataTableContent" colspan="2" valign="top"><?php echo date('H:i:s', $ut['value']['time_entry']); ?></td> <td class="dataTableContent" align="right" valign="top"><b><?php echo TEXT_IDLE_TIME ?></ b></td> <td class="dataTableContent" colspan="2" valign="top"><?php echo date('H:i:s', (time() - $ut['value']['end_time']+ 28800)); ?></td> </tr> <tr> <td class="dataTableContent" align="right" valign="top"><b><?php echo TABLE_HEADING_END_TIME; ?></b></td> <td class="dataTableContent" colspan="2" valign="top"><?php echo date('H:i:s', $ut['value']['end_time']); ?></td> <td class="dataTableContent" align="right" valign="top"><b><?php echo TEXT_TOTAL_TIME ?></b></td> <td class="dataTableContent" colspan="2" valign="top"><?php echo date('H:i:s', ($ut['value']['end_time'] - $ut['value']['time_entry'] + 28800)); ?></td> </table> </td> </tr> With: <tr> <td class="dataTableContent" align="right" valign="top"><b>Click Count:</b></td> <td class="dataTableContent" valign="top"><font color=FF0000><b><?php echo count($ut['value']['last_page_url']);?></b></font></td> <td class="dataTableContent" colspan=2 rowspan=3 align="center"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="dataTableContent" align="right" valign="top"><b><?php echo TABLE_HEADING_ENTRY_TIME; ?></b></td> <td class="dataTableContent" colspan="2" valign="top"><?php echo date('H:i:s', $ut['value']['time_entry']); ?></td> <td class="dataTableContent" align="right" valign="top"><b><?php echo TEXT_IDLE_TIME ?></ b></td> <td class="dataTableContent" colspan="2" valign="top"><?php echo date('H:i:s', (time() - $ut['value']['end_time']+ 28800)); ?></td> </tr> <tr> <td class="dataTableContent" align="right" valign="top"><b><?php echo TABLE_HEADING_END_TIME; ?></b></td> <td class="dataTableContent" colspan="2" valign="top"><?php echo date('H:i:s', $ut['value']['end_time']); ?></td> <td class="dataTableContent" align="right" valign="top"><b><?php echo TEXT_TOTAL_TIME ?></b></td> <td class="dataTableContent" colspan="2" valign="top"><?php echo date('H:i:s', ($ut['value']['end_time'] - $ut['value']['time_entry'] + 28800)); ?></td> </table> </td> </tr> <tr> <td class="dataTableContent" align="right" valign="top"><b><?php echo TABLE_HEADING_IP_ADDRESS ?></b></td> <td class="dataTableContent" valign="top"><a href="http://www.dnsstuff.com/tools/whois.ch?ip=<?php echo $ut['value']['ip_address']; ?>" target="_new"><?php echo $ut['value']['ip_address']; ?></a></td> </tr> Quote Link to comment Share on other sites More sharing options...
Ajeh Posted March 11, 2003 Share Posted March 11, 2003 Could you just run the address against a spider list and mask or delete from the display? Quote Link to comment Share on other sites More sharing options...
Druide Posted March 11, 2003 Author Share Posted March 11, 2003 Greg i have implemented also an option to view ALL tracked pages from ALL sessions check that one out too ;) will check your clickcount option too Quote Robert We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;) Link to comment Share on other sites More sharing options...
57chevy Posted March 11, 2003 Share Posted March 11, 2003 hi rob, i dont get this baby working :cry: there's no additional box showing up i'm using the ms1 version and did all the things stated in the install.txt ... thanks for ur time stephan Quote ... in the end, it will work Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 after the head thumping last night I am leaving it alone, just as it is, and happy to have it! altho, the click count option sounds interesting Quote Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 Hi, I installed the user tracking and it does not show up in the admin. Where is it suppose to be? Quote Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 in your admin/includes/column_left.php file add require(DIR_WS_BOXES . 'user_tracking.php'); Quote Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 Thanks, I have these two listings: TEXT_USERTRACK_CONFIG User Tracking Is this what the title is suppose to say? Quote Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 Also get this error when clicking on the User Tracking link. Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/bandtobo/public_html/catalog/admin/user_tracking.php on line 60 Quote Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 in includes/application_top.php or languages/english.php you can add define('TEXT_USERTRACK_CONFIG','User Track Config'); Quote Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 can you copy and paste your line 60 so i can take a look at it Quote Link to comment Share on other sites More sharing options...
57chevy Posted March 11, 2003 Share Posted March 11, 2003 @ jchasick oh god - life can be so simple ;-) but that was just half of it when i click on user tracking, i get a white screen :cry: .... Quote ... in the end, it will work Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 Line 60-61: tep_db_query("delete from user_tracking where time_last_click < '" . (time() - ($purge * 3600))"'"); echo "<font color=red>" . TEXT_HAS_BEEN_PURGED . "</font><p>"; Whole page: <?php /* $Id: user_tracking.php,v 1.30 2003/03/10 10:20:11 robert Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2002 osCommerce Released under the GNU General Public License Modified by Andrew Edmond Sept 14th, 2002 */ require('includes/application_top.php'); require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); $LIMIT_DISPLAY_SESSIONS = CONFIG_USER_TRACKING_SESSION_LIMIT; // SET to 999999 for unlimited per 24 hour period ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td class="smallText"> <?php if ($purge == '72') { tep_db_query("delete from user_tracking where time_last_click < '" . (time() - ($purge * 3600))"'"); echo "<font color=red>" . TEXT_HAS_BEEN_PURGED . "</font><p>"; } if ($delip == '1') { tep_db_query("DELETE FROM " . TABLE_USER_TRACKING . " WHERE ip_address = '" . CONFIG_USER_TRACKING_EXCLUDED . "'"); echo "<font color=red>" . CONFIG_USER_TRACKING_EXCLUDED . ' has been deleted. </font><p>'; $delip='0'; } if ($delsession) { tep_db_query("DELETE FROM " . TABLE_USER_TRACKING . " WHERE session_id = '" . $delsession . "'"); echo "<font color=red>" . $delsession . ' has been deleted. </font><p>'; } echo EXPLAINATION, "<p>"; // some time routines $time_frame = time(); if ($HTTP_GET_VARS['time']) { $time_frame = $HTTP_GET_VARS['time']; } echo '<b>' . TEXT_SELECT_VIEW .': </b>'; echo '<a href="' . FILENAME_USER_TRACKING . '?time=' ; echo $time_frame - 86400 . '"><font color=blue>' . TEXT_BACK_TO . ' ' . date("M d, Y", $time_frame - 86400) . '</font></a> ' ; if (time() > $time_frame + 86400) { echo '| <a href="' . FILENAME_USER_TRACKING . '?time=' ; echo $time_frame + 86400 . '"><font color=blue>' . TEXT_FORWARD_TO . date("M d, Y", $time_frame + 86400) . '</font></a>'; } else { echo ''; } echo "<p>" . TEXT_DISPLAY_START . $LIMIT_DISPLAY_SESSIONS . TEXT_DISPLAY_END; echo TEXT_PURGE_START . ' <a href="user_tracking.php?purge=72"><font color=blue>'. TEXT_PURGE_RECORDS. '</font></a> ' . TEXT_PURGE_END. '</font><p>'; echo 'Delete all info from IP-Address ' . CONFIG_USER_TRACKING_EXCLUDED . ' <a href="user_tracking.php?delip=1"><font color=blue>'. TEXT_PURGE_RECORDS. '</font></a> </font><p>'; // we need to slurp all the customer tracking information out of the database $whos_online_query = tep_db_query("select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, page_desc," . " session_id from " . TABLE_USER_TRACKING . " where time_entry > " . ($time_frame - 86400) . " and time_entry < " . $time_frame . " order by time_last_click desc"); $results = 0; while ($whos_online = tep_db_fetch_array($whos_online_query)) { $user_tracking[$whos_online['session_id']]['session_id']=$whos_online['session_id']; $user_tracking[$whos_online['session_id']]['ip_address']=$whos_online['ip_address']; $user_tracking[$whos_online['session_id']]['customer_id']=$whos_online['customer_id']; if ($whos_online['full_name'] != 'Guest') $user_tracking[$whos_online['session_id']]['full_name']=$whos_online['full_name']; $user_tracking[$whos_online['session_id']]['last_page_url'][$whos_online['time_last_click']] = $whos_online['last_page_url']; $user_tracking[$whos_online['session_id']]['page_desc'][$whos_online['time_last_click']] = $whos_online['page_desc']; if (($user_tracking[$whos_online['session_id']]['time_entry'] > $whos_online['time_entry']) || (!$user_tracking[$whos_online['session_id']]['time_entry'])) $user_tracking[$whos_online['session_id']]['time_entry'] = $whos_online['time_entry']; if (($user_tracking[$whos_online['session_id']]['end_time'] < $whos_online['time_entry']) || (!$user_tracking[$whos_online['session_id']]['end_time'])) $user_tracking[$whos_online['session_id']]['end_time'] = $whos_online['time_entry']; $results ++; } ?> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td valign="top" align=center><table border="0" width="95%" cellspacing="0" cellpadding="2"> <?php // now let's display it $listed=0; if ($results) while (($ut = each($user_tracking)) && ($listed++ < $LIMIT_DISPLAY_SESSIONS)) { $time_online = (time() - $ut['value']['time_entry']); if ( ((!$HTTP_GET_VARS['info']) || (@$HTTP_GET_VARS['info'] == $ut['value']['session_id'])) && (!$info) ) { $info = $ut['value']['session_id']; } echo ' <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent" colspan="5">'.TABLE_HEADING_SESSION_ID .' <a href="user_tracking.php?time=' . $time_frame . '&viewsession=All"><font color=purple>[show all tracked pages]</font></a></td> <td class="dataTableHeadingContent" colspan="1 width="150">'.TEXT_USER_SHOPPING_CART.'</td> </tr>'; echo ' <tr class="dataTableRowSelected">' . "n"; if ($ut['value']['full_name'] == "") $ut['value']['full_name'] = "Guest"; ?> <td colspan = "5" class="dataTableContent" valign="top"></b><a name="<?php echo $ut['value']['session_id'];?>"><?php echo $ut['value']['full_name'] . '</b>, ' . $ut['value']['session_id'] . ", <a href="user_tracking.php?time=" . $time_frame . "&delsession=" . $ut['value']['session_id'] . ""><font color=red>[delete session]</font></a>" . ", <a href="user_tracking.php?time=" . $time_frame . "&viewsession=" . $ut['value']['session_id'] . "#" . $ut['value']['session_id'] . ""><font color=green>[view pages]</font></a>";?></td> <?php // shopping cart decoding $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $ut['value']['session_id'] . "'"); if (tep_db_num_rows($session_data)) { $session_data = tep_db_fetch_array($session_data); $session_data = trim($session_data['value']); } else { $session_data = @file(tep_session_save_path() . '/sess_' . $ut['value']['session_id']); $session_data = trim($session_data[0]); } $cart = ""; $referer_url = ""; $num_sessions ++; session_decode($session_data); $contents = array(); if (is_object($cart)) { $products = $cart->get_products(); for ($i=0; $i<sizeof($products); $i++) { $contents[] = array('text' => $products[$i]['quantity'] . ' x ' . $products[$i]['name']); } if (sizeof($products) > 0) { $contents[] = array('text' => tep_draw_separator('pixel_black.gif', '100%', '1')); $contents[] = array('align' => 'right', 'text' => TEXT_SHOPPING_CART_SUBTOTAL . ' ' . $currencies->format($cart->show_total(), true, $currency)); } else { $contents[] = array('text' => ' '); } } $heading = array(); if (tep_not_null($contents)) { echo ' <td rowspan="4" valign="top">' . "n"; $box = new box; echo $box->infoBox($heading, $contents); echo ' </td>' . "n"; } else { echo ' <td rowspan="4" valign="top" class="dataTableContent" align="center">session expired' . "n"; echo ' </td>' . "n"; } ?> </tr> <tr> <td class="dataTableContent" align="right" valign="top"><b><?php echo TABLE_HEADING_IP_ADDRESS ?></b></td> <td class="dataTableContent" valign="top"><a href="http://www.dnsstuff.com/tools/whois.ch?ip=<?php echo $ut['value']['ip_address'] ; ?>" target="_new"><?php echo $ut['value']['ip_address'] ; ?></a></td> <td class="dataTableContent" colspan=2 rowspan=2 align="center"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="dataTableContent" align="right" valign="top"><b><?php echo TABLE_HEADING_ENTRY_TIME; ?></b></td> <td class="dataTableContent" colspan="2" valign="top"><?php echo date('H:i:s', $ut['value']['time_entry']); ?></td> <td class="dataTableContent" align="right" valign="top"><b><?php echo TEXT_IDLE_TIME ?></ b></td> <td class="dataTableContent" colspan="2" valign="top"><?php echo date('H:i:s', (time() - $ut['value']['end_time']+ 28800)); ?></td> </tr> <tr> <td class="dataTableContent" align="right" valign="top"><b><?php echo TABLE_HEADING_END_TIME; ?></b></td> <td class="dataTableContent" colspan="2" valign="top"><?php echo date('H:i:s', $ut['value']['end_time']); ?></td> <td class="dataTableContent" align="right" valign="top"><b><?php echo TEXT_TOTAL_TIME ?></b></td> <td class="dataTableContent" colspan="2" valign="top"><?php echo date('H:i:s', ($ut['value']['end_time'] - $ut['value']['time_entry'] + 28800)); ?></td> </table> </td> </tr> <tr> <td class="dataTableContent" align="right" valign="top"><b><?php echo TABLE_HEADING_HOST ?></b></td> <td class="dataTableContent" valign="top"><?php echo gethostbyaddr($ut['value']['ip_address']); ?></td> </tr> <tr> <td class="dataTableContent" align="right" valign="top"><b><?php echo TEXT_ORIGINATING_URL ?></b></td> <?php $ref_name = chunk_split($referer_url,40,"<br>"); ?> <td class="dataTableContent" align="left" valign="top" colspan=3><?php echo '<a href="'.$referer_url.'" target="_new">'. $referer_url .'</a>' ; ?> </td> </tr> <tr> <td class="dataTableContent"></td> <td class="dataTableContent" colspan=3> <table border="0" cellspacing="1" cellpadding="2" bgcolor=999999 width=100%> <?php // insert here if ($viewsession == $ut['value']['session_id'] || $viewsession == 'All'){ while (($pu = each($ut['value']['last_page_url']))&&($du = each($ut['value']['page_desc']))) { ?> <tr bgcolor=ffffff> <td class="dataTableContent" valign=top align="right"><?php echo date('H:i:s', $pu['key']); ?>:</td> <td class="dataTableContent" nowrap valign=top align="left"> <a href="<?php echo $pu['value']; ?>" target="_new"><?php if ($du['value']!=''){ echo $du['value'];} ?></a> </td> <td class="dataTableContent" width=100% align="left"><a href="<?php echo $pu['value']; ?>" target="_new"><?php echo chunk_split($pu['value'],40,"<br>"); ?></a></td> </tr> <?php } } echo' </table> </td> </tr> '; } ?> <tr> <td class="smallText" colspan="7"><?php echo sprintf(TEXT_NUMBER_OF_CUSTOMERS, tep_db_num_rows($whos_online_query)); echo " Total number of customers: " . $num_sessions . "."; ?></td> </tr> </table></td> </tr> </table> </td> </tr> </table></td> <!-- body_text_eof //--> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Quote Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 for both user tracking and config or just user tracking? Quote Link to comment Share on other sites More sharing options...
57chevy Posted March 11, 2003 Share Posted March 11, 2003 @ jchasick .. just for tracking, the config works fine ... Quote ... in the end, it will work Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 modom - are you using the version just put up today or an earlier version - I thought that problem got fixed last night.... :? Quote Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 Just the user tracking link in the admin and I just downloaded the latest one today. Quote Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 version 1.31 Quote Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 try this tep_db_query("delete from user_tracking where time_last_click < '" . (time() - ($purge * 3600))"'"); i was sure that was fixed last night :shock: Quote Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 what am I suppose to do with that code? I'm not a programmer. Quote Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 open the file in a text editor and replace the line of code in the file with the one I posted and see if that fixes your problem Quote Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 No it didn't fix it. It is the same line of code that is on line 60. I copied and replace it in case I was looking at it wrong but get the same error. Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/bandtobo/public_html/catalog/admin/user_tracking.php on line 60 Quote Link to comment Share on other sites More sharing options...
Guest Posted March 11, 2003 Share Posted March 11, 2003 This is now lines 60-63: tep_db_query("delete from user_tracking where time_last_click < '" . (time() - ($purge * 3600))"'"); echo "<font color=red>" . TEXT_HAS_BEEN_PURGED . "</font><p>"; } if ($delip == '1') Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.