Guest Posted June 19, 2005 Share Posted June 19, 2005 OOPS - TYPO >_< These lines of code came from my Catalog/admin/whos online.php at line 343. Could you check to see if your file looks the same there? I got the file straight out of the contribution download and if I do not comment out those lines my admin panel throws the error. <{POST_SNAPBACK}> Mark Yes those lines are in that file. The below is my copy of the catalog/admin/whos_online.php file. slightly moded but nothing that should impact anything, just layout. I will also post the admin/includes/launguages/english/whos_online.php because this is tied in with the my slightly mod'd file. Hope this helps. <?php /* $Id: whos_online.php,v 1.32 2003/06/29 22:50:52 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); /* Configuration Values Set these to easily personalize your Whos Online */ // Seconds that a visitor is considered "active" $active_time = 300; // Seconds before visitor is removed from display $track_time = 900; // Automatic refresh times in seconds and display names // Time and Display Text order must match between the arrays // "None" is handled separately in the code $refresh_time = array( 30, 120, 300, 600 ); $refresh_display = array( ':30', '2:00', '5:00', '10:00' ); // Images used for status lights $status_active_cart = 'icon_status_green.gif'; $status_inactive_cart = 'icon_status_red.gif'; $status_active_nocart = 'icon_status_green_light.gif'; $status_inactive_nocart = 'icon_status_red_light.gif'; $status_active_bot = 'icon_status_green_border_light.gif'; $status_inactive_bot = 'icon_status_red_border_light.gif'; // Text color used for table entries // Different colored text for different users // Named colors and Hex values should work fine here $fg_color_bot = 'maroon'; $fg_color_admin = 'darkblue'; $fg_color_guest = 'green'; $fg_color_account = '#000000'; // Black /* Determines status and cart of visitor and displays appropriate icon. */ function tep_check_cart($which, $customer_id, $session_id) { global $cart, $status_active_cart, $status_inactive_cart, $status_active_nocart, $status_inactive_nocart, $status_inactive_bot, $status_active_bot, $active_time; // Pull Session data from the correct source. if (STORE_SESSIONS == 'mysql') { $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $session_id . "'"); $session_data = tep_db_fetch_array($session_data); $session_data = trim($session_data['value']); } else { if ( (file_exists(DIR_FS_CATALOG . tep_session_save_path() . '/sess_' . $session_id)) && (filesize(DIR_FS_CATALOG . tep_session_save_path() . '/sess_' . $session_id) > 0) ) { $session_data = file(DIR_FS_CATALOG . tep_session_save_path() . '/sess_' . $session_id); $session_data = trim(implode('', $session_data)); } } if ($length = strlen($session_data)) { if (PHP_VERSION < 4) { $start_id = strpos($session_data, 'customer_id[==]s'); $start_cart = strpos($session_data, 'cart[==]o'); $start_currency = strpos($session_data, 'currency[==]s'); $start_country = strpos($session_data, 'customer_country_id[==]s'); $start_zone = strpos($session_data, 'customer_zone_id[==]s'); } else { $start_id = strpos($session_data, 'customer_id|s'); $start_cart = strpos($session_data, 'cart|O'); $start_currency = strpos($session_data, 'currency|s'); $start_country = strpos($session_data, 'customer_country_id|s'); $start_zone = strpos($session_data, 'customer_zone_id|s'); } for ($i=$start_cart; $i<$length; $i++) { if ($session_data[$i] == '{') { if (isset($tag)) { $tag++; } else { $tag = 1; } } elseif ($session_data[$i] == '}') { $tag--; } elseif ( (isset($tag)) && ($tag < 1) ) { break; } } $session_data_id = substr($session_data, $start_id, (strpos($session_data, ';', $start_id) - $start_id + 1)); $session_data_cart = substr($session_data, $start_cart, $i); $session_data_currency = substr($session_data, $start_currency, (strpos($session_data, ';', $start_currency) - $start_currency + 1)); $session_data_country = substr($session_data, $start_country, (strpos($session_data, ';', $start_country) - $start_country + 1)); $session_data_zone = substr($session_data, $start_zone, (strpos($session_data, ';', $start_zone) - $start_zone + 1)); session_decode($session_data_id); session_decode($session_data_currency); session_decode($session_data_country); session_decode($session_data_zone); session_decode($session_data_cart); if (PHP_VERSION < 4) { $broken_cart = $cart; $cart = new shoppingCart; $cart->unserialize($broken_cart); } if (is_object($cart)) { $products = $cart->get_products(); } } $which_query = $session_data; $who_data = tep_db_query(("select session_id, time_entry, time_last_click from " . TABLE_WHOS_ONLINE . " where session_id='" . $which . "'")); $who_query = tep_db_fetch_array($who_data); // Determine if visitor active/inactive $xx_mins_ago_long = (time() - $active_time); // Determine Bot active/inactive if( $customer_id < 0 ) { // inactive if ($who_query['time_last_click'] < $xx_mins_ago_long) { return tep_image(DIR_WS_IMAGES . $status_inactive_bot, TEXT_STATUS_INACTIVE_BOT); // active } else { return tep_image(DIR_WS_IMAGES . $status_active_bot, TEXT_STATUS_ACTIVE_BOT); } } // Determine active/inactive and cart/no cart status // no cart if ( sizeof($products) == 0 ) { // inactive if ($who_query['time_last_click'] < $xx_mins_ago_long) { return tep_image(DIR_WS_IMAGES . $status_inactive_nocart, TEXT_STATUS_INACTIVE_NOCART); // active } else { return tep_image(DIR_WS_IMAGES . $status_active_nocart, TEXT_STATUS_ACTIVE_NOCART); } // cart } else { // inactive if ($who_query['time_last_click'] < $xx_mins_ago_long) { return tep_image(DIR_WS_IMAGES . $status_inactive_cart, TEXT_STATUS_INACTIVE_CART); // active } else { return tep_image(DIR_WS_IMAGES . $status_active_cart, TEXT_STATUS_ACTIVE_CART); } } } // WOL 1.5 EOF /* Display the details about a visitor */ function display_details() { global $whos_online, $is_bot, $is_admin, $is_guest, $is_account; // Display Name/User Agent echo '<b>' . ($is_bot ? 'User Agent: ' : 'Name: ') . '</b>' . $whos_online['full_name']; echo '<br clear="all">' . tep_draw_separator('pixel_trans.gif', '10', '4') . '<br clear="all">'; // Display Customer ID for non-bots if ( !$is_bot ){ echo '<b>Customer ID:</b> ' . $whos_online['customer_id']; echo '<br clear="all">' . tep_draw_separator('pixel_trans.gif', '10', '4') . '<br clear="all">'; } // Display IP Address echo '<b>IP Address:</b> ' . $whos_online['ip_address']; echo '<br clear="all">' . tep_draw_separator('pixel_trans.gif', '10', '4') . '<br clear="all">'; // Display Session ID if available if ( $whos_online['session_id'] != "" ) { echo '<b>osCid:</b> ' . $whos_online['session_id']; echo '<br clear="all">' . tep_draw_separator('pixel_trans.gif', '10', '4') . '<br clear="all">'; } // Display Referrer if available if($whos_online['http_referer'] != "" ) { echo '<b>Referer:</b> ' . $whos_online['http_referer']; echo '<br clear="all">' . tep_draw_separator('pixel_trans.gif', '10', '4') . '<br clear="all">'; } } // Time to remove old entries $xx_mins_ago = (time() - $track_time); // remove entries that have expired tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where time_last_click < '" . $xx_mins_ago . "'"); ?> <!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; ?>"> <!-- WOL 1.6 - Cleaned up refresh --> <?php if( $_SERVER["QUERY_STRING"] > 0 ){ ?> <meta http-equiv="refresh" content="<?php echo $_SERVER["QUERY_STRING"];?>;URL=whos_online.php?<?php echo $_SERVER["QUERY_STRING"];?>"> <?php } ?> <!-- WOL 1.6 EOF --> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> <!--CSS DROP DOWN SCRIPT--> <script type="text/javascript"> function shownavtable(elmnt) { document.getElementById(elmnt).style.visibility="visible" } function hidenavtable(elmnt) { document.getElementById(elmnt).style.visibility="hidden" } </script> <!--CSS DROP DOWN SCRIPT--> <script language="javascript" src="includes/general.js"></script> </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> <!-- 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 valign="bottom" class="pageHeading" colspan="3"><?php echo HEADING_TITLE; ?><div align="center"><font size="2" face="Arial" color="#000000">Last Refresh: </font> <script language="JavaScript"> <!-- Begin Stamp = new Date(); document.write('<font size="2" face="Arial"><B>' + (Stamp.getMonth() + 1) +"/"+Stamp.getDate()+ "/"+Stamp.getYear() + '</B></font> '); var Hours; var Mins; var Time; Hours = Stamp.getHours(); if (Hours >= 12) { Time = " p.m."; } else { Time = " a.m."; } if (Hours > 12) { Hours -= 12; } if (Hours == 0) { Hours = 12; } Mins = Stamp.getMinutes(); if (Mins < 10) { Mins = "0" + Mins; } document.write('<font size="2" face="Arial"><B>' + Hours + ":" + Mins + Time + '</B></font>'); // End --> </script></div> <br clear="all"><span class="smallText" style="color:#909090">Set Refresh Rate:</span> <span class="dataTableContent" style="font-size: 10px; color:#000000"> <!-- For loop displays refresh time links --> <?php echo '<a href="whos_online.php"><b>None</b></a>'; foreach ($refresh_time as $key => $value) { echo ' ? <a href="whos_online.php?' . $value . '"><b>' . $refresh_display[$key] . '</b></a>'; } ?> <!-- Display Profile links --> <br clear="all"> <span class="smallText" style="color:#909090">Profile Display:</span> <a href="whos_online.php"><b>None</b></a> ? <a href="whos_online.php?showAll"><b>All</b></a> ? <a href="whos_online.php?showBots"><b>Bots</b></a> ? <a href="whos_online.php?showCust"><b>Customers</b></a> </span> </td> <!-- Status Legend - Uses variables for image names --> <td rowspan="2" align="right" class="smallText"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td class="smallText"><?php echo tep_image(DIR_WS_IMAGES . $status_active_cart, TEXT_STATUS_ACTIVE_CART) . ' ' . TEXT_STATUS_ACTIVE_CART . ' '; ?></td> <td class="smallText"><?php echo tep_image(DIR_WS_IMAGES . $status_inactive_cart, TEXT_STATUS_INACTIVE_CART) . ' ' . TEXT_STATUS_INACTIVE_CART . ' '; ?></td> </tr> <tr> <td class="smallText"><?php echo tep_image(DIR_WS_IMAGES . $status_active_nocart, TEXT_STATUS_ACTIVE_NOCART) . ' ' . TEXT_STATUS_ACTIVE_NOCART .' '; ?></td> <td class="smallText"><?php echo tep_image(DIR_WS_IMAGES . $status_inactive_nocart, TEXT_STATUS_INACTIVE_NOCART) . ' ' . TEXT_STATUS_INACTIVE_NOCART . ' '; ?></td> </tr> <tr> <td class="smallText"><?php echo tep_image(DIR_WS_IMAGES . $status_active_bot, TEXT_STATUS_ACTIVE_BOT) . ' ' . TEXT_STATUS_ACTIVE_BOT . ' '; ?></td> <td class="smallText"><?php echo tep_image(DIR_WS_IMAGES . $status_inactive_bot, TEXT_STATUS_INACTIVE_BOT) . ' ' . TEXT_STATUS_INACTIVE_BOT . ' '; ?></td> </tr> </table> </td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="4"> <tr bgcolor="#8A9DB1" style="background: url(../images/infobox/header_footer_background.jpg)"> <td class="dataTableHeadingContent" nowrap colspan="2" align="center"><?php echo TABLE_HEADING_ONLINE; ?></td> <td class="dataTableHeadingContent" nowrap><?php echo TABLE_HEADING_FULL_NAME; ?></td> <td class="dataTableHeadingContent" align="center" nowrap><?php echo TABLE_HEADING_IP_ADDRESS; ?></td> <td class="dataTableHeadingContent" nowrap><?php echo TABLE_HEADING_ENTRY_TIME; ?></td> <td class="dataTableHeadingContent" align="center" nowrap><?php echo TABLE_HEADING_LAST_CLICK; ?></td> <td class="dataTableHeadingContent" width="200"><?php echo TABLE_HEADING_LAST_PAGE_URL; ?> </td> <td class="dataTableHeadingContent" align="center"><?php echo "User<br>Session?" ?> </td> <td class="dataTableHeadingContent" nowrap><?php echo TABLE_HEADING_HTTP_REFERER; ?> </td> </tr> <?php // Order by is on Last Click. Also initialize total_bots and total_admin counts $whos_online_query = tep_db_query("select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, http_referer, session_id from " . TABLE_WHOS_ONLINE . ' order by time_last_click DESC'); $total_bots=0; $total_admin=0; $total_guests=0; $total_loggedon=0; while ($whos_online = tep_db_fetch_array($whos_online_query)) { $time_online = ($whos_online['time_last_click'] - $whos_online['time_entry']); if ((!isset($HTTP_GET_VARS['info']) || (isset($HTTP_GET_VARS['info']) && ($HTTP_GET_VARS['info'] == $whos_online['session_id']))) && !isset($info)) { $info = $whos_online['session_id']; } /* BEGIN COUNT MOD */ if ($old_array['ip_address'] == $whos_online['ip_address']) { $i++; } /* END COUNT MOD */ if ($whos_online['session_id'] == $info) { if($whos_online['http_referer'] != "") { $http_referer_url = $whos_online['http_referer']; } echo '<tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n"; } else { echo '<tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_WHOS_ONLINE, tep_get_all_get_params(array('info', 'action')) . 'info=' . $whos_online['session_id'], 'NONSSL') . '\'">' . "\n"; } // Display Status // Check who it is and set values $is_bot = $is_admin = $is_guest = $is_account = false; // Bot detection if ($whos_online['customer_id'] < 0) { $total_bots++; $fg_color = $fg_color_bot; $is_bot = true; // Admin detection } elseif ($whos_online['ip_address'] == tep_get_ip_address() ) { //$_SERVER["REMOTE_ADDR"]) { $total_admin++; $fg_color = $fg_color_admin; $is_admin = true; // Guest detection (may include Bots not detected by Prevent Spider Sessions/spiders.txt) } elseif ($whos_online['customer_id'] == 0) { $fg_color = $fg_color_guest; $is_guest = true; $total_guests++; // Everyone else (should only be account holders) } else { $fg_color = $fg_color_account; $is_account = true; $total_loggedon++; } ?> <!-- Status Light Column --> <td class="dataTableContent" align="left" valign="top"> <?php echo ' ' . tep_check_cart($whos_online['session_id'], $whos_online['customer_id'], $whos_online['session_id']); ?> </td> <!-- Time Online Column --> <td class="dataTableContent" valign="top"><font color="<?php echo $fg_color; ?>"> <?php echo gmdate('H:i:s', $time_online); ?> </font> </td> <!-- Name Column --> <td class="dataTableContent" valign="top"><font color="<?php echo $fg_color; ?>"> <?php // WOL 1.6 Restructured to Check for Guest or Admin if ( $is_guest || $is_admin ) { echo $whos_online['full_name'] . ' '; // Check for Bot } elseif ( $is_bot ) { // Tokenize UserAgent and try to find Bots name $tok = strtok($whos_online['full_name']," ();/"); while ($tok) { if ( strlen($tok) > 3 ) if ( !strstr($tok, "mozilla") && !strstr($tok, "compatible") && !strstr($tok, "msie") && !strstr($tok, "windows") ) { echo "$tok"; break; } $tok = strtok(" ();/"); } // Check for Account } elseif ( $is_account ) { echo '<a HREF="customers.php?selected_box=customers&cID=' . $whos_online['customer_id'] . '&action=edit">' . $whos_online['full_name'] . '</a>'; } else { echo 'Error!'; } ?> </font> </td> <!-- IP Address Column --> <td class="dataTableContent" valign="top"><font color="<?php echo $fg_color; ?>"> <?php // Show 'Admin' instead of IP for Admin if ( $is_admin ) echo 'Admin'; else // Show IP with link to IP checker echo '<a HREF="http://www.showmyip.com/?ip=' . $whos_online['ip_address'] . '" target="_blank">' . $whos_online['ip_address'] . '</a>'; ?> </font> </td> <!-- Time Entry Column --> <td class="dataTableContent" valign="top"><font color="<?php echo $fg_color; ?>"> <?php echo date('H:i:s', $whos_online['time_entry']); ?> </font></td> <!-- Last Click Column --> <td class="dataTableContent" align="center" valign="top"><font color="<?php echo $fg_color; ?>"> <?php echo date('H:i:s', $whos_online['time_last_click']); ?> </font> </td> <!-- Last URL Column --> <td class="dataTableContent" valign="top"> <?php $temp_url_link = $whos_online['last_page_url']; if (eregi('^(.*)' . tep_session_name() . '=[a-f,0-9]+[&]*(.*)', $whos_online['last_page_url'], $array)) { $temp_url_display = $array[1] . $array[2]; } else { $temp_url_display = $whos_online['last_page_url']; } // WOL 1.6 - Removes osCid from the Last Click URL and the link if ( $osCsid_position = strpos($temp_url_display, "osCsid") ) $temp_url_display = substr_replace($temp_url_display, "", $osCsid_position - 1 ); if ( $osCsid_position = strpos($temp_url_link, "osCsid") ) $temp_url_link = substr_replace($temp_url_link, "", $osCsid_position - 1 ); ?> <a HREF="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . $temp_url_link; ?>" target=\"_blank\"> <font color="<?php echo $fg_color; ?>"> <?php echo $temp_url_display; ?> </font> </a> </td> <!-- osCsid? Column --> <td class="dataTableContent" align="center" valign="top"><font color="<?php echo $fg_color; ?>"> <?php if($whos_online['session_id'] != "") { echo 'Y'; } else { echo " "; } ?> </font></td> <!-- Referer? Column --> <td class="dataTableContent" align="center" valign="top"><font color="<?php echo $fg_color; ?>"> <?php if($whos_online['http_referer'] == "") { echo ' '; } else { echo TEXT_HTTP_REFERER_FOUND; } ?> </font></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent" colspan="3"></td> <td class="dataTableContent" colspan="6"><font color="<?php echo $fg_color; ?>"> <?php // Display Details for All if ( $_SERVER["QUERY_STRING"] == showAll ) { display_details(); } // Display Details for Bots else if( $_SERVER["QUERY_STRING"] == showBots ){ if ( $is_bot ) { display_details(); } } // Display Details for Customers else if( $_SERVER["QUERY_STRING"] == showCust ){ if ( $is_guest || $is_account || $is_admin ) { display_details(); } } ?> </font></td> </tr> <?php $old_array = $whos_online; } if (!$i) { $i=0; } $total_dupes = $i; $total_sess = tep_db_num_rows($whos_online_query); // WOL 1.4 - Subtract Bots and Me from Real Customers. Only subtract me once as Dupes will remove others $total_cust = $total_sess - $total_dupes - $total_bots - ($total_admin > 1? 1 : $total_admin); // WOL 1.4 eof ?> <?php if(isset($http_referer_url)) { ?> <tr> <td class="smallText" colspan="9"><?php echo '<strong>' . TEXT_HTTP_REFERER_URL . ':</strong> ' . $http_referer_url; ?></td> </tr> <?php } ?> <tr> <!-- WOL 1.4 - Added Bot and Me counts --> <td class="smallText" colspan="9"><br><table border="0" cellpadding="0" cellspacing="0" width="600"> <tr> <td class="smallText" align="left" colspan="2"> <?php echo sprintf(TEXT_NUMBER_OF_CUSTOMERS, $total_sess);?></td> </tr> <tr> <td class="smallText" align="right" width="30"><?php print "$total_dupes" ?></td> <td class="smallText" align="left" width="570"> Duplicate IPs</td> </tr> <tr> <td class="smallText" align="right" width="30"><?php print "$total_bots" ?></td> <td class="smallText" width="570"> Bots</td> </tr> <tr> <td class="smallText" align="right" width="30"><?php print "$total_admin" ?></td> <td class="smallText" width="570"> Me!</td> </tr> <tr> <td class="smallText" align="right" width="30"><?php print "$total_cust" ?></td> <td class="smallText" width="570"> Real Customers</td> </tr> </table><br> <?php print "<b>My IP Address:</b> ".tep_get_ip_address(); ?></td> <!-- WOL 1.4 eof --> </tr> </table></td> <?php $heading = array(); $contents = array(); $heading[] = array('text' => '<b>' . TABLE_HEADING_SHOPPING_CART . '</b>'); if (isset($info)) { if (STORE_SESSIONS == 'mysql') { $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $info . "'"); $session_data = tep_db_fetch_array($session_data); $session_data = trim($session_data['value']); } else { if ( (file_exists(DIR_FS_CATALOG . tep_session_save_path() . '/sess_' . $info)) && (filesize(DIR_FS_CATALOG . tep_session_save_path() . '/sess_' . $info) > 0) ) { $session_data = file(DIR_FS_CATALOG . tep_session_save_path() . '/sess_' . $info); $session_data = trim(implode('', $session_data)); } } if ($length = strlen($session_data)) { if (PHP_VERSION < 4) { $start_id = strpos($session_data, 'customer_id[==]s'); $start_cart = strpos($session_data, 'cart[==]o'); $start_currency = strpos($session_data, 'currency[==]s'); $start_country = strpos($session_data, 'customer_country_id[==]s'); $start_zone = strpos($session_data, 'customer_zone_id[==]s'); } else { $start_id = strpos($session_data, 'customer_id|s'); $start_cart = strpos($session_data, 'cart|O'); $start_currency = strpos($session_data, 'currency|s'); $start_country = strpos($session_data, 'customer_country_id|s'); $start_zone = strpos($session_data, 'customer_zone_id|s'); } for ($i=$start_cart; $i<$length; $i++) { if ($session_data[$i] == '{') { if (isset($tag)) { $tag++; } else { $tag = 1; } } elseif ($session_data[$i] == '}') { $tag--; } elseif ( (isset($tag)) && ($tag < 1) ) { break; } } $session_data_id = substr($session_data, $start_id, (strpos($session_data, ';', $start_id) - $start_id + 1)); $session_data_cart = substr($session_data, $start_cart, $i); $session_data_currency = substr($session_data, $start_currency, (strpos($session_data, ';', $start_currency) - $start_currency + 1)); $session_data_country = substr($session_data, $start_country, (strpos($session_data, ';', $start_country) - $start_country + 1)); $session_data_zone = substr($session_data, $start_zone, (strpos($session_data, ';', $start_zone) - $start_zone + 1)); session_decode($session_data_id); session_decode($session_data_currency); session_decode($session_data_country); session_decode($session_data_zone); session_decode($session_data_cart); if (PHP_VERSION < 4) { $broken_cart = $cart; $cart = new shoppingCart; $cart->unserialize($broken_cart); } if (is_object($cart)) { $products = $cart->get_products(); for ($i = 0, $n = sizeof($products); $i < $n; $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' => 'Empty'); } } // Show shopping cart contents fro selected entry echo ' <td valign="top">' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo '</td>' . "\n"; // } ?> </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'); ?> english/whos_online.php <?php /* $Id: whos_online.php,v 1.5 2002/03/30 15:48:55 harley_vb Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License */ define('HEADING_TITLE', 'Who\'s Online'); define('TABLE_HEADING_ONLINE', 'Online'); define('TABLE_HEADING_CUSTOMER_ID', 'ID'); define('TABLE_HEADING_FULL_NAME', 'Full Name'); define('TABLE_HEADING_IP_ADDRESS', 'IP Address'); define('TABLE_HEADING_ENTRY_TIME', 'Entry Time'); define('TABLE_HEADING_LAST_CLICK', 'Last Click'); define('TABLE_HEADING_LAST_PAGE_URL', 'Last URL'); define('TABLE_HEADING_ACTION', 'Action'); define('TABLE_HEADING_SHOPPING_CART', 'Users Shopping Cart'); define('TEXT_SHOPPING_CART_SUBTOTAL', 'Subtotal'); define('TEXT_NUMBER_OF_CUSTOMERS', '%s Visitors online (Considered inactive after 5 minutes. Removed after 15 minutes)'); define('TABLE_HEADING_HTTP_REFERER', 'Referer URL'); define('TEXT_HTTP_REFERER_URL', 'HTTP Referer URL'); define('TEXT_HTTP_REFERER_FOUND', 'Found'); define('TEXT_HTTP_REFERER_NOT_FOUND', 'Not Found'); define('TEXT_STATUS_ACTIVE_CART', 'Active with Cart'); define('TEXT_STATUS_ACTIVE_NOCART', 'Active No Cart'); define('TEXT_STATUS_INACTIVE_CART', 'Inactive with Cart'); define('TEXT_STATUS_INACTIVE_NOCART', 'Inactive No Cart'); define('TEXT_STATUS_NO_SESSION_BOT', 'Inactive Session Bot?'); define('TEXT_STATUS_INACTIVE_BOT', 'Inactive Session Bot?'); define('TEXT_STATUS_ACTIVE_BOT', 'Active Session Bot?'); define('TABLE_HEADING_COUNTRY', 'Cntry'); define('TABLE_HEADING_USER_SESSION', 'Session?'); ?> Quote Link to comment Share on other sites More sharing options...
mmph Posted June 19, 2005 Share Posted June 19, 2005 Thanks John, your admin detection lines are identical to mine so I guess that is no where my issue is. I have uninstalled an re-installed this about 5 times working from a check list of files and their respective directories to assure I get them all in the correct places but it still hangs up on the admin detection until I comment out those lines. After that I get whos online but the statistics do not show on the bottom of the page giving me the error: Fatal error: Call to undefined function: tep_get_ip_address() in /home/e-lectro/public_html/ecommerce/os/catalog/admin/whos_online.php on line 520 I have spent much time assuring that I have the snippet added to admin\includes\functions\general.php worded correctly and messed around some with the brackets as matt mentioned having an extra in his. I have it cut straight from the instructions, this is how the end of mine reads now: return $state_prov_code; } function tep_get_ip_address() { if (isset($_SERVER)) { if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } else { $ip = $_SERVER['REMOTE_ADDR']; } } else { if (getenv('HTTP_X_FORWARDED_FOR')) { $ip = getenv('HTTP_X_FORWARDED_FOR'); } elseif (getenv('HTTP_CLIENT_IP')) { $ip = getenv('HTTP_CLIENT_IP'); } else { $ip = getenv('REMOTE_ADDR'); } } return $ip; } ?> I really suspect this whole issue has to do with the tep_get_ip_address() but I can't put my finger on it? Quote Link to comment Share on other sites More sharing options...
Guest Posted June 19, 2005 Share Posted June 19, 2005 For those of you that are using or want use File sessions but then do not receive the info as to what is in peoples carts. I have found the problem. There is 2 sections to edit. Find this section around line 58 // Pull Session data from the correct source. if (STORE_SESSIONS == 'mysql') { $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $session_id . "'"); $session_data = tep_db_fetch_array($session_data); $session_data = trim($session_data['value']); } else { if ( (file_exists(DIR_FS_CATALOG . tep_session_save_path() . '/sess_' . $session_id)) && (filesize(DIR_FS_CATALOG . tep_session_save_path() . '/sess_' . $session_id) > 0) ) { $session_data = file(DIR_FS_CATALOG . tep_session_save_path() . '/sess_' . $session_id); $session_data = trim(implode('', $session_data)); } } Change to this: // Pull Session data from the correct source. if (STORE_SESSIONS == 'mysql') { $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $session_id . "'"); $session_data = tep_db_fetch_array($session_data); $session_data = trim($session_data['value']); } else { if ( (file_exists(tep_session_save_path() . '/sess_' . $session_id)) && (filesize(tep_session_save_path() . '/sess_' . $session_id) > 0) ) { $session_data = file(tep_session_save_path() . '/sess_' . $session_id); $session_data = trim(implode('', $session_data)); } } Then down near the bottom around line 579. Change this: $heading = array(); $contents = array(); $heading[] = array('text' => '<b>' . TABLE_HEADING_SHOPPING_CART . '</b>'); if (isset($info)) { if (STORE_SESSIONS == 'mysql') { $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $info . "'"); $session_data = tep_db_fetch_array($session_data); $session_data = trim($session_data['value']); } else { if ( (file_exists(DIR_FS_CATALOG . tep_session_save_path() . '/sess_' . $info)) && (filesize(DIR_FS_CATALOG . tep_session_save_path() . '/sess_' . $info) > 0) ) { $session_data = file(DIR_FS_CATALOG . tep_session_save_path() . '/sess_' . $info); $session_data = trim(implode('', $session_data)); } } To this $heading = array(); $contents = array(); $heading[] = array('text' => '<b>' . TABLE_HEADING_SHOPPING_CART . '</b>'); if (isset($info)) { if (STORE_SESSIONS == 'mysql') { $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $info . "'"); $session_data = tep_db_fetch_array($session_data); $session_data = trim($session_data['value']); } else { if ( (file_exists(tep_session_save_path() . '/sess_' . $info)) && (filesize(tep_session_save_path() . '/sess_' . $info) > 0) ) { $session_data = file(tep_session_save_path() . '/sess_' . $info); $session_data = trim(implode('', $session_data)); } } The session information was looking in a directory that did not and could not exist. Quote Link to comment Share on other sites More sharing options...
Guest Posted June 19, 2005 Share Posted June 19, 2005 Thanks John, your admin detection lines are identical to mine so I guess that is no where my issue is. I have uninstalled an re-installed this about 5 times working from a check list of files and their respective directories to assure I get them all in the correct places but it still hangs up on the admin detection until I comment out those lines. After that I get whos online but the statistics do not show on the bottom of the page giving me the error:I have spent much time assuring that I have the snippet added to admin\includes\functions\general.php worded correctly and messed around some with the brackets as matt mentioned having an extra in his. I have it cut straight from the instructions, this is how the end of mine reads now: return $state_prov_code; ?} function tep_get_ip_address() { ? ?if (isset($_SERVER)) { ? ? ?if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { ? ? ? ?$ip = $_SERVER['HTTP_X_FORWARDED_FOR']; ? ? ?} elseif (isset($_SERVER['HTTP_CLIENT_IP'])) { ? ? ? ?$ip = $_SERVER['HTTP_CLIENT_IP']; ? ? ?} else { ? ? ? ?$ip = $_SERVER['REMOTE_ADDR']; ? ? ?} ? ?} else { ? ? ?if (getenv('HTTP_X_FORWARDED_FOR')) { ? ? ? ?$ip = getenv('HTTP_X_FORWARDED_FOR'); ? ? ?} elseif (getenv('HTTP_CLIENT_IP')) { ? ? ? ?$ip = getenv('HTTP_CLIENT_IP'); ? ? ?} else { ? ? ? ?$ip = getenv('REMOTE_ADDR'); ? ? ?} ? ?} ? ?return $ip; ?} ?> I really suspect this whole issue has to do with the tep_get_ip_address() but I can't put my finger on it? <{POST_SNAPBACK}> Mark would you like me to take a look at it myself? I don't know what else to offer you. Quote Link to comment Share on other sites More sharing options...
Guest Posted June 19, 2005 Share Posted June 19, 2005 I have just found a bit more of a quirk that can be tidied up a little. This is for everyone regardles of Session type storage. For anyone on the site including bots the below code would show the cart as "Empty" or nothing at all in the Cart section displayed on the right. 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' => 'Empty'); } } // Show shopping cart contents fro selected entry echo ' <td valign="top">' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo '</td>' . "\n"; ?> This code will show all bots details, using the full width of the Who is Online page but if it's a logged in client, or real guest it will show the cart details, either with something in it, or "Empty" if nothing in it. 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' => 'Empty'); } } } } // EEM - Always show Shopping Cart column if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { // EEM eof // Show shopping cart contents fro selected entry echo ' <td valign="top">' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo '</td>' . "\n"; } ?> The reason for this change was that I found on the bots lines and on the logged in users with an empty cart it was not show anything as in, "Empty" and I figure that for the bots we don't need the cart showing at all and it's nice to know if a real user has nothing in their cart or there is an error again. This is not my work as much but has mainly come from a much earlier version, all credits go to them. cheers. Quote Link to comment Share on other sites More sharing options...
Guest Posted June 21, 2005 Share Posted June 21, 2005 I was just wondering if it would be possible to keep a permanant log of all the referers. As opposed to the stock install that only keeps the data for around 15 minutes. Quote Link to comment Share on other sites More sharing options...
Guest Posted June 22, 2005 Share Posted June 22, 2005 cart contents showing, but bots not showing (admin and customers showing ok) Quote Link to comment Share on other sites More sharing options...
Guest Posted June 22, 2005 Share Posted June 22, 2005 I was just wondering if it would be possible to keep a permanant log of all the referers. As opposed to the stock install that only keeps the data for around 15 minutes. <{POST_SNAPBACK}> There is a Contrib called Visitors that will do this and a whole lot more but the storage of the data gets very big very quickly. Apart from that I know of nothing else. John Quote Link to comment Share on other sites More sharing options...
Guest Posted June 22, 2005 Share Posted June 22, 2005 cart contents showing, but bots not showing (admin and customers showing ok) <{POST_SNAPBACK}> Is this what you wanted? Quote Link to comment Share on other sites More sharing options...
Guest Posted June 22, 2005 Share Posted June 22, 2005 Is this what you wanted? <{POST_SNAPBACK}> Almost! want bots to be ID'd Quote Link to comment Share on other sites More sharing options...
MzBeanz Posted June 23, 2005 Share Posted June 23, 2005 I installed the update and everything is fantastic! Ome questin when it refreshes it takes a very long time for customers no longer at teh store to clear. Is this normal? Thanks! maddie Quote Link to comment Share on other sites More sharing options...
Guest Posted June 23, 2005 Share Posted June 23, 2005 Maddie, Look for the following in admin/whos_online.php: // Seconds before visitor is removed from display $track_time = 900; Change the 900 seconds (15 minutes) to something shorter if you like. ed Quote Link to comment Share on other sites More sharing options...
Guest Posted June 23, 2005 Share Posted June 23, 2005 I installed the update and everything is fantastic! Ome questin when it refreshes it takes a very long time for customers no longer at teh store to clear. Is this normal? Thanks! maddie <{POST_SNAPBACK}> Maddie Just copy and paste the whole files below in to: catalog/admin/whos_online.php and the next one catalog/admin/includes/languages/english/whos_online.php. (these are the corrected files for File session storage, also) When installed these will explain all and give you a time stamp so you know exactly whats happening or not. If your then still having some problem/s, post here and we can see what to do. catalog/admin/whos_online.php <?php /* $Id: whos_online.php,v 1.32 2003/06/29 22:50:52 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); /* Configuration Values Set these to easily personalize your Whos Online */ // Seconds that a visitor is considered "active" $active_time = 300; // Seconds before visitor is removed from display $track_time = 900; // Automatic refresh times in seconds and display names // Time and Display Text order must match between the arrays // "None" is handled separately in the code $refresh_time = array( 30, 120, 300, 600 ); $refresh_display = array( ':30', '2:00', '5:00', '10:00' ); // Images used for status lights $status_active_cart = 'icon_status_green.gif'; $status_inactive_cart = 'icon_status_red.gif'; $status_active_nocart = 'icon_status_green_light.gif'; $status_inactive_nocart = 'icon_status_red_light.gif'; $status_active_bot = 'icon_status_green_border_light.gif'; $status_inactive_bot = 'icon_status_red_border_light.gif'; // Text color used for table entries // Different colored text for different users // Named colors and Hex values should work fine here $fg_color_bot = 'maroon'; $fg_color_admin = 'darkblue'; $fg_color_guest = 'green'; $fg_color_account = '#000000'; // Black /* Determines status and cart of visitor and displays appropriate icon. */ function tep_check_cart($which, $customer_id, $session_id) { global $cart, $status_active_cart, $status_inactive_cart, $status_active_nocart, $status_inactive_nocart, $status_inactive_bot, $status_active_bot, $active_time; // Pull Session data from the correct source. if (STORE_SESSIONS == 'mysql') { $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $session_id . "'"); $session_data = tep_db_fetch_array($session_data); $session_data = trim($session_data['value']); } else { if ( (file_exists(tep_session_save_path() . '/sess_' . $session_id)) && (filesize(tep_session_save_path() . '/sess_' . $session_id) > 0) ) { $session_data = file(tep_session_save_path() . '/sess_' . $session_id); $session_data = trim(implode('', $session_data)); } } if ($length = strlen($session_data)) { if (PHP_VERSION < 4) { $start_id = strpos($session_data, 'customer_id[==]s'); $start_cart = strpos($session_data, 'cart[==]o'); $start_currency = strpos($session_data, 'currency[==]s'); $start_country = strpos($session_data, 'customer_country_id[==]s'); $start_zone = strpos($session_data, 'customer_zone_id[==]s'); } else { $start_id = strpos($session_data, 'customer_id|s'); $start_cart = strpos($session_data, 'cart|O'); $start_currency = strpos($session_data, 'currency|s'); $start_country = strpos($session_data, 'customer_country_id|s'); $start_zone = strpos($session_data, 'customer_zone_id|s'); } for ($i=$start_cart; $i<$length; $i++) { if ($session_data[$i] == '{') { if (isset($tag)) { $tag++; } else { $tag = 1; } } elseif ($session_data[$i] == '{') { $tag--; } elseif ( (isset($tag)) && ($tag < 1) ) { break; } } $session_data_id = substr($session_data, $start_id, (strpos($session_data, ';', $start_id) - $start_id + 1)); $session_data_cart = substr($session_data, $start_cart, $i); $session_data_currency = substr($session_data, $start_currency, (strpos($session_data, ';', $start_currency) - $start_currency + 1)); $session_data_country = substr($session_data, $start_country, (strpos($session_data, ';', $start_country) - $start_country + 1)); $session_data_zone = substr($session_data, $start_zone, (strpos($session_data, ';', $start_zone) - $start_zone + 1)); session_decode($session_data_id); session_decode($session_data_currency); session_decode($session_data_country); session_decode($session_data_zone); session_decode($session_data_cart); if (PHP_VERSION < 4) { $broken_cart = $cart; $cart = new shoppingCart; $cart->unserialize($broken_cart); } if (is_object($cart)) { $products = $cart->get_products(); } } $which_query = $session_data; $who_data = tep_db_query(("select session_id, time_entry, time_last_click from " . TABLE_WHOS_ONLINE . " where session_id='" . $which . "'")); $who_query = tep_db_fetch_array($who_data); // Determine if visitor active/inactive $xx_mins_ago_long = (time() - $active_time); // Determine Bot active/inactive if( $customer_id < 0 ) { // inactive if ($who_query['time_last_click'] < $xx_mins_ago_long) { return tep_image(DIR_WS_IMAGES . $status_inactive_bot, TEXT_STATUS_INACTIVE_BOT); // active } else { return tep_image(DIR_WS_IMAGES . $status_active_bot, TEXT_STATUS_ACTIVE_BOT); } } // Determine active/inactive and cart/no cart status // no cart if ( sizeof($products) == 0 ) { // inactive if ($who_query['time_last_click'] < $xx_mins_ago_long) { return tep_image(DIR_WS_IMAGES . $status_inactive_nocart, TEXT_STATUS_INACTIVE_NOCART); // active } else { return tep_image(DIR_WS_IMAGES . $status_active_nocart, TEXT_STATUS_ACTIVE_NOCART); } // cart } else { // inactive if ($who_query['time_last_click'] < $xx_mins_ago_long) { return tep_image(DIR_WS_IMAGES . $status_inactive_cart, TEXT_STATUS_INACTIVE_CART); // active } else { return tep_image(DIR_WS_IMAGES . $status_active_cart, TEXT_STATUS_ACTIVE_CART); } } } // WOL 1.5 EOF /* Display the details about a visitor */ function display_details() { global $whos_online, $is_bot, $is_admin, $is_guest, $is_account; // Display Name/User Agent echo '<b>' . ($is_bot ? 'User Agent: ' : 'Name: ') . '</b>' . $whos_online['full_name']; echo '<br clear="all">' . tep_draw_separator('pixel_trans.gif', '10', '4') . '<br clear="all">'; // Display Customer ID for non-bots if ( !$is_bot ){ echo '<b>Customer ID:</b> ' . $whos_online['customer_id']; echo '<br clear="all">' . tep_draw_separator('pixel_trans.gif', '10', '4') . '<br clear="all">'; } // Display IP Address echo '<b>IP Address:</b> ' . $whos_online['ip_address']; echo '<br clear="all">' . tep_draw_separator('pixel_trans.gif', '10', '4') . '<br clear="all">'; // Display Session ID if available if ( $whos_online['session_id'] != "" ) { echo '<b>osCid:</b> ' . $whos_online['session_id']; echo '<br clear="all">' . tep_draw_separator('pixel_trans.gif', '10', '4') . '<br clear="all">'; } // Display Referrer if available if($whos_online['http_referer'] != "" ) { echo '<b>Referer:</b> ' . $whos_online['http_referer']; echo '<br clear="all">' . tep_draw_separator('pixel_trans.gif', '10', '4') . '<br clear="all">'; } } // Time to remove old entries $xx_mins_ago = (time() - $track_time); // remove entries that have expired tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where time_last_click < '" . $xx_mins_ago . "'"); ?> <!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; ?>"> <!-- WOL 1.6 - Cleaned up refresh --> <?php if( $_SERVER["QUERY_STRING"] > 0 ){ ?> <meta http-equiv="refresh" content="<?php echo $_SERVER["QUERY_STRING"];?>;URL=whos_online.php?<?php echo $_SERVER["QUERY_STRING"];?>"> <?php } ?> <!-- WOL 1.6 EOF --> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> <!--CSS DROP DOWN SCRIPT--> <script type="text/javascript"> function shownavtable(elmnt) { document.getElementById(elmnt).style.visibility="visible" } function hidenavtable(elmnt) { document.getElementById(elmnt).style.visibility="hidden" } </script> <!--CSS DROP DOWN SCRIPT--> <script language="javascript" src="includes/general.js"></script> </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> <!-- 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 valign="bottom" class="pageHeading" colspan="3"><?php echo HEADING_TITLE; ?><div align="center"><font size="2" face="Arial" color="#000000">Last Refresh: </font> <script language="JavaScript"> <!-- Begin Stamp = new Date(); document.write('<font size="2" face="Arial"><B>' + (Stamp.getMonth() + 1) +"/"+Stamp.getDate()+ "/"+Stamp.getYear() + '</B></font> '); var Hours; var Mins; var Time; Hours = Stamp.getHours(); if (Hours >= 12) { Time = " p.m."; } else { Time = " a.m."; } if (Hours > 12) { Hours -= 12; } if (Hours == 0) { Hours = 12; } Mins = Stamp.getMinutes(); if (Mins < 10) { Mins = "0" + Mins; } document.write('<font size="2" face="Arial"><B>' + Hours + ":" + Mins + Time + '</B></font>'); // End --> </script></div> <br clear="all"><span class="smallText" style="color:#909090">Set Refresh Rate:</span> <span class="dataTableContent" style="font-size: 10px"> <!-- For loop displays refresh time links --> <?php echo '<a class="menuBoxContentLink" href="whos_online.php"><b>None</b></a>'; foreach ($refresh_time as $key => $value) { echo ' · <a class="menuBoxContentLink" href="whos_online.php?' . $value . '"><b>' . $refresh_display[$key] . '</b></a>'; } ?> <!-- Display Profile links --> <br clear="all"> <span class="smallText" style="color:#909090">Profile Display:</span> <a href="whos_online.php" class="menuBoxContentLink"><b>None</b></a> · <a href="whos_online.php?showAll" class="menuBoxContentLink"><b>All</b></a> · <a href="whos_online.php?showBots" class="menuBoxContentLink"><b>Bots</b></a> · <a href="whos_online.php?showCust" class="menuBoxContentLink"><b>Customers</b></a> </span> </td> <!-- Status Legend - Uses variables for image names --> <td rowspan="2" align="right" class="smallText"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td class="smallText"><?php echo tep_image(DIR_WS_IMAGES . $status_active_cart, TEXT_STATUS_ACTIVE_CART) . ' ' . TEXT_STATUS_ACTIVE_CART . ' '; ?></td> <td class="smallText"><?php echo tep_image(DIR_WS_IMAGES . $status_inactive_cart, TEXT_STATUS_INACTIVE_CART) . ' ' . TEXT_STATUS_INACTIVE_CART . ' '; ?></td> </tr> <tr> <td class="smallText"><?php echo tep_image(DIR_WS_IMAGES . $status_active_nocart, TEXT_STATUS_ACTIVE_NOCART) . ' ' . TEXT_STATUS_ACTIVE_NOCART .' '; ?></td> <td class="smallText"><?php echo tep_image(DIR_WS_IMAGES . $status_inactive_nocart, TEXT_STATUS_INACTIVE_NOCART) . ' ' . TEXT_STATUS_INACTIVE_NOCART . ' '; ?></td> </tr> <tr> <td class="smallText"><?php echo tep_image(DIR_WS_IMAGES . $status_active_bot, TEXT_STATUS_ACTIVE_BOT) . ' ' . TEXT_STATUS_ACTIVE_BOT . ' '; ?></td> <td class="smallText"><?php echo tep_image(DIR_WS_IMAGES . $status_inactive_bot, TEXT_STATUS_INACTIVE_BOT) . ' ' . TEXT_STATUS_INACTIVE_BOT . ' '; ?></td> </tr> </table> </td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="4"> <tr bgcolor="#8A9DB1" style="background: url(../images/infobox/header_footer_background.jpg)"> <td class="dataTableHeadingContent" nowrap colspan="2" align="center"><?php echo TABLE_HEADING_ONLINE; ?></td> <td class="dataTableHeadingContent" nowrap><?php echo TABLE_HEADING_FULL_NAME; ?></td> <td class="dataTableHeadingContent" align="center" nowrap><?php echo TABLE_HEADING_IP_ADDRESS; ?></td> <td class="dataTableHeadingContent" nowrap><?php echo TABLE_HEADING_ENTRY_TIME; ?></td> <td class="dataTableHeadingContent" align="center" nowrap><?php echo TABLE_HEADING_LAST_CLICK; ?></td> <td class="dataTableHeadingContent" width="200"><?php echo TABLE_HEADING_LAST_PAGE_URL; ?> </td> <td class="dataTableHeadingContent" align="center"><?php echo "User<br>Session?" ?> </td> <td class="dataTableHeadingContent" nowrap><?php echo TABLE_HEADING_HTTP_REFERER; ?> </td> </tr> <?php // Order by is on Last Click. Also initialize total_bots and total_admin counts $whos_online_query = tep_db_query("select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, http_referer, session_id from " . TABLE_WHOS_ONLINE . ' order by time_last_click DESC'); $total_bots=0; $total_admin=0; $total_guests=0; $total_loggedon=0; while ($whos_online = tep_db_fetch_array($whos_online_query)) { $time_online = ($whos_online['time_last_click'] - $whos_online['time_entry']); if ((!isset($HTTP_GET_VARS['info']) || (isset($HTTP_GET_VARS['info']) && ($HTTP_GET_VARS['info'] == $whos_online['session_id']))) && !isset($info)) { $info = $whos_online['session_id']; } /* BEGIN COUNT MOD */ if ($old_array['ip_address'] == $whos_online['ip_address']) { $i++; } /* END COUNT MOD */ if ($whos_online['session_id'] == $info) { if($whos_online['http_referer'] != "") { $http_referer_url = $whos_online['http_referer']; } echo '<tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n"; } else { echo '<tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_WHOS_ONLINE, tep_get_all_get_params(array('info', 'action')) . 'info=' . $whos_online['session_id'], 'NONSSL') . '\'">' . "\n"; } // Display Status // Check who it is and set values $is_bot = $is_admin = $is_guest = $is_account = false; // Bot detection if ($whos_online['customer_id'] < 0) { $total_bots++; $fg_color = $fg_color_bot; $is_bot = true; // Admin detection } elseif ($whos_online['ip_address'] == tep_get_ip_address() ) { //$_SERVER["REMOTE_ADDR"]) { $total_admin++; $fg_color = $fg_color_admin; $is_admin = true; // Guest detection (may include Bots not detected by Prevent Spider Sessions/spiders.txt) } elseif ($whos_online['customer_id'] == 0) { $fg_color = $fg_color_guest; $is_guest = true; $total_guests++; // Everyone else (should only be account holders) } else { $fg_color = $fg_color_account; $is_account = true; $total_loggedon++; } ?> <!-- Status Light Column --> <td class="dataTableContent" align="left" valign="top"> <?php echo ' ' . tep_check_cart($whos_online['session_id'], $whos_online['customer_id'], $whos_online['session_id']); ?> </td> <!-- Time Online Column --> <td class="dataTableContent" valign="top"><font color="<?php echo $fg_color; ?>"> <?php echo gmdate('H:i:s', $time_online); ?> </font> </td> <!-- Name Column --> <td class="dataTableContent" valign="top"><font color="<?php echo $fg_color; ?>"> <?php // WOL 1.6 Restructured to Check for Guest or Admin if ( $is_guest || $is_admin ) { echo $whos_online['full_name'] . ' '; // Check for Bot } elseif ( $is_bot ) { // Tokenize UserAgent and try to find Bots name $tok = strtok($whos_online['full_name']," ();/"); while ($tok) { if ( strlen($tok) > 3 ) if ( !strstr($tok, "mozilla") && !strstr($tok, "compatible") && !strstr($tok, "msie") && !strstr($tok, "windows") ) { echo "$tok"; break; } $tok = strtok(" ();/"); } // Check for Account } elseif ( $is_account ) { echo '<a HREF="customers.php?selected_box=customers&cID=' . $whos_online['customer_id'] . '&action=edit">' . $whos_online['full_name'] . '</a>'; } else { echo 'Error!'; } ?> </font> </td> <!-- IP Address Column --> <td class="dataTableContent" valign="top"><font color="<?php echo $fg_color; ?>"> <?php // Show 'Admin' instead of IP for Admin if ( $is_admin ) echo 'Admin'; else // Show IP with link to IP checker echo '<a HREF="http://www.showmyip.com/?ip=' . $whos_online['ip_address'] . '" target="_blank">' . $whos_online['ip_address'] . '</a>'; ?> </font> </td> <!-- Time Entry Column --> <td class="dataTableContent" valign="top"><font color="<?php echo $fg_color; ?>"> <?php echo date('H:i:s', $whos_online['time_entry']); ?> </font></td> <!-- Last Click Column --> <td class="dataTableContent" align="center" valign="top"><font color="<?php echo $fg_color; ?>"> <?php echo date('H:i:s', $whos_online['time_last_click']); ?> </font> </td> <!-- Last URL Column --> <td class="dataTableContent" valign="top"> <?php $temp_url_link = $whos_online['last_page_url']; if (eregi('^(.*)' . tep_session_name() . '=[a-f,0-9]+[&]*(.*)', $whos_online['last_page_url'], $array)) { $temp_url_display = $array[1] . $array[2]; } else { $temp_url_display = $whos_online['last_page_url']; } // WOL 1.6 - Removes osCid from the Last Click URL and the link if ( $osCsid_position = strpos($temp_url_display, "osCsid") ) $temp_url_display = substr_replace($temp_url_display, "", $osCsid_position - 1 ); if ( $osCsid_position = strpos($temp_url_link, "osCsid") ) $temp_url_link = substr_replace($temp_url_link, "", $osCsid_position - 1 ); ?> <a HREF="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . $temp_url_link; ?>" target=\"_blank\"> <font color="<?php echo $fg_color; ?>"> <?php echo $temp_url_display; ?> </font> </a> </td> <!-- osCsid? Column --> <td class="dataTableContent" align="center" valign="top"><font color="<?php echo $fg_color; ?>"> <?php if($whos_online['session_id'] != "") { echo 'Y'; } else { echo " "; } ?> </font></td> <!-- Referer? Column --> <td class="dataTableContent" align="center" valign="top"><font color="<?php echo $fg_color; ?>"> <?php if($whos_online['http_referer'] == "") { echo ' '; } else { echo TEXT_HTTP_REFERER_FOUND; } ?> </font></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent" colspan="3"></td> <td class="dataTableContent" colspan="6"><font color="<?php echo $fg_color; ?>"> <?php // Display Details for All if ( $_SERVER["QUERY_STRING"] == showAll ) { display_details(); } // Display Details for Bots else if( $_SERVER["QUERY_STRING"] == showBots ){ if ( $is_bot ) { display_details(); } } // Display Details for Customers else if( $_SERVER["QUERY_STRING"] == showCust ){ if ( $is_guest || $is_account || $is_admin ) { display_details(); } } ?> </font></td> </tr> <?php $old_array = $whos_online; } if (!$i) { $i=0; } $total_dupes = $i; $total_sess = tep_db_num_rows($whos_online_query); // WOL 1.4 - Subtract Bots and Me from Real Customers. Only subtract me once as Dupes will remove others $total_cust = $total_sess - $total_dupes - $total_bots - ($total_admin > 1? 1 : $total_admin); // WOL 1.4 eof ?> <?php if(isset($http_referer_url)) { ?> <tr> <td class="smallText" colspan="9"><?php echo '<strong>' . TEXT_HTTP_REFERER_URL . ':</strong> <a href='. $http_referer_url.' target=_blank>' . $http_referer_url.'</a>'; ?></td> </tr> <?php } ?> <tr> <!-- WOL 1.4 - Added Bot and Me counts --> <td class="smallText" colspan="9"><br><table border="0" cellpadding="0" cellspacing="0" width="600"> <tr> <td class="smallText" align="left" colspan="2"> <?php echo sprintf(TEXT_NUMBER_OF_CUSTOMERS, $total_sess);?></td> </tr> <tr> <td class="smallText" align="right" width="30"><?php print "$total_dupes" ?></td> <td class="smallText" align="left" width="570"> Duplicate IPs</td> </tr> <tr> <td class="smallText" align="right" width="30"><?php print "$total_bots" ?></td> <td class="smallText" width="570"> Bots</td> </tr> <tr> <td class="smallText" align="right" width="30"><?php print "$total_admin" ?></td> <td class="smallText" width="570"> Me!</td> </tr> <tr> <td class="smallText" align="right" width="30"><?php print "$total_cust" ?></td> <td class="smallText" width="570"> Real Customers</td> </tr> </table><br> <?php print "<b>My IP Address:</b> ".tep_get_ip_address(); ?></td> <!-- WOL 1.4 eof --> </tr> </table></td> <?php $heading = array(); $contents = array(); $heading[] = array('text' => '<b>' . TABLE_HEADING_SHOPPING_CART . '</b>'); if (isset($info)) { if (STORE_SESSIONS == 'mysql') { $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $info . "'"); $session_data = tep_db_fetch_array($session_data); $session_data = trim($session_data['value']); } else { if ( (file_exists(tep_session_save_path() . '/sess_' . $info)) && (filesize(tep_session_save_path() . '/sess_' . $info) > 0) ) { $session_data = file(tep_session_save_path() . '/sess_' . $info); $session_data = trim(implode('', $session_data)); } } if ($length = strlen($session_data)) { if (PHP_VERSION < 4) { $start_id = strpos($session_data, 'customer_id[==]s'); $start_cart = strpos($session_data, 'cart[==]o'); $start_currency = strpos($session_data, 'currency[==]s'); $start_country = strpos($session_data, 'customer_country_id[==]s'); $start_zone = strpos($session_data, 'customer_zone_id[==]s'); } else { $start_id = strpos($session_data, 'customer_id|s'); $start_cart = strpos($session_data, 'cart|O'); $start_currency = strpos($session_data, 'currency|s'); $start_country = strpos($session_data, 'customer_country_id|s'); $start_zone = strpos($session_data, 'customer_zone_id|s'); } for ($i=$start_cart; $i<$length; $i++) { if ($session_data[$i] == '{') { if (isset($tag)) { $tag++; } else { $tag = 1; } } elseif ($session_data[$i] == '{') { $tag--; } elseif ( (isset($tag)) && ($tag < 1) ) { break; } } $session_data_id = substr($session_data, $start_id, (strpos($session_data, ';', $start_id) - $start_id + 1)); $session_data_cart = substr($session_data, $start_cart, $i); $session_data_currency = substr($session_data, $start_currency, (strpos($session_data, ';', $start_currency) - $start_currency + 1)); $session_data_country = substr($session_data, $start_country, (strpos($session_data, ';', $start_country) - $start_country + 1)); $session_data_zone = substr($session_data, $start_zone, (strpos($session_data, ';', $start_zone) - $start_zone + 1)); session_decode($session_data_id); session_decode($session_data_currency); session_decode($session_data_country); session_decode($session_data_zone); session_decode($session_data_cart); if (PHP_VERSION < 4) { $broken_cart = $cart; $cart = new shoppingCart; $cart->unserialize($broken_cart); } if (is_object($cart)) { $products = $cart->get_products(); for ($i = 0, $n = sizeof($products); $i < $n; $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' => 'Empty'); } } } } // EEM - Always show Shopping Cart column if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { // EEM eof // Show shopping cart contents fro selected entry echo ' <td valign="top">' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo '</td>' . "\n"; } ?> </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'); ?> catalog/admin/includes/languages/english/whos_online.php. <?php /* $Id: whos_online.php,v 1.5 2002/03/30 15:48:55 harley_vb Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License */ define('HEADING_TITLE', 'Who\'s Online'); define('TABLE_HEADING_ONLINE', 'Online'); define('TABLE_HEADING_CUSTOMER_ID', 'ID'); define('TABLE_HEADING_FULL_NAME', 'Full Name'); define('TABLE_HEADING_IP_ADDRESS', 'IP Address'); define('TABLE_HEADING_ENTRY_TIME', 'Entry Time'); define('TABLE_HEADING_LAST_CLICK', 'Last Click'); define('TABLE_HEADING_LAST_PAGE_URL', 'Last URL'); define('TABLE_HEADING_ACTION', 'Action'); define('TABLE_HEADING_SHOPPING_CART', 'Users Shopping Cart'); define('TEXT_SHOPPING_CART_SUBTOTAL', 'Subtotal'); define('TEXT_NUMBER_OF_CUSTOMERS', '%s Visitors online (Considered inactive after 5 minutes. Removed after 15 minutes)'); define('TABLE_HEADING_HTTP_REFERER', 'Referer URL'); define('TEXT_HTTP_REFERER_URL', 'HTTP Referer URL'); define('TEXT_HTTP_REFERER_FOUND', 'Found'); define('TEXT_HTTP_REFERER_NOT_FOUND', 'Not Found'); define('TEXT_STATUS_ACTIVE_CART', 'Active with Cart'); define('TEXT_STATUS_ACTIVE_NOCART', 'Active No Cart'); define('TEXT_STATUS_INACTIVE_CART', 'Inactive with Cart'); define('TEXT_STATUS_INACTIVE_NOCART', 'Inactive No Cart'); define('TEXT_STATUS_NO_SESSION_BOT', 'Inactive Session Bot?'); define('TEXT_STATUS_INACTIVE_BOT', 'Inactive Session Bot?'); define('TEXT_STATUS_ACTIVE_BOT', 'Active Session Bot?'); define('TABLE_HEADING_COUNTRY', 'Cntry'); define('TABLE_HEADING_USER_SESSION', 'Session?'); ?> Quote Link to comment Share on other sites More sharing options...
Guest Posted June 23, 2005 Share Posted June 23, 2005 Almost! want bots to be ID'd <{POST_SNAPBACK}> Matt The script should identify most bots. Check you have an updated spiders.txt fiule in your catalog/includes directory. This can be updated yourself with any new bots you find. The only ones I have found that it does not always indentify is google. Google seems to have a number running around with slightly different names. John Quote Link to comment Share on other sites More sharing options...
MzBeanz Posted June 23, 2005 Share Posted June 23, 2005 (edited) Thanks John ...but I got this error Fatal error: Call to undefined function: tep_get_ip_address() in /home/virtual/site7/fst/var/www/html/catalog/admin/whos_online.php on line 376 Maddie Edited June 23, 2005 by MzBeanz Quote Link to comment Share on other sites More sharing options...
Guest Posted June 23, 2005 Share Posted June 23, 2005 Thanks John ...but I got this error Fatal error: Call to undefined function: tep_get_ip_address() in /home/virtual/site7/fst/var/www/html/catalog/admin/whos_online.php on line 376 Maddie <{POST_SNAPBACK}> Maddie It appears as though you do not have your File sessions, settings set correctly. Go back through the last coupls of pages here and you will find more info about this. Quote Link to comment Share on other sites More sharing options...
Guest Posted June 23, 2005 Share Posted June 23, 2005 Maddie, Also check that you have a function tep_get_ip_address() in admin/includes/functions/general.php. ed Quote Link to comment Share on other sites More sharing options...
MzBeanz Posted June 23, 2005 Share Posted June 23, 2005 thansk so much will do! Quote Link to comment Share on other sites More sharing options...
MzBeanz Posted June 24, 2005 Share Posted June 24, 2005 Maddie, Also check that you have a function tep_get_ip_address() in admin/includes/functions/general.php. ed <{POST_SNAPBACK}> Hi Ed, I do not have that function. Can you tell me where it should go and how it should look? Thanks. Quote Link to comment Share on other sites More sharing options...
MzBeanz Posted June 24, 2005 Share Posted June 24, 2005 I got it working silly me wsa uploading from 2 different versions! What ya gt for working too late. It's awesome! thank you! Maddie Quote Link to comment Share on other sites More sharing options...
Guest Posted June 25, 2005 Share Posted June 25, 2005 Maddie, I'm glad it's working. ed Quote Link to comment Share on other sites More sharing options...
Guest Posted June 25, 2005 Share Posted June 25, 2005 Still no bot ID of any sort... :( With SQL it showed all/many bots.. NONE now even though I can see them sitting on the site for hrs. Other thing, is the IP is buggy.. I can see my own IP there...then a BOT thats been on for hrs chnaging IP.... all of a sudden apon refresh.. its got MY IP.. 10 mins later.. another one.. Quote Link to comment Share on other sites More sharing options...
Guest Posted June 25, 2005 Share Posted June 25, 2005 Still no bot ID of any sort... :(With SQL it showed all/many bots.. NONE now even though I can see them sitting on the site for hrs. Other thing, is the IP is buggy.. I can see my own IP there...then a BOT thats been on for hrs chnaging IP.... all of a sudden apon refresh.. its got MY IP.. 10 mins later.. another one.. <{POST_SNAPBACK}> Matt Just out of curiosity. Have you edited your spiders.txt file? And what did you edit it with? Also are you uploading with a FTP program. I know this may sound a little silly but I felt it's worth asking. Quote Link to comment Share on other sites More sharing options...
Guest Posted June 25, 2005 Share Posted June 25, 2005 ... also, do you have Prevent Spider Sessions turned on in Admin? ed Quote Link to comment Share on other sites More sharing options...
MzBeanz Posted June 25, 2005 Share Posted June 25, 2005 Maddie, I'm glad it's working. ed <{POST_SNAPBACK}> Thanks so much! Maddie 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.