[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/admin/ -> whos_online.php (source)

   1  <?php
   2  //

   3  // +----------------------------------------------------------------------+

   4  // |zen-cart Open Source E-commerce                                       |

   5  // +----------------------------------------------------------------------+

   6  // | Copyright (c) 2003 The zen-cart developers                           |

   7  // |                                                                      |

   8  // | http://www.zen-cart.com/index.php                                    |

   9  // |                                                                      |

  10  // | Portions Copyright (c) 2003 osCommerce                               |

  11  // +----------------------------------------------------------------------+

  12  // | This source file is subject to version 2.0 of the GPL license,       |

  13  // | that is bundled with this package in the file LICENSE, and is        |

  14  // | available through the world-wide-web at the following url:           |

  15  // | http://www.zen-cart.com/license/2_0.txt.                             |

  16  // | If you did not receive a copy of the zen-cart license and are unable |

  17  // | to obtain it through the world-wide-web, please send a note to       |

  18  // | license@zen-cart.com so we can mail you a copy immediately.          |

  19  // +----------------------------------------------------------------------+

  20  //  $Id: whos_online.php 4003 2006-07-22 23:42:16Z drbyte $

  21  //

  22  
  23  // highlight bots

  24  function zen_check_bot($checking) {
  25    // googlebot.com and google.com

  26    if (empty($checking)) {
  27      return true;
  28    } else {
  29      return false;
  30    }
  31  }
  32  
  33  // host for current ip

  34  function zen_check_quantity($which) {
  35    global $db;
  36    $which_query = $db->Execute("select sesskey, value
  37                                     from " . TABLE_SESSIONS . "
  38                                     where sesskey= '" . $which . "'");
  39  
  40  
  41    $who_query = $db->Execute("select session_id, time_entry, time_last_click, host_address, user_agent
  42                                   from " . TABLE_WHOS_ONLINE . "
  43                                   where session_id='" . $which . "'");
  44  
  45    // longer than 2 minutes light color

  46    $xx_mins_ago_long = (time() - WHOIS_TIMER_INACTIVE);
  47  
  48    switch (true) {
  49      case ($which_query->RecordCount() == 0):
  50      if ($who_query->fields['time_last_click'] < $xx_mins_ago_long) {
  51        return zen_image(DIR_WS_IMAGES . 'icon_status_red_light.gif');
  52      } else {
  53        return zen_image(DIR_WS_IMAGES . 'icon_status_red.gif');
  54      }
  55      break;
  56      case (strstr($which_query->fields['value'],'"contents";a:0:')):
  57      if ($who_query->fields['time_last_click'] < $xx_mins_ago_long) {
  58        return zen_image(DIR_WS_IMAGES . 'icon_status_red_light.gif');
  59      } else {
  60        return zen_image(DIR_WS_IMAGES . 'icon_status_red.gif');
  61      }
  62      break;
  63      case (!strstr($which_query->fields['value'],'"contents";a:0:')):
  64      if ($who_query->fields['time_last_click'] < $xx_mins_ago_long) {
  65        return zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif');
  66      } else {
  67        return zen_image(DIR_WS_IMAGES . 'icon_status_green.gif');
  68      }
  69      break;
  70    }
  71  }
  72  
  73  // time since last click

  74  function zen_check_minutes($the_time_last_click) {
  75    $the_seconds = (time() - $the_time_last_click);
  76    $the_time_since= gmdate('H:i:s', $the_seconds);
  77    return $the_time_since;
  78  }
  79  
  80    require ('includes/application_top.php');
  81  
  82    require (DIR_WS_CLASSES . 'currencies.php');
  83    $currencies = new currencies();
  84  
  85    // same time_entry as time_last_click for 600 seconds = 10 minutes assumed to have left immediately

  86    $xx_mins_ago_dead = (time() - WHOIS_TIMER_DEAD);
  87  
  88    // remove after how many seconds? default= 1200 = 20 minutes

  89    $xx_mins_ago = (time() - WHOIS_TIMER_REMOVE);
  90  
  91  // remove entries that have expired

  92    $db->Execute("delete from " . TABLE_WHOS_ONLINE . "
  93                  where time_last_click < '" . $xx_mins_ago . "'
  94                  or (time_entry=time_last_click
  95                  and time_last_click < '" . $xx_mins_ago_dead . "')");
  96  ?>
  97  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  98  <html <?php echo HTML_PARAMS; ?>>
  99  <head>
 100  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
 101  <title><?php echo TITLE; ?></title>
 102  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
 103  <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
 104  <script language="javascript" src="includes/menu.js"></script>
 105  <script language="javascript" src="includes/general.js"></script>
 106  <script type="text/javascript">
 107    <!--
 108    function init()
 109    {
 110      cssjsmenu('navbar');
 111      if (document.getElementById)
 112      {
 113        var kill = document.getElementById('hoverJS');
 114        kill.disabled = true;
 115      }
 116    }
 117    // -->

 118  </script>
 119  </head>
 120  <body onLoad="init()">
 121  <!-- header //-->
 122  <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
 123  <!-- header_eof //-->
 124  
 125  <!-- body //-->
 126  <table border="0" width="100%" cellspacing="2" cellpadding="2">
 127    <tr>
 128  <!-- body_text //-->
 129      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 130        <tr>
 131          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 132            <tr>
 133              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
 134              <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
 135            </tr>
 136            <tr>
 137              <td class="smallText" colspan="2">
 138              <?php echo
 139                '<a href="' . zen_href_link(FILENAME_WHOS_ONLINE . '.php', zen_get_all_get_params()) . '" class="menuBoxContentLink">' .
 140    '<b><u>' . WHOS_ONLINE_REFRESH_LIST_TEXT . '</u></b>' . '</a>' .
 141    '&nbsp;&nbsp;' . WHOS_ONLINE_LEGEND_TEXT . '&nbsp;' .
 142    zen_image(DIR_WS_IMAGES . 'icon_status_green.gif') . '&nbsp;' . WHOS_ONLINE_ACTIVE_TEXT . '&nbsp;&nbsp;' .
 143    zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif') . '&nbsp;' . WHOS_ONLINE_INACTIVE_TEXT . '&nbsp;&nbsp;' .
 144    zen_image(DIR_WS_IMAGES . 'icon_status_red.gif') . '&nbsp;' . WHOS_ONLINE_ACTIVE_NO_CART_TEXT . '&nbsp;&nbsp;' .
 145    zen_image(DIR_WS_IMAGES . 'icon_status_red_light.gif') . '&nbsp;' . WHOS_ONLINE_INACTIVE_NO_CART_TEXT . '<br>' .
 146    WHOS_ONLINE_INACTIVE_LAST_CLICK_TEXT . '&nbsp;' . WHOIS_TIMER_INACTIVE . 's' .
 147    '&nbsp;||&nbsp;' . WHOS_ONLINE_INACTIVE_ARRIVAL_TEXT . '&nbsp;' .
 148    WHOIS_TIMER_DEAD . 's&nbsp;' . WHOS_ONLINE_REMOVED_TEXT;
 149              ?>
 150              </td>
 151            </tr>
 152            <tr>
 153              <td class="smallText" colspan="2">
 154  <?php
 155            $listing= $_GET['listing'];
 156            switch ($listing) {
 157                case "full_name-desc":
 158                $order = "full_name DESC, LPAD(ip_address,11,'0')";
 159                break;
 160                case "full_name":
 161                $order = "full_name, LPAD(ip_address,11,'0')";
 162                break;
 163                case "ip_address":
 164                $order = "ip_address, session_id";
 165                break;
 166                case "ip_address-desc":
 167                $order = "ip_address DESC, session_id";
 168                break;
 169                case "time_last_click-desc":
 170                $order = "time_last_click DESC, LPAD(ip_address,11,'0')";
 171                break;
 172                case "time_last_click":
 173                $order = "time_last_click, LPAD(ip_address,11,'0')";
 174                break;
 175                case "time_entry-desc":
 176                $order = "time_entry DESC, LPAD(ip_address,11,'0')";
 177                break;
 178                case "time_entry":
 179                $order = "time_entry, LPAD(ip_address,11,'0')";
 180                break;
 181                case "last_page_url-desc":
 182                $order = "last_page_url DESC, LPAD(ip_address,11,'0')";
 183                break;
 184                case "last_page_url":
 185                $order = "last_page_url, LPAD(ip_address,11,'0')";
 186                break;
 187                case "session_id":
 188                $order = "session_id, ip_address";
 189                break;
 190                case "session_id-desc":
 191                $order = "session_id DESC, ip_address";
 192                break;
 193                default:
 194                $order = "time_entry, LPAD(ip_address,11,'0')";
 195            }
 196  
 197    $whos_online = $db->Execute("select customer_id, full_name, ip_address, time_entry, time_last_click,
 198                                        last_page_url, session_id, host_address, user_agent
 199                                 from " . TABLE_WHOS_ONLINE . "
 200                                 order by $order");
 201  
 202    $total_sess = $whos_online->RecordCount();
 203    echo sprintf(TEXT_NUMBER_OF_CUSTOMERS, $total_sess);
 204  ?>
 205              </td>
 206            </tr>
 207            <tr>
 208              <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 209            </tr>
 210          </table></td>
 211        </tr>
 212        <tr>
 213          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 214            <tr>
 215              <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 216                <tr class="dataTableHeadingRowWhois">
 217                  <td class="dataTableHeadingContentWhois"><?php echo TABLE_HEADING_ONLINE; ?></td>
 218                  <td class="dataTableHeadingContentWhois" align="center"><?php echo TABLE_HEADING_CUSTOMER_ID; ?></td>
 219  
 220                  <td class="dataTableHeadingContentWhois" align="center">
 221                    <?php echo (($listing=='full_name-desc' or $listing=='full_name') ? '<span class="dataTableHeadingContentWhois">' . TABLE_HEADING_FULL_NAME . '</span>' : TABLE_HEADING_FULL_NAME); ?>&nbsp;
 222                    <br><a href="<?php echo "$PHP_SELF?listing=full_name"; ?>"><?php echo ($listing=='full_name' ? '<span class="dataTableHeadingContentWhois">' . 'Asc' . '</span>' : '<b>' . 'Asc' . '</b>'); ?></a>&nbsp;
 223                    &nbsp;<a href="<?php echo "$PHP_SELF?listing=full_name-desc"; ?>"><?php echo ($listing=='full_name-desc' ? '<span class="dataTableHeadingContentWhois">' . 'Desc' . '</span>' : '<b>' . 'Desc' . '</b>'); ?></a>&nbsp;
 224                  </td>
 225                  <td class="dataTableHeadingContentWhois" align="center">
 226                    <?php echo (($listing=='ip_address-desc' or $listing=='ip_address') ? '<span class="dataTableHeadingContentWhois">' . TABLE_HEADING_IP_ADDRESS . '</span>' : TABLE_HEADING_IP_ADDRESS); ?>&nbsp;
 227                    <br><a href="<?php echo "$PHP_SELF?listing=ip_address"; ?>"><?php echo ($listing=='ip_address' ? '<span class="dataTableHeadingContentWhois">' . 'Asc' . '</span>' : '<b>' . 'Asc' . '</b>'); ?></a>&nbsp;
 228                    &nbsp;<a href="<?php echo "$PHP_SELF?listing=ip_address-desc"; ?>"><?php echo ($listing=='ip_address-desc' ? '<span class="dataTableHeadingContentWhois">' . 'Desc' . '</span>' : '<b>' . 'Desc' . '</b>'); ?></a>&nbsp;
 229                  </td>
 230                  <td class="dataTableHeadingContentWhois" align="center">
 231                    <?php echo (($listing=='session_id-desc' or $listing=='session_id') ? '<span class="dataTableHeadingContentWhois">' . TABLE_HEADING_SESSION_ID . '</span>' : TABLE_HEADING_SESSION_ID); ?>&nbsp;
 232                    <br><a href="<?php echo "$PHP_SELF?listing=session_id"; ?>"><?php echo ($listing=='session_id' ? '<span class="dataTableHeadingContentWhois">' . 'Asc' . '</span>' : '<b>' . 'Asc' . '</b>'); ?></a>&nbsp;
 233                    &nbsp;<a href="<?php echo "$PHP_SELF?listing=session_id-desc"; ?>"><?php echo ($listing=='session_id-desc' ? '<span class="dataTableHeadingContentWhois">' . 'Desc' . '</span>' : '<b>' . 'Desc' . '</b>'); ?></a>&nbsp;
 234                  </td>
 235                  <td class="dataTableHeadingContentWhois" align="center">
 236                    <?php echo (($listing=='time_entry-desc' or $listing=='time_entry') ? '<span class="dataTableHeadingContentWhois">' . TABLE_HEADING_ENTRY_TIME . '</span>' : TABLE_HEADING_ENTRY_TIME); ?>&nbsp;
 237                    <br><a href="<?php echo "$PHP_SELF?listing=time_entry"; ?>"><?php echo ($listing=='time_entry' ? '<span class="dataTableHeadingContentWhois">' . 'Asc' . '</span>' : '<b>' . 'Asc' . '</b>'); ?></a>&nbsp;
 238                    &nbsp;<a href="<?php echo "$PHP_SELF?listing=time_entry-desc"; ?>"><?php echo ($listing=='time_entry-desc' ? '<span class="dataTableHeadingContentWhois">' . 'Desc' . '</span>' : '<b>' . 'Desc' . '</b>'); ?></a>&nbsp;
 239                  </td>
 240                  <td class="dataTableHeadingContentWhois" align="center">
 241                    <?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;
 242                    <br><a href="<?php echo "$PHP_SELF?listing=time_last_click"; ?>"><?php echo ($listing=='time_last_click' ? '<span class="dataTableHeadingContentWhois">' . 'Asc' . '</span>' : '<b>' . 'Asc' . '</b>'); ?></a>&nbsp;
 243                    &nbsp;<a href="<?php echo "$PHP_SELF?listing=time_last_click-desc"; ?>"><?php echo ($listing=='time_last_click-desc' ? '<span class="dataTableHeadingContentWhois">' . 'Desc' . '</span>' : '<b>' . 'Desc' . '</b>'); ?></a>&nbsp;
 244                  </td>
 245                  <td class="dataTableHeadingContentWhois" align="center">
 246                    <?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;
 247                    <br><a href="<?php echo "$PHP_SELF?listing=last_page_url"; ?>"><?php echo ($listing=='last_page_url' ? '<span class="dataTableHeadingContentWhois">' . 'Asc' . '</span>' : '<b>' . 'Asc' . '</b>'); ?></a>&nbsp;
 248                    &nbsp;<a href="<?php echo "$PHP_SELF?listing=last_page_url-desc"; ?>"><?php echo ($listing=='last_page_url-desc' ? '<span class="dataTableHeadingContentWhois">' . 'Desc' . '</span>' : '<b>' . 'Desc' . '</b>'); ?></a>&nbsp;
 249                  </td>
 250                </tr>
 251  <?php
 252    $ip_array = array();
 253    $d=0;
 254    while (!$whos_online->EOF) {
 255      $time_online = (time() - $whos_online->fields['time_entry']);
 256      if ( ((!$_GET['info']) || (@$_GET['info'] == $whos_online->fields['session_id'])) && (!$info) ) {
 257        $info = $whos_online->fields['session_id'];
 258        $ip_address = $whos_online->fields['ip_address'];
 259        $full_name = $whos_online->fields['full_name'];
 260      }
 261  
 262  // Check for duplicates

 263      if (in_array($whos_online->fields['ip_address'], $ip_array)) {
 264        $d++;
 265      } else {
 266        $ip_array[] = $whos_online->fields['ip_address'];
 267      }
 268  
 269  // Check for bots

 270      $is_a_bot=zen_check_bot($whos_online->fields['session_id']);
 271    if ($whos_online->fields['session_id'] == $info) {
 272        if ($is_a_bot==true) {
 273          echo '              <tr class="dataTableRowSelectedBot">' . "\n";
 274        } else {
 275          echo '              <tr class="dataTableRowSelectedWhois">' . "\n";
 276        }
 277    } else {
 278      if ($is_a_bot==true) {
 279          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";
 280        } else {
 281          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";
 282        }
 283    }
 284  ?>
 285                  <td class="dataTableContentWhois"><?php echo zen_check_quantity($whos_online->fields['session_id']) . '&nbsp;' . gmdate('H:i:s', $time_online); ?></td>
 286                  <td class="dataTableContentWhois" align="center">
 287                    <?php
 288                      if ($whos_online->fields['customer_id'] != 0) {
 289                        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>';
 290                      } else {
 291                        echo $whos_online->fields['customer_id'];
 292                      }
 293                    ?>
 294                  </td>
 295                  <td class="dataTableContentWhois" nowrap="nowrap">
 296                    <?php
 297                      if ($whos_online->fields['customer_id'] != 0) {
 298                        echo '<a href="' . zen_href_link(FILENAME_ORDERS, 'cID=' . $whos_online->fields['customer_id'], 'NONSSL') . '">' . '<u>' . $whos_online->fields['full_name'] . '</u></a>';
 299                      } else {
 300                        echo $whos_online->fields['full_name'];
 301                      }
 302                    ?>
 303                  </td>
 304                  <td class="dataTableContentWhois" align="left"><a href="http://www.dnsstuff.com/tools/whois.ch?ip=<?php echo $whos_online->fields['ip_address']; ?>" target="new"><?php echo '<u>' . $whos_online->fields['ip_address'] . '</u>'; ?></a></td>
 305                  <td class="dataTableContentWhois"><?php echo date('H:i:s', $whos_online->fields['time_entry']); ?></td>
 306                  <td class="dataTableContentWhois" align="center"><?php echo date('H:i:s', $whos_online->fields['time_last_click']); ?></td>
 307                  <td class="dataTableContentWhois" colspan="2">&nbsp;</td>
 308                </tr>
 309  <?php
 310    // show host name

 311    if (WHOIS_SHOW_HOST=='1') {
 312      if ($whos_online->fields['session_id'] == $info) {
 313      if ($is_a_bot==true) {
 314          echo '              <tr class="dataTableRowSelectedBot">' . "\n";
 315        } else {
 316          echo '              <tr class="dataTableRowSelectedWhois">' . "\n";
 317        }
 318      } else {
 319        if ($is_a_bot==true) {
 320          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";
 321        } else {
 322          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";
 323        }
 324    }
 325  ?>
 326                  <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>
 327                  <td class="dataTableContentWhois" colspan=5 valign="top">
 328                    <?php
 329                      echo TEXT_SESSION_ID . $whos_online->fields['session_id'] . '<br />' .
 330                      TEXT_HOST . $whos_online->fields['host_address'] . '<br />' .
 331                      TEXT_USER_AGENT . $whos_online->fields['user_agent'] . '<br />';
 332                      if (eregi('^(.*)' . zen_session_name() . '=[a-f,0-9]+[&]*(.*)', $whos_online->fields['last_page_url'], $array)) {
 333                        echo $array[1] . $array[2];
 334                      } else {
 335                        echo "<a href='" . $whos_online->fields['last_page_url'] . "' target=new>" . '<u>' . $whos_online->fields['last_page_url'] . '</u>' . "</a>";
 336                      }
 337                    ?>
 338                  </td>
 339  
 340                </tr>
 341  <?php
 342    } // show host

 343  ?>
 344                <tr>
 345                 <td colspan="8"><?php echo zen_draw_separator('pixel_trans.gif', '1', '3'); ?></td>
 346                </tr>
 347  
 348  <?php
 349    $whos_online->MoveNext();
 350    }
 351    if (!$d) {
 352      $d=0;
 353    }
 354    $total_dupes = $d;
 355    $total_sess = $whos_online->RecordCount();
 356    $ip_unique = sizeof($ip_array);
 357    $total_cust = $total_sess - $total_dupes;
 358  ?>
 359                <tr>
 360                  <td colspan="8"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 361                </tr>
 362  <?php
 363  // repeat legend when whois >=

 364    if ($whos_online->RecordCount() >= WHOIS_REPEAT_LEGEND_BOTTOM) {
 365  ?>
 366                <tr>
 367                  <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>
 368                </tr>
 369  <?php
 370    }
 371  ?>
 372                <tr>
 373                  <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>
 374                </tr>
 375              </table></td>
 376  <?php
 377    $heading = array();
 378    $contents = array();
 379    if ($info) {
 380      $heading[] = array('text' => '<b>' . TABLE_HEADING_SHOPPING_CART . '</b>');
 381  
 382      if (STORE_SESSIONS == 'db') {
 383        $session_data = $db->Execute("select value from " . TABLE_SESSIONS . "
 384                                      WHERE sesskey = '" . $info . "'");
 385  
 386        $session_data = trim($session_data->fields['value']);
 387      } else {
 388        if ( (file_exists(zen_session_save_path() . '/sess_' . $info)) && (filesize(zen_session_save_path() . '/sess_' . $info) > 0) ) {
 389          $session_data = file(zen_session_save_path() . '/sess_' . $info);
 390          $session_data = trim(implode('', $session_data));
 391        }
 392      }
 393  
 394      if ($length = strlen($session_data)) {
 395        if (PHP_VERSION < 4) {
 396          $start_id = strpos($session_data, 'customer_id[==]s');
 397          $start_cart = strpos($session_data, 'cart[==]o');
 398          $start_currency = strpos($session_data, 'currency[==]s');
 399          $start_country = strpos($session_data, 'customer_country_id[==]s');
 400          $start_zone = strpos($session_data, 'customer_zone_id[==]s');
 401        } else {
 402          $start_id = strpos($session_data, 'customer_id|s');
 403          $start_cart = strpos($session_data, 'cart|O');
 404          $start_currency = strpos($session_data, 'currency|s');
 405          $start_country = strpos($session_data, 'customer_country_id|s');
 406          $start_zone = strpos($session_data, 'customer_zone_id|s');
 407        }
 408  
 409        for ($i=$start_cart; $i<$length; $i++) {
 410          if ($session_data[$i] == '{') {
 411            if (isset($tag)) {
 412              $tag++;
 413            } else {
 414              $tag = 1;
 415            }
 416          } elseif ($session_data[$i] == '}') {
 417            $tag--;
 418          } elseif ( (isset($tag)) && ($tag < 1) ) {
 419            break;
 420          }
 421        }
 422  
 423        $session_data_id = substr($session_data, $start_id, (strpos($session_data, ';', $start_id) - $start_id + 1));
 424  // fix nnobo bug

 425        $session_data_cart = substr($session_data, $start_cart, $i - $start_cart);
 426        $session_data_currency = substr($session_data, $start_currency, (strpos($session_data, ';', $start_currency) - $start_currency + 1));
 427        $session_data_country = substr($session_data, $start_country, (strpos($session_data, ';', $start_country) - $start_country + 1));
 428        $session_data_zone = substr($session_data, $start_zone, (strpos($session_data, ';', $start_zone) - $start_zone + 1));
 429  
 430        session_decode($session_data_id);
 431        session_decode($session_data_currency);
 432        session_decode($session_data_country);
 433        session_decode($session_data_zone);
 434        session_decode($session_data_cart);
 435  
 436        if (PHP_VERSION < 4) {
 437          $broken_cart = $cart;
 438          $cart = new shoppingCart;
 439          $cart->unserialize($broken_cart);
 440        }
 441  
 442        if (is_object($_SESSION['cart'])) {
 443          $contents[] = array('text' => $full_name . ' - ' . $ip_address . '<br />' . $info);
 444          $products = $_SESSION['cart']->get_products();
 445          for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
 446            $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>');
 447  // cPath=23&pID=74

 448          }
 449  
 450          if (sizeof($products) > 0) {
 451            $contents[] = array('text' => zen_draw_separator('pixel_black.gif', '100%', '1'));
 452            $contents[] = array('align' => 'right', 'text'  => TEXT_SHOPPING_CART_SUBTOTAL . ' ' . $currencies->format($_SESSION['cart']->show_total(), true, $_SESSION['currency']));
 453          } else {
 454            $contents[] = array('text' => TEXT_EMPTY_CART);
 455          }
 456        }
 457      }
 458    }
 459  
 460    if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
 461      echo '            <td width="25%" valign="top">' . "\n";
 462  
 463      $box = new box;
 464      echo $box->infoBox($heading, $contents);
 465  
 466      echo '            </td>' . "\n";
 467    }
 468  ?>
 469            </tr>
 470          </table></td>
 471        </tr>
 472      </table></td>
 473  <!-- body_text_eof //-->
 474    </tr>
 475  </table>
 476  <!-- body_eof //-->
 477  
 478  <!-- footer //-->
 479  <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
 480  <!-- footer_eof //-->
 481  <br>
 482  </body>
 483  </html>
 484  <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics