ZenCart_Documentation  1.5.0
http://www.collinsharper.com
C:/xampp/htdocs/zen-cart/admin/whos_online.php
Go to the documentation of this file.
00001 <?php
00010 // Default refresh interval (0=off).  NOTE: Using automated refresh may put you in breach of PCI Compliance
00011   $defaultRefreshInterval = 0;
00012 
00013 // highlight bots
00014 function zen_check_bot($checking) {
00015   if (empty($checking)) {
00016     return true;
00017   } else {
00018     return false;
00019   }
00020 }
00021 
00022 function zen_check_quantity($which) {
00023   global $db;
00024   $which_query = $db->Execute("select sesskey, value
00025                                from " . TABLE_SESSIONS . "
00026                                where sesskey= '" . $which . "'");
00027 
00028   $who_query = $db->Execute("select session_id, time_entry, time_last_click, host_address, user_agent
00029                              from " . TABLE_WHOS_ONLINE . "
00030                              where session_id='" . $which . "'");
00031 
00032   // longer than 2 minutes light color
00033   $xx_mins_ago_long = (time() - WHOIS_TIMER_INACTIVE);
00034 
00035   $chk_cart_status = base64_decode($which_query->fields['value']);
00036   switch (true) {
00037     case ($which_query->RecordCount() == 0):
00038     if ($who_query->fields['time_last_click'] < $xx_mins_ago_long) {
00039       return zen_image(DIR_WS_IMAGES . 'icon_status_red_light.gif');
00040     } else {
00041       return zen_image(DIR_WS_IMAGES . 'icon_status_red.gif');
00042     }
00043     break;
00044     case (strstr($chk_cart_status,'"contents";a:0:')):
00045     if ($who_query->fields['time_last_click'] < $xx_mins_ago_long) {
00046       return zen_image(DIR_WS_IMAGES . 'icon_status_red_light.gif');
00047     } else {
00048       return zen_image(DIR_WS_IMAGES . 'icon_status_red.gif');
00049     }
00050     break;
00051     case (!strstr($chk_cart_status,'"contents";a:0:')):
00052     if ($who_query->fields['time_last_click'] < $xx_mins_ago_long) {
00053       return zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif');
00054     } else {
00055       return zen_image(DIR_WS_IMAGES . 'icon_status_green.gif');
00056     }
00057     break;
00058   }
00059 }
00060 
00061 // time since last click
00062 function zen_check_minutes($the_time_last_click) {
00063   $the_seconds = (time() - $the_time_last_click);
00064   $the_time_since= gmdate('H:i:s', $the_seconds);
00065   return $the_time_since;
00066 }
00067 
00068   require('includes/application_top.php');
00069 
00070   require(DIR_WS_CLASSES . 'currencies.php');
00071   $currencies = new currencies();
00072 
00073   // same time_entry as time_last_click for 600 seconds = 10 minutes assumed to have left immediately
00074   $xx_mins_ago_dead = (time() - WHOIS_TIMER_DEAD);
00075 
00076   // remove after how many seconds? default= 1200 = 20 minutes
00077   $xx_mins_ago = (time() - WHOIS_TIMER_REMOVE);
00078 
00079 // remove entries that have expired
00080   $db->Execute("delete from " . TABLE_WHOS_ONLINE . "
00081                 where time_last_click < '" . $xx_mins_ago . "'
00082                 or (time_entry=time_last_click
00083                 and time_last_click < '" . $xx_mins_ago_dead . "')");
00084 
00085   if (!isset($_SESSION['wo_exclude_admins'])) {
00086     $_SESSION['wo_exclude_admins'] = TRUE;
00087   }
00088   if (isset($_GET['na'])) {
00089     $_SESSION['wo_exclude_admins'] = ($_GET['na'] == 0) ? FALSE : TRUE;
00090   }
00091 
00092   if (!isset($_SESSION['wo_exclude_spiders'])) {
00093     $_SESSION['wo_exclude_spiders'] = TRUE;
00094   }
00095   if (isset($_GET['ns'])) {
00096     $_SESSION['wo_exclude_spiders'] = ($_GET['ns'] == 0) ? FALSE : TRUE;
00097   }
00098 
00099   if (isset($_GET['t']) ) {
00100     $_SESSION['wo_timeout'] = (int)$_GET['t'];
00101   }
00102   if (!isset($_SESSION['wo_timeout'])) {
00103     $_SESSION['wo_timeout'] = $defaultRefreshInterval;
00104   }
00105   if (!isset($_SESSION['wo_timeout']) || $_SESSION['wo_timeout'] < 3) {
00106     $_SESSION['wo_timeout'] = 0;
00107   }
00108 
00109   $listing = $_GET['q'];
00110   switch ($listing) {
00111       case "full_name-desc":
00112       $order = "full_name DESC, LPAD(ip_address,11,'0')";
00113       break;
00114       case "full_name":
00115       $order = "full_name, LPAD(ip_address,11,'0')";
00116       break;
00117       case "ip_address":
00118       $order = "ip_address, session_id";
00119       break;
00120       case "ip_address-desc":
00121       $order = "ip_address DESC, session_id";
00122       break;
00123       case "time_last_click-desc":
00124       $order = "time_last_click DESC, LPAD(ip_address,11,'0')";
00125       break;
00126       case "time_last_click":
00127       $order = "time_last_click, LPAD(ip_address,11,'0')";
00128       break;
00129       case "time_entry-desc":
00130       $order = "time_entry DESC, LPAD(ip_address,11,'0')";
00131       break;
00132       case "time_entry":
00133       $order = "time_entry, LPAD(ip_address,11,'0')";
00134       break;
00135       case "last_page_url-desc":
00136       $order = "last_page_url DESC, LPAD(ip_address,11,'0')";
00137       break;
00138       case "last_page_url":
00139       $order = "last_page_url, LPAD(ip_address,11,'0')";
00140       break;
00141       case "session_id":
00142       $order = "session_id, ip_address";
00143       break;
00144       case "session_id-desc":
00145       $order = "session_id DESC, ip_address";
00146       break;
00147       default:
00148       $order = "time_entry, LPAD(ip_address,11,'0')";
00149   }
00150   $where = '';
00151   if ($_SESSION['wo_exclude_spiders']) {
00152     $where = "where session_id != '' ";
00153   }
00154   if ($_SESSION['wo_exclude_admins']) {
00155     $where .= ($where == '') ? " where " : " and ";
00156     $where .= "ip_address != '' and ip_address not in ('" . implode("','", preg_split('/[\s,]/', EXCLUDE_ADMIN_IP_FOR_MAINTENANCE . ',' . $_SERVER['REMOTE_ADDR'])) . "') ";
00157   }
00158   $sql = "select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, session_id, host_address, user_agent
00159           from " . TABLE_WHOS_ONLINE . " :where: order by :orderby:";
00160   $sql = $db->bindVars($sql, ':where:', $where, 'passthru');
00161   $sql = $db->bindVars($sql, ':orderby:', $order, 'passthru');
00162   $whos_online = $db->Execute($sql);
00163   $total_sess = $whos_online->RecordCount();
00164 
00165   $optURL = FILENAME_WHOS_ONLINE . '.php?' . zen_get_all_get_params(array('t', 'na', 'ns'));
00166   $listingURL = FILENAME_WHOS_ONLINE . '.php?' . zen_get_all_get_params(array('q', 't', 'na', 'ns'));
00167 ?>
00168 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
00169 <html <?php echo HTML_PARAMS; ?>>
00170 <head>
00171 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
00172 <title><?php echo TITLE; ?></title>
00173 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
00174 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
00175 <script language="javascript" src="includes/menu.js"></script>
00176 <script language="javascript" src="includes/general.js"></script>
00177 <script type="text/javascript">
00178   <!--
00179   function init()
00180   {
00181     cssjsmenu('navbar');
00182     if (document.getElementById)
00183     {
00184       var kill = document.getElementById('hoverJS');
00185       kill.disabled = true;
00186     }
00187   }
00188  function refreshTimer(time)
00189   {
00190      if(time.length>=2) {
00191      clearTimeout(initTimer);
00192      if(theTimer!=null) {
00193        clearTimeout(theTimer);
00194      }
00195      var theTimer = setTimeout('window.location="<?php echo $optURL; ?>t='+time+'&auto=true"', (time*1000));
00196    }
00197   }
00198 <?php if (isset($_SESSION['wo_timeout']) && (int)$_SESSION['wo_timeout'] > 0) { ?>
00199    var initTimer = setTimeout('location.reload(true)', <?php echo (isset($_SESSION['wo_timeout'])) ? $_SESSION['wo_timeout'] * 1000 : '60000'; ?>);
00200 <?php } ?>
00201 
00202   // -->
00203 </script>
00204 <style>
00205 <!-- inline CSS Styles
00206 .whos-online td {
00207   color:#444;
00208   font-family:Helvetica, Arial, sans-serif;
00209   }
00210 .whos-online td.infoBoxHeading {
00211   color:#fff;
00212   }
00213 .last-url-link {
00214   background:#fff;
00215   border:1px dashed #aaa;
00216   margin:5px 0;
00217   padding:5px;
00218   }
00219 .last-url-link a {
00220   color:green;
00221   }
00222 .dataTableRowBot .last-url-link a {color: #333;}
00223 .dataTableRowSelectedBot .last-url-link a {color: #333;}
00224 .dataTableRowBot .last-url-link {background: #f0cbfa;}
00225 .dataTableRowSelectedBot .last-url-link {background: #f0cbfa;}
00226 
00227 #wo-legend {float: left;}
00228 #wo-filters { float: right; background-color: #599659; color: #fff}
00229 #wo-filters .optionClick { display: inline-block; color: #fff; border: 1px solid #fff; font-weight: bold; padding: 1px; margin: 2px 1px;}
00230 #wo-filters .chosen {background-color: #003D00;}
00231 -->
00232 </style>
00233 </head>
00234 <body onLoad="init()">
00235 <!-- header //-->
00236 <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
00237 <!-- header_eof //-->
00238 
00239 <!-- body //-->
00240 <table border="0" width="100%" cellspacing="2" cellpadding="2">
00241   <tr>
00242 <!-- body_text //-->
00243     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00244       <tr>
00245         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00246           <tr>
00247             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
00248             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
00249           </tr>
00250           <tr>
00251             <td class="smallText" colspan="2"><div id="wo-legend">
00252               <?php echo
00253               '<a href="' . zen_href_link(FILENAME_WHOS_ONLINE . '.php', zen_get_all_get_params()) . '" class="menuBoxContentLink">' . '<strong><u>' . WHOS_ONLINE_REFRESH_LIST_TEXT . '</u></strong>' . '</a>' .
00254               '<br />' . "\n" . WHOS_ONLINE_LEGEND_TEXT . '&nbsp;' .
00255               zen_image(DIR_WS_IMAGES . 'icon_status_green.gif') . '&nbsp;' . WHOS_ONLINE_ACTIVE_TEXT . '&nbsp;&nbsp;' .
00256               zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif') . '&nbsp;' . WHOS_ONLINE_INACTIVE_TEXT . '&nbsp;&nbsp;' .
00257               zen_image(DIR_WS_IMAGES . 'icon_status_red.gif') . '&nbsp;' . WHOS_ONLINE_ACTIVE_NO_CART_TEXT . '&nbsp;&nbsp;' .
00258               zen_image(DIR_WS_IMAGES . 'icon_status_red_light.gif') . '&nbsp;' . WHOS_ONLINE_INACTIVE_NO_CART_TEXT . '<br />' .
00259               WHOS_ONLINE_INACTIVE_LAST_CLICK_TEXT . '&nbsp;' . WHOIS_TIMER_INACTIVE . 's' .'&nbsp;||&nbsp;' . WHOS_ONLINE_INACTIVE_ARRIVAL_TEXT . '&nbsp;' .
00260               WHOIS_TIMER_DEAD . 's&nbsp;' . WHOS_ONLINE_REMOVED_TEXT;?>
00261               </div>
00262 
00263               <div id="wo-filters">
00264                 <?php echo TEXT_WHOS_ONLINE_TIMER_UPDATING . ($_SESSION['wo_timeout'] > 0 ? sprintf(TEXT_WHOS_ONLINE_TIMER_EVERY, $_SESSION['wo_timeout']) : TEXT_WHOS_ONLINE_TIMER_DISABLED); ?>
00265 
00266                 <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='0') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=0"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ0; ?></a>&nbsp;
00267                 <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='5') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=5"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ1; ?></a>&nbsp;
00268                 <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='15') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=15"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ2; ?></a>&nbsp;
00269                 <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='30') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=30"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ3; ?></a>&nbsp;
00270                 <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='60') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=60"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ4; ?></a>&nbsp;<br />
00271 
00272                 <?php echo TEXT_WHOS_ONLINE_FILTER_SPIDERS; ?>
00273                 <a class="optionClick<?php echo ($_SESSION['wo_exclude_spiders'])  ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>ns=1"><?php echo TEXT_YES; ?></a>&nbsp;
00274                 <a class="optionClick<?php echo (!$_SESSION['wo_exclude_spiders']) ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>ns=0"><?php echo TEXT_NO; ?></a>&nbsp;
00275                 &nbsp;&nbsp&nbsp;
00276                 <?php echo TEXT_WHOS_ONLINE_FILTER_ADMINS; ?>
00277                 <a class="optionClick<?php echo ($_SESSION['wo_exclude_admins'])  ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>na=1"><?php echo TEXT_YES; ?></a>&nbsp;
00278                 <a class="optionClick<?php echo (!$_SESSION['wo_exclude_admins']) ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>na=0"><?php echo TEXT_NO; ?></a>&nbsp;
00279               </div>
00280             </td>
00281           </tr>
00282           <tr>
00283             <td class="smallText" colspan="2" valign="top"><?php echo sprintf(TEXT_NUMBER_OF_CUSTOMERS, $total_sess);?>
00284             </td>
00285           </tr>
00286           <tr>
00287             <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
00288           </tr>
00289         </table></td>
00290       </tr>
00291       <tr class="whos-online">
00292         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00293           <tr>
00294             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00295               <tr class="dataTableHeadingRowWhois">
00296                 <td class="dataTableHeadingContentWhois"><?php echo TABLE_HEADING_ONLINE; ?></td>
00297                 <td class="dataTableHeadingContentWhois" align="center"><?php echo TABLE_HEADING_CUSTOMER_ID; ?></td>
00298 
00299                 <td class="dataTableHeadingContentWhois" align="center">
00300                   <?php echo (($listing=='full_name-desc' or $listing=='full_name') ? '<span class="dataTableHeadingContentWhois">' . TABLE_HEADING_FULL_NAME . '</span>' : TABLE_HEADING_FULL_NAME); ?>&nbsp;
00301                   <br /><a href="<?php echo $listingURL . "q=full_name"; ?>"><?php echo ($listing=='full_name' ? '<span class="dataTableHeadingContentWhois">' . 'Asc' . '</span>' : '<b>' . 'Asc' . '</b>'); ?></a>&nbsp;
00302                   &nbsp;<a href="<?php echo $listingURL . "q=full_name-desc"; ?>"><?php echo ($listing=='full_name-desc' ? '<span class="dataTableHeadingContentWhois">' . 'Desc' . '</span>' : '<b>' . 'Desc' . '</b>'); ?></a>&nbsp;
00303                 </td>
00304                 <td class="dataTableHeadingContentWhois" align="center">
00305                   <?php echo (($listing=='ip_address-desc' or $listing=='ip_address') ? '<span class="dataTableHeadingContentWhois">' . TABLE_HEADING_IP_ADDRESS . '</span>' : TABLE_HEADING_IP_ADDRESS); ?>&nbsp;
00306                   <br /><a href="<?php echo $listingURL . "q=ip_address"; ?>"><?php echo ($listing=='ip_address' ? '<span class="dataTableHeadingContentWhois">' . 'Asc' . '</span>' : '<b>' . 'Asc' . '</b>'); ?></a>&nbsp;
00307                   &nbsp;<a href="<?php echo $listingURL . "q=ip_address-desc"; ?>"><?php echo ($listing=='ip_address-desc' ? '<span class="dataTableHeadingContentWhois">' . 'Desc' . '</span>' : '<b>' . 'Desc' . '</b>'); ?></a>&nbsp;
00308                 </td>
00309                 <td class="dataTableHeadingContentWhois" align="center">
00310                   <?php echo (($listing=='session_id-desc' or $listing=='session_id') ? '<span class="dataTableHeadingContentWhois">' . TABLE_HEADING_SESSION_ID . '</span>' : TABLE_HEADING_SESSION_ID); ?>&nbsp;
00311                   <br /><a href="<?php echo $listingURL . "q=session_id"; ?>"><?php echo ($listing=='session_id' ? '<span class="dataTableHeadingContentWhois">' . 'Asc' . '</span>' : '<b>' . 'Asc' . '</b>'); ?></a>&nbsp;
00312                   &nbsp;<a href="<?php echo $listingURL . "q=session_id-desc"; ?>"><?php echo ($listing=='session_id-desc' ? '<span class="dataTableHeadingContentWhois">' . 'Desc' . '</span>' : '<b>' . 'Desc' . '</b>'); ?></a>&nbsp;
00313                 </td>
00314                 <td class="dataTableHeadingContentWhois" align="center">
00315                   <?php echo (($listing=='time_entry-desc' or $listing=='time_entry') ? '<span class="dataTableHeadingContentWhois">' . TABLE_HEADING_ENTRY_TIME . '</span>' : TABLE_HEADING_ENTRY_TIME); ?>&nbsp;
00316                   <br /><a href="<?php echo $listingURL . "q=time_entry"; ?>"><?php echo ($listing=='time_entry' ? '<span class="dataTableHeadingContentWhois">' . 'Asc' . '</span>' : '<b>' . 'Asc' . '</b>'); ?></a>&nbsp;
00317                   &nbsp;<a href="<?php echo $listingURL . "q=time_entry-desc"; ?>"><?php echo ($listing=='time_entry-desc' ? '<span class="dataTableHeadingContentWhois">' . 'Desc' . '</span>' : '<b>' . 'Desc' . '</b>'); ?></a>&nbsp;
00318                 </td>
00319                 <td class="dataTableHeadingContentWhois" align="center">
00320                   <?php echo (($listing=='time_last_click-desc' or $listing=='time_last_click') ? '<span class="dataTableHeadingContentWhois">' . TABLE_HEADING_LAST_CLICK . '</span>' : TABLE_HEADING_LAST_CLICK); ?>&nbsp;
00321                   <br /><a href="<?php echo $listingURL . "q=time_last_click"; ?>"><?php echo ($listing=='time_last_click' ? '<span class="dataTableHeadingContentWhois">' . 'Asc' . '</span>' : '<b>' . 'Asc' . '</b>'); ?></a>&nbsp;
00322                   &nbsp;<a href="<?php echo $listingURL . "q=time_last_click-desc"; ?>"><?php echo ($listing=='time_last_click-desc' ? '<span class="dataTableHeadingContentWhois">' . 'Desc' . '</span>' : '<b>' . 'Desc' . '</b>'); ?></a>&nbsp;
00323                 </td>
00324                 <td class="dataTableHeadingContentWhois" align="center">
00325                   <?php echo (($listing=='last_page_url-desc' or $listing=='last_page_url') ? '<span class="dataTableHeadingContentWhois">' . TABLE_HEADING_LAST_PAGE_URL . '</span>' : TABLE_HEADING_LAST_PAGE_URL); ?>&nbsp;
00326                   <br /><a href="<?php echo $listingURL . "q=last_page_url"; ?>"><?php echo ($listing=='last_page_url' ? '<span class="dataTableHeadingContentWhois">' . 'Asc' . '</span>' : '<b>' . 'Asc' . '</b>'); ?></a>&nbsp;
00327                   &nbsp;<a href="<?php echo $listingURL . "q=last_page_url-desc"; ?>"><?php echo ($listing=='last_page_url-desc' ? '<span class="dataTableHeadingContentWhois">' . 'Desc' . '</span>' : '<b>' . 'Desc' . '</b>'); ?></a>&nbsp;
00328                 </td>
00329               </tr>
00330 <?php
00331   $ip_array = array();
00332   $d=0;
00333   while (!$whos_online->EOF) {
00334     $time_online = (time() - $whos_online->fields['time_entry']);
00335     if ( ((!$_GET['info']) || (@$_GET['info'] == $whos_online->fields['session_id'])) && (!$info) ) {
00336       $info = $whos_online->fields['session_id'];
00337       $ip_address = $whos_online->fields['ip_address'];
00338       $full_name = $whos_online->fields['full_name'];
00339     }
00340 
00341 // Check for duplicates
00342     if (in_array($whos_online->fields['ip_address'], $ip_array)) {
00343       $d++;
00344     } else {
00345       $ip_array[] = $whos_online->fields['ip_address'];
00346     }
00347 
00348 // Check for bots
00349     $is_a_bot=zen_check_bot($whos_online->fields['session_id']);
00350   if ($whos_online->fields['session_id'] == $info) {
00351       if ($is_a_bot==true) {
00352         echo '              <tr class="dataTableRowSelectedBot">' . "\n";
00353       } else {
00354         echo '              <tr class="dataTableRowSelectedWhois">' . "\n";
00355       }
00356   } else {
00357     if ($is_a_bot==true) {
00358         echo '              <tr class="dataTableRowBot" onmouseover="this.className=\'dataTableRowOverBot\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRowBot\'" onclick="document.location.href=\'' . zen_href_link(FILENAME_WHOS_ONLINE, zen_get_all_get_params(array('info', 'action')) . 'info=' . $whos_online->fields['session_id'], 'NONSSL') . '\'">' . "\n";
00359       } else {
00360         echo '              <tr class="dataTableRowWhois" onmouseover="this.className=\'dataTableRowOverWhois\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRowWhois\'" onclick="document.location.href=\'' . zen_href_link(FILENAME_WHOS_ONLINE, zen_get_all_get_params(array('info', 'action')) . 'info=' . $whos_online->fields['session_id'], 'NONSSL') . '\'">' . "\n";
00361       }
00362   }
00363 ?>
00364                 <td class="dataTableContentWhois"><?php echo zen_check_quantity($whos_online->fields['session_id']) . '&nbsp;' . gmdate('H:i:s', $time_online); ?></td>
00365                 <td class="dataTableContentWhois" align="center">
00366                   <?php
00367                     if ($whos_online->fields['customer_id'] != 0) {
00368                       echo '<a href="' . zen_href_link(FILENAME_CUSTOMERS, zen_get_all_get_params(array('cID', 'action')) . 'cID=' . $whos_online->fields['customer_id'] . '&action=edit', 'NONSSL') . '"><u>' . $whos_online->fields['customer_id'] . '</u></a>';
00369                     } else {
00370                       echo $whos_online->fields['customer_id'];
00371                     }
00372                   ?>
00373                 </td>
00374                 <td class="dataTableContentWhois" nowrap="nowrap">
00375                   <?php
00376                     if ($whos_online->fields['customer_id'] != 0) {
00377                       echo '<a href="' . zen_href_link(FILENAME_ORDERS, 'cID=' . $whos_online->fields['customer_id'], 'NONSSL') . '">' . '<u>' . $whos_online->fields['full_name'] . '</u></a>';
00378                     } else {
00379                       echo $whos_online->fields['full_name'];
00380                     }
00381                   ?>
00382                 </td>
00383                 <td class="dataTableContentWhois" align="left" valign="top"><a href="http://whois.domaintools.com/<?php echo $whos_online->fields['ip_address']; ?>" target="_blank"><?php echo '<u>' . $whos_online->fields['ip_address'] . '</u>'; ?></a></td>
00384                 <td>&nbsp;</td>
00385                 <td class="dataTableContentWhois" align="center" valign="top"><?php echo date('H:i:s', $whos_online->fields['time_entry']); ?></td>
00386                 <td class="dataTableContentWhois" align="center" valign="top"><?php echo date('H:i:s', $whos_online->fields['time_last_click']); ?></td>
00387                 <td class="dataTableContentWhois" colspan="2" valign="top">&nbsp;</td>
00388               </tr>
00389 <?php
00390   // show host name
00391   if (WHOIS_SHOW_HOST=='1') {
00392     if ($whos_online->fields['session_id'] == $info) {
00393     if ($is_a_bot==true) {
00394         echo '              <tr class="dataTableRowSelectedBot">' . "\n";
00395       } else {
00396         echo '              <tr class="dataTableRowSelectedWhois">' . "\n";
00397       }
00398     } else {
00399       if ($is_a_bot==true) {
00400         echo '              <tr class="dataTableRowBot" onmouseout="this.className=\'dataTableRowBot\'" onclick="document.location.href=\'' . zen_href_link(FILENAME_WHOS_ONLINE, zen_get_all_get_params(array('info', 'action')) . 'info=' . zen_output_string_protected($whos_online->fields['session_id']), 'NONSSL') . '\'">' . "\n";
00401       } else {
00402         echo '              <tr class="dataTableRowWhois" onmouseout="this.className=\'dataTableRowWhois\'" onclick="document.location.href=\'' . zen_href_link(FILENAME_WHOS_ONLINE, zen_get_all_get_params(array('info', 'action')) . 'info=' . zen_output_string_protected($whos_online->fields['session_id']), 'NONSSL') . '\'">' . "\n";
00403       }
00404   }
00405 ?>
00406                 <td class="dataTableContentWhois" colspan=3 valign="top">&nbsp;&nbsp;<?php echo TIME_PASSED_LAST_CLICKED . '<br />&nbsp;&nbsp;&nbsp;&nbsp;' . zen_check_minutes($whos_online->fields['time_last_click']); ?> ago</td>
00407                 <td class="dataTableContentWhois" colspan=5 valign="top">
00408                   <?php
00409                     echo TEXT_SESSION_ID . zen_output_string_protected($whos_online->fields['session_id']) . '<br />' .
00410                     TEXT_HOST . zen_output_string_protected($whos_online->fields['host_address']) . '<br />' .
00411                     TEXT_USER_AGENT . zen_output_string_protected($whos_online->fields['user_agent']) . '<br />';
00412 
00413                     $lastURLlink = '<a href="' . zen_output_string_protected($whos_online->fields['last_page_url']) . '" target="_blank">' . '<u>' . zen_output_string_protected($whos_online->fields['last_page_url']) . '</u>' . '</a>';
00414                     if (preg_match('/^(.*)' . zen_session_name() . '=[a-f,0-9]+[&]*(.*)/i', $whos_online->fields['last_page_url'], $array)) {
00415                       $lastURLlink = zen_output_string_protected($array[1] . $array[2]);
00416                     }
00417                     echo '<div class="last-url-link">' . $lastURLlink . '</div>';
00418                   ?>
00419                 </td>
00420 
00421               </tr>
00422 <?php
00423   } // show host
00424 ?>
00425               <tr>
00426                <td colspan="8"><?php echo zen_draw_separator('pixel_trans.gif', '1', '3'); ?></td>
00427               </tr>
00428 
00429 <?php
00430   $whos_online->MoveNext();
00431   }
00432   if (!$d) {
00433     $d=0;
00434   }
00435   $total_dupes = $d;
00436   $ip_unique = sizeof($ip_array);
00437   $total_cust = $total_sess - $total_dupes;
00438 ?>
00439               <tr>
00440                 <td colspan="8"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
00441               </tr>
00442 <?php
00443 // repeat legend when whois >=
00444   if ($whos_online->RecordCount() >= WHOIS_REPEAT_LEGEND_BOTTOM) {
00445 ?>
00446               <tr>
00447                 <td class="smallText" colspan="8">Legend: <?php echo zen_image(DIR_WS_IMAGES . 'icon_status_green.gif') . " Active cart &nbsp;&nbsp;" . zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif') . " Inactive cart &nbsp;&nbsp;" . zen_image(DIR_WS_IMAGES . 'icon_status_red.gif') . " Active no cart &nbsp;&nbsp;" .  zen_image(DIR_WS_IMAGES . 'icon_status_red_light.gif') . " Inactive no cart " . "<br />Inactive is Last Click >= " . WHOIS_TIMER_INACTIVE . "s" . " &nbsp; || Inactive since arrival > " . WHOIS_TIMER_DEAD . "s will be removed";?></td>
00448               </tr>
00449 <?php
00450   }
00451 ?>
00452               <tr>
00453                 <td class="smallText" colspan="8"><?php echo sprintf(TEXT_NUMBER_OF_CUSTOMERS, $total_sess); print "<br />Duplicate IP Addresses: $total_dupes<br />Total Unique Users: $total_cust.";?></td>
00454               </tr>
00455             </table></td>
00456 <?php
00457   $heading = array();
00458   $contents = array();
00459   if ($info) {
00460     $heading[] = array('text' => '<b>' . TABLE_HEADING_SHOPPING_CART . '</b>');
00461     $tag = 0;
00462     $session_data = '';
00463     $result = $db->Execute("select value from " . TABLE_SESSIONS . "
00464                             WHERE sesskey = '" . $info . "'");
00465     $session_data = trim($result->fields['value']);
00466 
00467     $hardenedStatus = FALSE;
00468     $suhosinExtension = extension_loaded('suhosin');
00469     $suhosinSetting = strtoupper(@ini_get('suhosin.session.encrypt'));
00470 
00471 //    if (!$suhosinExtension) {
00472       if (strpos($session_data, 'cart|O') == 0) $session_data = base64_decode($session_data);
00473       if (strpos($session_data, 'cart|O') == 0) $session_data = '';
00474 //    }
00475 
00476     // uncomment the following line if you have suhosin enabled and see errors on the cart-contents sidebar
00477     //$hardenedStatus = ($suhosinExtension == TRUE || $suhosinSetting == 'On' || $suhosinSetting == 1) ? TRUE : FALSE;
00478     if ($session_data != '' && $hardenedStatus == TRUE) $session_data = '';
00479 
00480     if ($length = strlen($session_data)) {
00481       $start_id = (int)strpos($session_data, 'customer_id|s');
00482       $start_currency = (int)strpos($session_data, 'currency|s');
00483       $start_country = (int)strpos($session_data, 'customer_country_id|s');
00484       $start_zone = (int)strpos($session_data, 'customer_zone_id|s');
00485       $start_cart = (int)strpos($session_data, 'cart|O');
00486       $end_cart = (int)strpos($session_data, '|', $start_cart+6);
00487       $end_cart = (int)strrpos(substr($session_data, 0, $end_cart), ';}');
00488 
00489       $session_data_id = substr($session_data, $start_id, (strpos($session_data, ';', $start_id) - $start_id + 1));
00490       $session_data_cart = substr($session_data, $start_cart, ($end_cart - $start_cart+2));
00491       $session_data_currency = substr($session_data, $start_currency, (strpos($session_data, ';', $start_currency) - $start_currency + 1));
00492       $session_data_country = substr($session_data, $start_country, (strpos($session_data, ';', $start_country) - $start_country + 1));
00493       $session_data_zone = substr($session_data, $start_zone, (strpos($session_data, ';', $start_zone) - $start_zone + 1));
00494 
00495       session_decode($session_data_id);
00496       session_decode($session_data_currency);
00497       session_decode($session_data_country);
00498       session_decode($session_data_zone);
00499       session_decode($session_data_cart);
00500 
00501       if (is_object($_SESSION['cart'])) {
00502         $contents[] = array('text' => $full_name . ' - ' . $ip_address . '<br />' . $info);
00503         $products = $_SESSION['cart']->get_products();
00504         for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
00505           $contents[] = array('text' => $products[$i]['quantity'] . ' x ' . '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . zen_get_product_path($products[$i]['id']) . '&pID=' . $products[$i]['id']) . '">' . $products[$i]['name'] . '</a>');
00506         }
00507 
00508         if (sizeof($products) > 0) {
00509           $contents[] = array('text' => zen_draw_separator('pixel_black.gif', '100%', '1'));
00510           $contents[] = array('align' => 'right', 'text'  => TEXT_SHOPPING_CART_SUBTOTAL . ' ' . $currencies->format($_SESSION['cart']->show_total(), true, $_SESSION['currency']));
00511         } else {
00512           $contents[] = array('text' => TEXT_EMPTY_CART);
00513         }
00514       }
00515     }
00516   }
00517 
00518   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
00519     echo '            <td width="25%" valign="top">' . "\n";
00520 
00521     $box = new box;
00522     echo $box->infoBox($heading, $contents);
00523 
00524     echo '            </td>' . "\n";
00525   }
00526 ?>
00527           </tr>
00528         </table></td>
00529       </tr>
00530     </table></td>
00531 <!-- body_text_eof //-->
00532   </tr>
00533 </table>
00534 <!-- body_eof //-->
00535 
00536 <!-- footer //-->
00537 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
00538 <!-- footer_eof //-->
00539 <br />
00540 </body>
00541 </html>
00542 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
 All Data Structures Namespaces Files Functions Variables Enumerations