<?php
/*
###################################################################################
  Bigware Shop 2.3
  Release Datum: 23.08.2015
  
  Bigware Shop
  http://www.bigware.de

  Copyright (c) 2015 Bigware LTD
  (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
  (c) 2015	Bigware LTD

  Copyrightvermerke duerfen nicht entfernt werden.
  ------------------------------------------------------------------------
  Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
  der GNU General Public License, wie von der Free Software Foundation
  veroeffentlicht, weitergeben und/oder modifizieren, entweder gemaess Version 2 
  der Lizenz oder (nach Ihrer Option) jeder spaeteren Version.
  Die Veroeffentlichung dieses Programms erfolgt in der Hoffnung, dass es Ihnen
  von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die
  implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT FUER EINEN
  BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License.
  
  Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
  Programm erhalten haben. Falls nicht, schreiben Sie an die Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

  Infos:
  ------------------------------------------------------------------------
  Der Bigware Shop wurde vor vielen Jahren bereits aus dem bekannten Shopsystem osCommerce
  weiter- und neuentwickelt.
  Der Bigware Shop legt im hohen Masse Wert auf Bedienerfreundlichkeit, beinhaltet eine leichte
  Installation, viele neue professionelle Werkzeuge und zeichnet sich aus durch eine grosse 
  Community, die bei Problemen weiterhelfen kann.
  
  Der Bigware Shop ist auf jedem System lauffaehig, welches eine PHP Umgebung
  (ab PHP 4.1.3) und mySQL zur Verfuegung stellt und auf Linux basiert.
 
  Hilfe erhalten Sie im Forum auf www.bigware.de 
  
  -----------------------------------------------------------------------
  
 ##################################################################################




*/
?>
<?php
  $xx_mins_ago = ($current_time - WHOS_ONLINE_AGO);
  require('load_this/load_bigware_11.php');
  require(FOLDER_RELATIV_CLASSES . 'class_bigware_1.php');
  $currencies = new currencies(); 
  go_db_query("delete from " . DB_TBL_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; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="load_this/style.css">
<script language="javascript" src="load_this/menu.js"></script>
<script language="javascript" src="load_this/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_9.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td width="<?php echo FRAME_WIDTH; ?>" valign="top">
<!-- left_navigation //-->
<!-- left_navigation_eof //-->
</td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageGeneralsign"><?php echo ABOVE_TITLE; ?></td>
            <td class="pageGeneralsign" align="right"><?php echo go_fetch_dividing_up('tranparentes.gif', ABOVE_PICTURE_WIDTH, ABOVE_PICTURE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table cellpadding="5" border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top"><table border="0" cellpadding="5" cellspacing="1" style="border-collapse: collapse" width="100%" id="AutoNumber1">
              <tr class="tbUPCountData">
                <td class="tbUPDataInside"><?php echo DB_TBL_ABOVE_ONLINE; ?></td>
                <td class="tbUPDataInside" align="center"><?php echo DB_TBL_ABOVE_ATTENDEE_ID; ?></td>
                <td class="tbUPDataInside"><?php echo DB_TBL_ABOVE_FULL_NAME; ?></td>
                <td class="tbUPDataInside" align="center"><?php echo DB_TBL_ABOVE_IP_ADDRESS; ?></td>
                <td class="tbUPDataInside"><?php echo DB_TBL_ABOVE_TYPE_IN_TIME; ?></td>
                <td class="tbUPDataInside" align="center"><?php echo DB_TBL_ABOVE_LAST_CLICK; ?></td>
                <td class="tbUPDataInside"><?php echo DB_TBL_ABOVE_LAST_PAGE_URL; ?>&nbsp;</td>
              </tr>
<?php
  $whos_online_query = go_db_query("select attendee_id, full_name, ip_address, time_entry, time_last_click, last_page_url, session_id from " . DB_TBL_WHOS_ONLINE);
  while ($whos_online = go_db_fetch_array($whos_online_query)) {
    $time_online = (time() - $whos_online['time_entry']);
    if ((!isset($_GET['info']) || (isset($_GET['info']) && ($_GET['info'] == $whos_online['session_id']))) && !isset($info)) {
      $info = $whos_online['session_id'];
    }
    if ($whos_online['session_id'] == $info) {
      echo '              <tr id="defaultSelected" class="tbCountDataSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n";
    } else {
      echo '              <tr class="tbCountData" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . go_href_link(NAME_OF_FILE_WHOS_ONLINE, go_get_all_get_parameter(array('info', 'action')) . 'info=' . $whos_online['session_id'], 'NONSSL') . '\'">' . "\n";
    }
?>
                <td class="TbInsideData"><?php echo gmdate('H:i:s', $time_online); ?></td>
                <td class="TbInsideData" align="center"><?php echo $whos_online['attendee_id']; ?></td>
                <td class="TbInsideData"><?php echo $whos_online['full_name']; ?></td>
                <td class="TbInsideData" align="center"><?php echo $whos_online['ip_address']; ?></td>
                <td class="TbInsideData"><?php echo date('H:i:s', $whos_online['time_entry']); ?></td>
                <td class="TbInsideData" align="center"><?php echo date('H:i:s', $whos_online['time_last_click']); ?></td>
                <td class="TbInsideData"><?php if (preg_match('/^(.*)' . go_session_name() . '=[a-f,0-9]+[&]*(.*)/', $whos_online['last_page_url'], $array)) { echo $array[1] . $array[2]; } else { echo $whos_online['last_page_url']; } ?>&nbsp;</td>
              </tr>
<?php 
	if (strlen($whos_online['full_name'])>4) {
?>
	        <tr class="tbCountData">
	          <td colspan="7" class="TbInsideData"><b>User:</b> <?php echo $whos_online['full_name']; ?></td>
	        </tr>
<?php
	} 
  }
?>
              <tr>
                <td class="smallText" colspan="7"><?php echo sprintf(TEXT_NUMBER_OF_ATTENDEES, go_db_num_rows($whos_online_query)); ?></td>
              </tr>
            </table></td>
<?php
  $heading = array();
  $contents = array();
  if (isset($info)) {
    $heading[] = array('text' => '<b>' . DB_TBL_ABOVE_SHOP_BASKET . '</b>');
    if (SHOP_SESSIONS == 'mysql') {
      $session_data = go_db_query("select value from " . DB_TBL_SESSIONS . " WHERE sesskey = '" . $info . "'");
      $session_data = go_db_fetch_array($session_data);
      $session_data = trim($session_data['value']);
    } else {
      if ( (file_exists(go_session_save_path() . '/sess_' . $info)) && (filesize(go_session_save_path() . '/sess_' . $info) > 0) ) {
        $session_data = file(go_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, 'attendee_id[==]s');
        $start_cart = strpos($session_data, 'cart[==]o');
        $start_currency = strpos($session_data, 'currency[==]s');
        $start_land = strpos($session_data, 'attendee_land_id[==]s');
        $start_zone = strpos($session_data, 'attendee_zone_id[==]s');
      } else {
        $start_id = strpos($session_data, 'attendee_id|s');
        $start_cart = strpos($session_data, 'cart|O');
        $start_currency = strpos($session_data, 'currency|s');
        $start_land = strpos($session_data, 'attendee_land_id|s');
        $start_zone = strpos($session_data, 'attendee_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_land = substr($session_data, $start_land, (strpos($session_data, ';', $start_land) - $start_land + 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_land);
      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)) {
        $items = $cart->get_items();
        for ($i = 0, $n = sizeof($items); $i < $n; $i++) {
          $contents[] = array('text' => $items[$i]['quantity'] . ' x ' . $items[$i]['name']);
        }
        if (sizeof($items) > 0) {
          $contents[] = array('text' => go_fetch_dividing_up('pixel_black.gif', '100%', '1'));
          $contents[] = array('align' => 'right', 'text'  => TEXT_SHOP_BASKET_SUBTOTAL . ' ' . $currencies->format($cart->show_total(), true, $currency));
        } else {
          $contents[] = array('text' => '&nbsp;');
        }
      }
    }
  }
  if ( (go_not_null($heading)) && (go_not_null($contents)) ) {
    echo '            <td width="25%" valign="top"><br>' . "\n";
    $frame = new frame;
    echo $frame->infoBox($heading, $contents);
    echo '            </td>' . "\n";
  }
?>
          </tr>
        </table></td>
      </tr>
    </table></td>
<!-- body_text_eof //-->
  </tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_7.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_6.php'); ?>
