PageRenderTime 28ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 1ms

/catalog/admin/whos_online.php

https://github.com/eosc/EosC-2.3
PHP | 728 lines | 590 code | 69 blank | 69 comment | 118 complexity | be38b26ed8541fa0ce777dda0ee0f80c MD5 | raw file
Possible License(s): AGPL-1.0
  1. <?php
  2. /*
  3. $Id: whos_online.php,v 1.9b 2006/02/10 hpdl Exp $
  4. osCommerce, Open Source E-Commerce Solutions
  5. http://www.oscommerce.com
  6. Copyright (c) 2003 osCommerce
  7. Released under the GNU General Public License
  8. */
  9. require('includes/application_top.php');
  10. require(DIR_WS_CLASSES . 'currencies.php');
  11. $currencies = new currencies();
  12. /*
  13. Configuration Values
  14. Set these to easily personalize your Whos Online
  15. */
  16. // Seconds that a visitor is considered "active"
  17. $active_time = 300;
  18. // Seconds before visitor is removed from display
  19. $track_time = 900;
  20. // Automatic refresh times in seconds and display names
  21. // Time and Display Text order must match between the arrays
  22. // "None" is handled separately in the code
  23. $refresh_time = array( 30, 60, 120, 300, 600 );
  24. $refresh_display = array( '0:30', '1:00', '2:00', '5:00', '10:00' );
  25. // Images used for status lights
  26. $status_active_cart = 'icon_status_green.gif';
  27. $status_inactive_cart = 'icon_status_red.gif';
  28. $status_active_nocart = 'icon_status_green_light.gif';
  29. $status_inactive_nocart = 'icon_status_red_light.gif';
  30. $status_active_bot = 'icon_status_green_border_light.gif';
  31. $status_inactive_bot = 'icon_status_red_border_light.gif';
  32. // Text color used for table entries - different colored text for different users
  33. $fg_color_bot = 'maroon';
  34. $fg_color_admin = 'darkblue';
  35. $fg_color_guest = 'green';
  36. $fg_color_account = '#000000';
  37. //Determines status and cart of visitor and displays appropriate icon.
  38. function tep_check_cart($which, $customer_id, $session_id) {
  39. global $cart, $status_active_cart, $status_inactive_cart, $status_active_nocart, $status_inactive_nocart, $status_inactive_bot, $status_active_bot, $active_time;
  40. // Pull Session data from the correct source.
  41. if (STORE_SESSIONS == 'mysql') {
  42. $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $session_id . "'");
  43. $session_data = tep_db_fetch_array($session_data);
  44. $session_data = trim($session_data['value']);
  45. } else {
  46. if ( (file_exists(tep_session_save_path() . '/sess_' . $session_id)) && (filesize(tep_session_save_path() . '/sess_' . $session_id) > 0) ) {
  47. $session_data = file(tep_session_save_path() . '/sess_' . $session_id);
  48. $session_data = trim(implode('', $session_data));
  49. }
  50. }
  51. if ($length = strlen($session_data)) {
  52. if (PHP_VERSION < 4) {
  53. $start_id = strpos($session_data, 'customer_id[==]s');
  54. $start_cart = strpos($session_data, 'cart[==]o');
  55. $start_currency = strpos($session_data, 'currency[==]s');
  56. $start_country = strpos($session_data, 'customer_country_id[==]s');
  57. $start_zone = strpos($session_data, 'customer_zone_id[==]s');
  58. } else {
  59. $start_id = strpos($session_data, 'customer_id|s');
  60. $start_cart = strpos($session_data, 'cart|O');
  61. $start_currency = strpos($session_data, 'currency|s');
  62. $start_country = strpos($session_data, 'customer_country_id|s');
  63. $start_zone = strpos($session_data, 'customer_zone_id|s');
  64. }
  65. for ($i=$start_cart; $i<$length; $i++) {
  66. if ($session_data[$i] == '{') {
  67. if (isset($tag)) {
  68. $tag++;
  69. } else {
  70. $tag = 1;
  71. }
  72. } elseif ($session_data[$i] == '}') {
  73. $tag--;
  74. } elseif ( (isset($tag)) && ($tag < 1) ) {
  75. break;
  76. }
  77. }
  78. $session_data_id = substr($session_data, $start_id, (strpos($session_data, ';', $start_id) - $start_id + 1));
  79. $session_data_cart = substr($session_data, $start_cart, $i);
  80. $session_data_currency = substr($session_data, $start_currency, (strpos($session_data, ';', $start_currency) - $start_currency + 1));
  81. $session_data_country = substr($session_data, $start_country, (strpos($session_data, ';', $start_country) - $start_country + 1));
  82. $session_data_zone = substr($session_data, $start_zone, (strpos($session_data, ';', $start_zone) - $start_zone + 1));
  83. session_decode($session_data_id);
  84. session_decode($session_data_currency);
  85. session_decode($session_data_country);
  86. session_decode($session_data_zone);
  87. session_decode($session_data_cart);
  88. if (PHP_VERSION < 4) {
  89. $broken_cart = $cart;
  90. $cart = new shoppingCart;
  91. $cart->unserialize($broken_cart);
  92. }
  93. if (is_object($cart)) {
  94. $products = $cart->get_products();
  95. }
  96. }
  97. $which_query = $session_data;
  98. $who_data = tep_db_query("select time_entry, time_last_click
  99. from " . TABLE_WHOS_ONLINE . "
  100. where session_id='" . $session_id . "'");
  101. $who_query = tep_db_fetch_array($who_data);
  102. // Determine if visitor active/inactive
  103. $xx_mins_ago_long = (time() - $active_time);
  104. // Determine Bot active/inactive
  105. if( $customer_id < 0 ) {
  106. // inactive
  107. if ($who_query['time_last_click'] < $xx_mins_ago_long) {
  108. return tep_image(DIR_WS_IMAGES . $status_inactive_bot, TEXT_STATUS_INACTIVE_BOT);
  109. // active
  110. } else {
  111. return tep_image(DIR_WS_IMAGES . $status_active_bot, TEXT_STATUS_ACTIVE_BOT);
  112. }
  113. }
  114. // Determine active/inactive and cart/no cart status
  115. if ( sizeof($products) == 0 ) {
  116. // inactive
  117. if ($who_query['time_last_click'] < $xx_mins_ago_long) {
  118. return tep_image(DIR_WS_IMAGES . $status_inactive_nocart, TEXT_STATUS_INACTIVE_NOCART);
  119. // active
  120. } else {
  121. return tep_image(DIR_WS_IMAGES . $status_active_nocart, TEXT_STATUS_ACTIVE_NOCART);
  122. }
  123. // cart
  124. } else {
  125. // inactive
  126. if ($who_query['time_last_click'] < $xx_mins_ago_long) {
  127. return tep_image(DIR_WS_IMAGES . $status_inactive_cart, TEXT_STATUS_INACTIVE_CART);
  128. // active
  129. } else {
  130. return tep_image(DIR_WS_IMAGES . $status_active_cart, TEXT_STATUS_ACTIVE_CART);
  131. }
  132. }
  133. }
  134. /* Display the details about a visitor */
  135. function display_details() {
  136. global $whos_online, $is_bot, $is_admin, $is_guest, $is_account;
  137. // Display Name
  138. echo '<b>' . TABLE_HEADING_FULL_NAME . ':</b> ' . $whos_online['full_name'];
  139. echo '<br clear="all">' . tep_draw_separator('pixel_trans.gif', '10', '4') . '<br clear="all">';
  140. // Display Customer ID for non-bots
  141. if ( !$is_bot ){
  142. echo '<b>' . TABLE_HEADING_CUSTOMER_ID . ':</b> ' . $whos_online['customer_id'];
  143. echo '<br clear="all">' . tep_draw_separator('pixel_trans.gif', '10', '4') . '<br clear="all">';
  144. }
  145. // Display IP Address
  146. echo '<b>' . TABLE_HEADING_IP_ADDRESS . ':</b> ' . $whos_online['ip_address'];
  147. echo '<br clear="all">' . tep_draw_separator('pixel_trans.gif', '10', '4') . '<br clear="all">';
  148. // Display User Agent
  149. echo '<b>' . TEXT_USER_AGENT . ':</b> ' . $whos_online['user_agent'];
  150. echo '<br clear="all">' . tep_draw_separator('pixel_trans.gif', '10', '4') . '<br clear="all">';
  151. // Display Session ID. Bots with no Session ID, have it set to their IP address. Don't display these.
  152. if ( $whos_online['session_id'] != $whos_online['ip_address'] ) {
  153. echo '<b>' . TEXT_OSCID . ':</b> ' . $whos_online['session_id'];
  154. echo '<br clear="all">' . tep_draw_separator('pixel_trans.gif', '10', '4') . '<br clear="all">';
  155. }
  156. // Display Referer if available
  157. if($whos_online['http_referer'] != "" ) {
  158. echo '<b>' . TABLE_HEADING_HTTP_REFERER . ':</b> ' . $whos_online['http_referer'];
  159. echo '<br clear="all">' . tep_draw_separator('pixel_trans.gif', '10', '4') . '<br clear="all">';
  160. }
  161. }
  162. // Time to remove old entries
  163. $xx_mins_ago = (time() - $track_time);
  164. // remove entries that have expired
  165. tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where time_last_click < '" . $xx_mins_ago . "'");
  166. ?>
  167. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  168. <html <?php echo HTML_PARAMS; ?>>
  169. <head>
  170. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  171. <!-- WOL 1.6 - Cleaned up refresh -->
  172. <?php if( $_SERVER["QUERY_STRING"] > 0 ){ ?>
  173. <meta http-equiv="refresh" content="<?php echo $_SERVER["QUERY_STRING"];?>;URL=whos_online.php?<?php echo $_SERVER["QUERY_STRING"];?>">
  174. <?php } ?>
  175. <!-- WOL 1.6 EOF -->
  176. <title><?php echo TITLE; ?></title>
  177. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  178. <script language="javascript" src="includes/general.js"></script>
  179. </head>
  180. <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
  181. <!-- header //-->
  182. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  183. <!-- header_eof //-->
  184. <!-- body //-->
  185. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  186. <tr>
  187. <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
  188. <!-- left_navigation //-->
  189. <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
  190. <!-- left_navigation_eof //-->
  191. </table></td>
  192. <!-- body_text //-->
  193. <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  194. <tr>
  195. <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  196. <tr>
  197. <td valign="bottom" class="pageHeading">
  198. <?php echo HEADING_TITLE; ?>
  199. <br clear="all"><br><span class="smallText" style="color:#909090"><? echo TEXT_SET_REFRESH_RATE; ?>:&nbsp;</span>
  200. <span style="font-size: 10px; color:#0000CC">
  201. <!-- For loop displays refresh time links -->
  202. <?php
  203. echo '<a class="menuBoxContentLink" href="whos_online.php"><b> ' . TEXT_NONE_ . ' </b></a>';
  204. foreach ($refresh_time as $key => $value) {
  205. echo ' &#183; <a class="menuBoxContentLink" href="whos_online.php?' . $value . '"><b>' . $refresh_display[$key] . '</b></a>';
  206. }
  207. ?>
  208. <script language="JavaScript">
  209. <!-- Begin
  210. Stamp = new Date();
  211. document.write('&nbsp;&nbsp;-&nbsp;&nbsp;Last Refresh: ');
  212. var Hours;
  213. var Mins;
  214. var Time;
  215. Hours = Stamp.getHours();
  216. if (Hours >= 12) {
  217. Time = " p.m.";
  218. }
  219. else {
  220. Time = " a.m.";
  221. }
  222. if (Hours > 12) {
  223. Hours -= 12;
  224. }
  225. if (Hours == 0) {
  226. Hours = 12;
  227. }
  228. Mins = Stamp.getMinutes();
  229. if (Mins < 10) {
  230. Mins = "0" + Mins;
  231. }
  232. document.write('<strong>' + Hours + ":" + Mins + Time + '</strong>');
  233. // End -->
  234. </script>
  235. </span>
  236. <!-- Display Profile links -->
  237. <br clear="all">
  238. <span class="smallText" style="color:#909090"><?php echo TEXT_PROFILE_DISPLAY; ?>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  239. <span style="font-size: 10px; color:#0000CC">
  240. <a href="whos_online.php" class="menuBoxContentLink"><b><?php echo TEXT_NONE_; ?></b></a> &#183;
  241. <a href="whos_online.php?showAll" class="menuBoxContentLink"><b><? echo TEXT_ALL; ?></b></a> &#183;
  242. <a href="whos_online.php?showBots" class="menuBoxContentLink"><b><? echo TEXT_BOTS; ?></b></a> &#183;
  243. <a href="whos_online.php?showCust" class="menuBoxContentLink"><b><? echo TEXT_CUSTOMERS; ?></b></a>
  244. </span></span>
  245. </td>
  246. <!-- Status Legend - Uses variables for image names -->
  247. <td align="right" class="smallText" valign="bottom">
  248. <table border="0" cellspacing="0" cellpadding="0">
  249. <tr>
  250. <td class="smallText"><?php echo
  251. tep_image(DIR_WS_IMAGES . $status_active_cart, TEXT_STATUS_ACTIVE_CART) . '&nbsp;' . TEXT_STATUS_ACTIVE_CART . '&nbsp;&nbsp;';
  252. ?></td>
  253. <td class="smallText"><?php echo
  254. tep_image(DIR_WS_IMAGES . $status_inactive_cart, TEXT_STATUS_INACTIVE_CART) . '&nbsp;' . TEXT_STATUS_INACTIVE_CART . '&nbsp;&nbsp;';
  255. ?></td>
  256. </tr>
  257. <tr>
  258. <td class="smallText"><?php echo
  259. tep_image(DIR_WS_IMAGES . $status_active_nocart, TEXT_STATUS_ACTIVE_NOCART) . '&nbsp;' . TEXT_STATUS_ACTIVE_NOCART .'&nbsp;&nbsp;';
  260. ?></td>
  261. <td class="smallText"><?php echo
  262. tep_image(DIR_WS_IMAGES . $status_inactive_nocart, TEXT_STATUS_INACTIVE_NOCART) . '&nbsp;' . TEXT_STATUS_INACTIVE_NOCART . '&nbsp;&nbsp;';
  263. ?></td>
  264. </tr>
  265. <tr>
  266. <td class="smallText"><?php echo
  267. tep_image(DIR_WS_IMAGES . $status_active_bot, TEXT_STATUS_ACTIVE_BOT) . '&nbsp;' . TEXT_STATUS_ACTIVE_BOT . '&nbsp;&nbsp;';
  268. ?></td>
  269. <td class="smallText"><?php echo
  270. tep_image(DIR_WS_IMAGES . $status_inactive_bot, TEXT_STATUS_INACTIVE_BOT) . '&nbsp;' . TEXT_STATUS_INACTIVE_BOT . '&nbsp;&nbsp;';
  271. ?></td>
  272. </tr>
  273. </table>
  274. </td>
  275. </tr>
  276. </table></td>
  277. </tr>
  278. <tr>
  279. <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  280. <tr>
  281. <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  282. <tr class="dataTableHeadingRow">
  283. <td class="dataTableHeadingContent" colspan="2" nowrap align="center"><?php echo TABLE_HEADING_ONLINE; ?></td>
  284. <td class="dataTableHeadingContent" nowrap><?php echo TABLE_HEADING_FULL_NAME; ?></td>
  285. <td class="dataTableHeadingContent" nowrap><?php echo TABLE_HEADING_IP_ADDRESS; ?></td>
  286. <td class="dataTableHeadingContent" nowrap><?php echo TABLE_HEADING_ENTRY_TIME; ?></td>
  287. <td class="dataTableHeadingContent" nowrap><?php echo TABLE_HEADING_LAST_CLICK; ?></td>
  288. <td class="dataTableHeadingContent" width="200"><?php echo TABLE_HEADING_LAST_PAGE_URL; ?>&nbsp;</td>
  289. <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_USER_SESSION; ?>&nbsp;</td>
  290. <td class="dataTableHeadingContent" align="center" nowrap><?php echo TABLE_HEADING_HTTP_REFERER; ?>&nbsp;</td>
  291. </tr>
  292. <?php
  293. // Order by is on Last Click. Also initialize total_bots and total_admin counts
  294. $whos_online_query = tep_db_query("select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, http_referer, user_agent, session_id from " . TABLE_WHOS_ONLINE . ' order by time_last_click DESC');
  295. $total_bots=0;
  296. $total_admin=0;
  297. $total_guests=0;
  298. $total_loggedon=0;
  299. while ($whos_online = tep_db_fetch_array($whos_online_query)) {
  300. $time_online = ($whos_online['time_last_click'] - $whos_online['time_entry']);
  301. if ((!isset($_GET['info']) || (isset($_GET['info']) && ($_GET['info'] == $whos_online['session_id']))) && !isset($info)) {
  302. $info = $whos_online['session_id'];
  303. }
  304. /* BEGIN COUNT MOD */
  305. if ($old_array['ip_address'] == $whos_online['ip_address']) {
  306. $i++;
  307. }
  308. /* END COUNT MOD */
  309. if ($whos_online['session_id'] == $info) {
  310. if($whos_online['http_referer'] != "")
  311. {
  312. $http_referer_url = $whos_online['http_referer'];
  313. }
  314. echo '<tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n";
  315. } else {
  316. 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";
  317. }
  318. // Display Status
  319. // Check who it is and set values
  320. $is_bot = $is_admin = $is_guest = $is_account = false;
  321. // Bot detection
  322. if ($whos_online['customer_id'] < 0) {
  323. $total_bots++;
  324. $fg_color = $fg_color_bot;
  325. $is_bot = true;
  326. // Admin detection
  327. } elseif ($whos_online['ip_address'] == tep_get_ip_address() ) { //$_SERVER["REMOTE_ADDR"]) {
  328. $total_admin++;
  329. $fg_color = $fg_color_admin;
  330. $is_admin = true;
  331. // Guest detection (may include Bots not detected by Prevent Spider Sessions/spiders.txt)
  332. } elseif ($whos_online['customer_id'] == 0) {
  333. $fg_color = $fg_color_guest;
  334. $is_guest = true;
  335. $total_guests++;
  336. // Everyone else (should only be account holders)
  337. } else {
  338. $fg_color = $fg_color_account;
  339. $is_account = true;
  340. $total_loggedon++;
  341. }
  342. ?>
  343. <!-- Status Light Column -->
  344. <td class="dataTableContent" align="left" valign="top">
  345. <?php echo '&nbsp;' . tep_check_cart($whos_online['session_id'], $whos_online['customer_id'], $whos_online['session_id']); ?>
  346. </td>
  347. <!-- Time Online Column -->
  348. <td class="dataTableContent" valign="top"><font color="<?php echo $fg_color; ?>">
  349. <?php echo gmdate('H:i:s', $time_online); ?>
  350. </font>&nbsp;</td>
  351. <!-- Name Column -->
  352. <td class="dataTableContent" valign="top"><font color="<?php echo $fg_color; ?>">
  353. <?php
  354. // WOL 1.6 Restructured to Check for Guest or Admin
  355. if ( $is_guest || $is_admin )
  356. {
  357. echo $whos_online['full_name'] . '&nbsp;';
  358. // Check for Bot
  359. } elseif ( $is_bot ) {
  360. // Tokenize UserAgent and try to find Bots name
  361. $tok = strtok($whos_online['full_name']," ();/");
  362. while ($tok) {
  363. if ( strlen($tok) > 3 )
  364. if ( !strstr($tok, "mozilla") &&
  365. !strstr($tok, "compatible") &&
  366. !strstr($tok, "msie") &&
  367. !strstr($tok, "windows")
  368. ) {
  369. echo "$tok";
  370. break;
  371. }
  372. $tok = strtok(" ();/");
  373. }
  374. // Check for Account
  375. } elseif ( $is_account ) {
  376. echo '<a HREF="customers.php?selected_box=customers&cID=' . $whos_online['customer_id'] . '&action=edit">' . $whos_online['full_name'] . '</a>';
  377. } else {
  378. echo TEXT_ERROR;
  379. }
  380. ?>
  381. </font>&nbsp;</td>
  382. <!-- IP Address Column -->
  383. <td class="dataTableContent" valign="top">
  384. <?php
  385. // Show 'Admin' instead of IP for Admin
  386. if ( $is_admin )
  387. echo TEXT_ADMIN;
  388. else {
  389. // Show IP with link to IP checker
  390. // echo '<a HREF="http://www.showmyip.com/?ip=' . $whos_online['ip_address'] . '" target="_blank">
  391. ?>
  392. <a HREF="<?php echo ('http://www.showmyip.com/?ip=' . $whos_online['ip_address']);?>" target="_blank">
  393. <font color="<?php echo $fg_color; ?>">
  394. <?php
  395. echo $whos_online['ip_address'];
  396. }
  397. ?>
  398. </font></a>
  399. &nbsp;</td>
  400. <!-- Time Entry Column -->
  401. <td class="dataTableContent" valign="top"><font color="<?php echo $fg_color; ?>">
  402. <?php echo date('H:i:s', $whos_online['time_entry']); ?>
  403. </font></td>
  404. <!-- Last Click Column -->
  405. <td class="dataTableContent" align="center" valign="top"><font color="<?php echo $fg_color; ?>">
  406. <?php echo date('H:i:s', $whos_online['time_last_click']); ?>
  407. </font>&nbsp;</td>
  408. <!-- Last URL Column -->
  409. <td class="dataTableContent" valign="top">
  410. <?php
  411. $temp_url_link = $whos_online['last_page_url'];
  412. if (eregi('^(.*)' . tep_session_name() . '=[a-f,0-9]+[&]*(.*)', $whos_online['last_page_url'], $array)) {
  413. $temp_url_display = $array[1] . $array[2];
  414. } else {
  415. $temp_url_display = $whos_online['last_page_url'];
  416. }
  417. // WOL 1.6 - Removes osCid from the Last Click URL and the link
  418. if ( $osCsid_position = strpos($temp_url_display, "osCsid") )
  419. $temp_url_display = substr_replace($temp_url_display, "", $osCsid_position - 1 );
  420. if ( $osCsid_position = strpos($temp_url_link, "osCsid") )
  421. $temp_url_link = substr_replace($temp_url_link, "", $osCsid_position - 1 );
  422. // alteration for last url product name eof
  423. if (strpos($temp_url_link,'product_info.php')) {
  424. $temp=str_replace('product_info.php','',$temp_url_link);
  425. $temp=str_replace('/?','',$temp);
  426. $temp=str_replace('?','',$temp);
  427. $parameters=split("&",$temp);
  428. $i=0;
  429. while($i < count($parameters)) {
  430. $a=split("=",$parameters[$i]);
  431. if ($a[0]="products_id") { $products_id=$a[1]; }
  432. $i++;
  433. }
  434. $product_query=tep_db_query("select products_name from products_description where products_id='" . $products_id . "' and language_id = '" . $languages_id . "'");
  435. $product = tep_db_fetch_array($product_query);
  436. $display_link = $product['products_name'].' <I>(Product)</I>';
  437. }elseif (strpos($temp_url_link,'?cPath=')) {
  438. $temp=str_replace('index.php?','',$temp_url_link);
  439. $temp=str_replace('?','',$temp);
  440. $temp=str_replace('/','',$temp);
  441. $parameters=split("&",$temp);
  442. $i=0;
  443. while($i < count($parameters)) {
  444. $a=split("=",$parameters[$i]);
  445. if ($a[0]=="cPath") { $cat=$a[1]; }
  446. $i++;
  447. }
  448. $parameters=split("_",$cat);
  449. //$cat_list='';
  450. $i=0;
  451. while($i < count($parameters)) {
  452. $category_query=tep_db_query("select categories_name from categories_description where categories_id='" . $parameters[$i] . "' and language_id = '" . $languages_id . "'");
  453. $category = tep_db_fetch_array($category_query);
  454. if ($i>0) { $cat_list.=' / '.$category['categories_name']; } else { $cat_list=$category['categories_name']; }
  455. $i++;
  456. }
  457. $display_link = $cat_list.' <I>(Category)</I>';
  458. } else {
  459. $display_link = $temp_url_display;
  460. }
  461. // alteration for last url product name eof
  462. ?>
  463. <a HREF="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . $temp_url_link; ?>" target="_blank">
  464. <font color="<?php echo $fg_color; ?>">
  465. <?php
  466. // echo $temp_url_display;
  467. echo $display_link; // alteration for last url product name
  468. ?>
  469. </font>
  470. </a>
  471. </td>
  472. <!-- osCsid? Column -->
  473. <td class="dataTableContent" align="center" valign="top"><font color="<?php echo $fg_color; ?>">
  474. <?php
  475. if($whos_online['session_id'] != $whos_online['ip_address']) {
  476. echo TEXT_IN_SESSION;
  477. } else {
  478. echo TEXT_NO_SESSION;
  479. }
  480. ?>
  481. </font></td>
  482. <!-- Referer? Column -->
  483. <td class="dataTableContent" align="center" valign="top"><font color="<?php echo $fg_color; ?>">
  484. <?php
  485. if($whos_online['http_referer'] == "") {
  486. echo TEXT_HTTP_REFERER_NOT_FOUND;
  487. } else {
  488. echo TEXT_HTTP_REFERER_FOUND;
  489. }
  490. ?>
  491. </font></td>
  492. </tr>
  493. <tr class="dataTableRow">
  494. <td class="dataTableContent" colspan="3"></td>
  495. <td class="dataTableContent" colspan="6"><font color="<?php echo $fg_color; ?>">
  496. <?php
  497. // Display Details for All
  498. if ( $_SERVER["QUERY_STRING"] == showAll ) {
  499. display_details();
  500. }
  501. // Display Details for Bots
  502. else if( $_SERVER["QUERY_STRING"] == showBots ){
  503. if ( $is_bot ) {
  504. display_details();
  505. }
  506. }
  507. // Display Details for Customers
  508. else if( $_SERVER["QUERY_STRING"] == showCust ){
  509. if ( $is_guest || $is_account || $is_admin ) {
  510. display_details();
  511. }
  512. }
  513. ?>
  514. </font></td>
  515. </tr>
  516. <?php
  517. $old_array = $whos_online;
  518. }
  519. if (!$i) {
  520. $i=0;
  521. }
  522. $total_dupes = $i;
  523. $total_sess = tep_db_num_rows($whos_online_query);
  524. // Subtract Bots and Me from Real Customers. Only subtract me once as Dupes will remove others
  525. $total_cust = $total_sess - $total_dupes - $total_bots - ($total_admin > 1? 1 : $total_admin);
  526. ?>
  527. <?php
  528. if(isset($http_referer_url))
  529. {
  530. ?>
  531. <tr>
  532. <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>
  533. </tr>
  534. <?php
  535. }
  536. ?>
  537. <tr>
  538. <!-- WOL 1.4 - Added Bot and Me counts -->
  539. <td class="smallText" colspan="9"><br><table border="0" cellpadding="0" cellspacing="0" width="600">
  540. <tr>
  541. <td class="smallText" align="right" width="30"><?php print "$total_sess" ?></td>
  542. <td class="smallText" align="left" width="570">&nbsp;&nbsp;<?php echo TEXT_NUMBER_OF_CUSTOMERS; ?></td>
  543. </tr>
  544. <tr>
  545. <td class="smallText" align="right" width="30"><?php print "$total_dupes" ?></td>
  546. <td class="smallText" align="left" width="570">&nbsp;&nbsp;<?php echo TEXT_DUPLICATE_IP; ?></td>
  547. </tr>
  548. <tr>
  549. <td class="smallText" align="right" width="30"><?php print "$total_bots" ?></td>
  550. <td class="smallText" width="570">&nbsp;&nbsp;<?php echo TEXT_BOTS; ?></td>
  551. </tr>
  552. <tr>
  553. <td class="smallText" align="right" width="30"><?php print "$total_admin" ?></td>
  554. <td class="smallText" width="570">&nbsp;&nbsp;<?php echo TEXT_ME; ?></td>
  555. </tr>
  556. <tr>
  557. <td class="smallText" align="right" width="30"><?php print "$total_cust" ?></td>
  558. <td class="smallText" width="570">&nbsp;&nbsp;<?php echo TEXT_REAL_CUSTOMERS; ?></td>
  559. </tr>
  560. </table><br>
  561. <?php print "<b>" . TEXT_MY_IP_ADDRESS . ":</b>&nbsp;".tep_get_ip_address(); ?><br><br><b>Note.</b> "N/A". Not Available</td>
  562. <!-- WOL 1.4 eof -->
  563. </tr>
  564. </table></td>
  565. <?php
  566. $heading = array();
  567. $contents = array();
  568. $heading[] = array('text' => '<b>' . TABLE_HEADING_SHOPPING_CART . '</b>');
  569. if (isset($info)) {
  570. if (STORE_SESSIONS == 'mysql') {
  571. $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $info . "'");
  572. $session_data = tep_db_fetch_array($session_data);
  573. $session_data = trim($session_data['value']);
  574. } else {
  575. if ( (file_exists(tep_session_save_path() . '/sess_' . $info)) && (filesize(tep_session_save_path() . '/sess_' . $info) > 0) ) {
  576. $session_data = file(tep_session_save_path() . '/sess_' . $info);
  577. $session_data = trim(implode('', $session_data));
  578. }
  579. }
  580. if ($length = strlen($session_data)) {
  581. if (PHP_VERSION < 4) {
  582. $start_id = strpos($session_data, 'customer_id[==]s');
  583. $start_cart = strpos($session_data, 'cart[==]o');
  584. $start_currency = strpos($session_data, 'currency[==]s');
  585. $start_country = strpos($session_data, 'customer_country_id[==]s');
  586. $start_zone = strpos($session_data, 'customer_zone_id[==]s');
  587. } else {
  588. $start_id = strpos($session_data, 'customer_id|s');
  589. $start_cart = strpos($session_data, 'cart|O');
  590. $start_currency = strpos($session_data, 'currency|s');
  591. $start_country = strpos($session_data, 'customer_country_id|s');
  592. $start_zone = strpos($session_data, 'customer_zone_id|s');
  593. }
  594. for ($i=$start_cart; $i<$length; $i++) {
  595. if ($session_data[$i] == '{') {
  596. if (isset($tag)) {
  597. $tag++;
  598. } else {
  599. $tag = 1;
  600. }
  601. } elseif ($session_data[$i] == '}') {
  602. $tag--;
  603. } elseif ( (isset($tag)) && ($tag < 1) ) {
  604. break;
  605. }
  606. }
  607. $session_data_id = substr($session_data, $start_id, (strpos($session_data, ';', $start_id) - $start_id + 1));
  608. $session_data_cart = substr($session_data, $start_cart, $i);
  609. $session_data_currency = substr($session_data, $start_currency, (strpos($session_data, ';', $start_currency) - $start_currency + 1));
  610. $session_data_country = substr($session_data, $start_country, (strpos($session_data, ';', $start_country) - $start_country + 1));
  611. $session_data_zone = substr($session_data, $start_zone, (strpos($session_data, ';', $start_zone) - $start_zone + 1));
  612. session_decode($session_data_id);
  613. session_decode($session_data_currency);
  614. session_decode($session_data_country);
  615. session_decode($session_data_zone);
  616. session_decode($session_data_cart);
  617. if (PHP_VERSION < 4) {
  618. $broken_cart = $cart;
  619. $cart = new shoppingCart;
  620. $cart->unserialize($broken_cart);
  621. }
  622. if (is_object($cart)) {
  623. $products = $cart->get_products();
  624. for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
  625. $contents[] = array('text' => $products[$i]['quantity'] . ' x ' . $products[$i]['name']);
  626. }
  627. if (sizeof($products) > 0) {
  628. $contents[] = array('text' => tep_draw_separator('pixel_black.gif', '100%', '1'));
  629. $contents[] = array('align' => 'right', 'text' => TEXT_SHOPPING_CART_SUBTOTAL . ' ' . $currencies->format($cart->show_total(), true, $currency));
  630. } else {
  631. $contents[] = array('text' => 'Empty');
  632. }
  633. }
  634. }
  635. }
  636. // Show shopping cart contents for selected entry
  637. echo ' <td valign="top">' . "\n";
  638. $box = new box;
  639. echo $box->infoBox($heading, $contents);
  640. echo '</td>' . "\n";
  641. ?>
  642. </tr>
  643. </table></td>
  644. </tr>
  645. </table></td>
  646. <!-- body_text_eof //-->
  647. </tr>
  648. </table>
  649. <!-- body_eof //-->
  650. <!-- footer //-->
  651. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  652. <!-- footer_eof //-->
  653. <br>
  654. </body>
  655. </html>
  656. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>