storm1980
09.01.2008, 21:41
Fehler:
Variable passed to each() is not an array or object in /admin/whos_online.php on line 31
Dieser Fehler kommt immer mal wieder.
Zeile 31
while (list($products_id, ) = each($session['cart']->contents)) {
<?php
/
**$Id: whos_online.php,v 1.32 2003/06/29 22:50:52 hpdl Exp $
**osCommerce, Open Source E-Commerce Solutions
**http://www.oscommerce.com
**Copyright (c) 2003 osCommerce
**Released under the GNU General Public License
/
require_once('../includes/classes/xt-Commerce / xt:CommercePrice.php');
if (!function_exists("unserialize_session_data")) {
function unserialize_session_data( $session_data ) {
** $variables = array();
** $a = preg_split( "/(\w+)\|/", $session_data, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
** for( $i = 0; $i < count( $a ); $i = $i+2 ) {
****** $variables[$a[$i]] = unserialize( $a[$i+1] );
** }
** return( $variables );
}
}
if (!function_exists("xt-Commerce / xt:Commerce_get_products")) {
function xt-Commerce / xt:Commerce_get_products($session) {
******if (!is_array($session)) return false;
******$products_array = array();
******reset($session);
******while (list($products_id, ) = each($session['cart']->contents)) {
********$products_query = xt-Commerce / xt:Commerce_db_query("select p.products_id, pd.products_name,p.products_image, p.products_model, p.products_price, p.products_discount_allowed, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id='" . xt-Commerce / xt:Commerce_get_prid($products_id) . "' and pd.products_id = p.products_id and pd.language_id = '" . $_SESSION['languages_id'] . "'");
********if ($products = xt-Commerce / xt:Commerce_db_fetch_array($products_query)) {
**********$prid = $products['products_id'];
**********// dirty workaround
**********$xtPrice = new xt-Commerce / xt:CommercePrice($session['currency'],$session['customers_status']['customers_status_id']);
**********$products_price=$xtPrice->xt-Commerce / xt:CommerceGetPrice($products['products_id'],
****************************************$format=fa lse,
****************************************$session['cart']->contents[$products_id]['qty'],
****************************************$products['products_tax_class_id'],
****************************************$products['products_price']);
**********$products_array[] = array('id' => $products_id,
************************************'name' => $products['products_name'],
************************************'model' => $products['products_model'],
************************************'image' => $products['products_image'],
************************************'price' => $products_price+attributes_price($products_id,$ses sion),
************************************'quantity' => $session['cart']->contents[$products_id]['qty'],
************************************'weight' => $products['products_weight'],
************************************'final_price' => ($products_price+attributes_price($products_id,$se ssion)),
************************************'tax_class_id' => $products['products_tax_class_id'],
************************************'attributes' => $session['contents'][$products_id]['attributes']);
********}
******}
******return $products_array;
****}
}
if (!function_exists("attributes_price")) {
function attributes_price($products_id,$session) {
******$xtPrice = new xt-Commerce / xt:CommercePrice($session['currency'],$session['customers_status']['customers_status_id']);
******if (isset($session['contents'][$products_id]['attributes'])) {
********reset($session['contents'][$products_id]['attributes']);
********while (list($option, $value) = each($session['contents'][$products_id]['attributes'])) {
**********$attribute_price_query = xt-Commerce / xt:Commerce_db_query("select pd.products_tax_class_id, p.options_values_price, p.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " p, " . TABLE_PRODUCTS . " pd where p.products_id = '" . $products_id . "' and p.options_id = '" . $option . "' and pd.products_id = p.products_id and p.options_values_id = '" . $value . "'");
**********$attribute_price = xt-Commerce / xt:Commerce_db_fetch_array($attribute_price_query) ;
**********if ($attribute_price['price_prefix'] == '+') {
************$attributes_price += $xtPrice->xt-Commerce / xt:CommerceFormat($attribute_price['options_values_price'],false,$attribute_price['products_tax_class_id']);
**********} else {
************$attributes_price -= $xtPrice->xt-Commerce / xt:CommerceFormat($attribute_price['options_values_price'],false,$attribute_price['products_tax_class_id']);
**********}
********}
******}
******return $attributes_price;
****}
}
// WOL 1.5 - Checks cart and displays status
function xt-Commerce / xt:Commerce_check_cart($which) {
****if (STORE_SESSIONS == 'mysql') {
******$session_data = xt-Commerce / xt:Commerce_db_query("select sesskey, value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $which . "'");
******$session_data = xt-Commerce / xt:Commerce_db_fetch_array($session_data);
******// $session_data = trim($session_data['value']);
****} else {
******if ( (file_exists(xt-Commerce / xt:Commerce_session_save_path() . '/sess_' . $which)) && (filesize(xt-Commerce / xt:Commerce_session_save_path() . '/sess_' . $which) > 0) ) {
********$session_data = file(xt-Commerce / xt:Commerce_session_save_path() . '/sess_' . $which);
********$session_data = trim(implode('', $session_data));
******}
****}
****$which_query = $session_data;
// removed , host_address
**$who_data =** xt-Commerce / xt:Commerce_db_query(("select session_id, time_entry, time_last_click
******************************** from " . TABLE_WHOS_ONLINE . "
******************************** where session_id='" . $which . "'"));
**$who_query = xt-Commerce / xt:Commerce_db_fetch_array($who_data);
**// longer than 3 minutes = inactive
**$xx_mins_ago_long = (time() - 180);
**switch (true) {
**// no cart
**case (strstr($which_query['value'],'"contents";a:0:')):
****if ($who_query['time_last_click'] < $xx_mins_ago_long) {
********** // inactive
******return xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_STATUS_INACTIVE_NOCART);
****} else {
********** // active
******return xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_blue.gif', TEXT_STATUS_ACTIVE_NOCART);
****}
**// cart
**case (!strstr($which_query['value'],'"contents";a:0:')):
****if ($who_query['time_last_click'] < $xx_mins_ago_long) {
********** // inactive
******return xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_yellow.gif', TEXT_STATUS_INACTIVE_CART);
****} else {
********** // active
******return xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_green.gif', TEXT_STATUS_ACTIVE_CART);
****}
**}
}
// WOL 1.5 EOF
**$xx_mins_ago = (time() - 900);
**require('includes/application_top.php');
**require(DIR_WS_CLASSES . 'currencies.php');
**$currencies = new currencies();
// remove entries that have expired
**xt-Commerce / xt:Commerce_db_query("delete from " . TABLE_WHOS_ONLINE . " where time_last_click < '" . $xx_mins_ago . "'");
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Tranistional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<?php if( $_SERVER["QUERY_STRING"] == 300 ){**?>
<meta http-equiv="refresh" content="300;URL=whos_online.php?300">
<?php }elseif ($_SERVER["QUERY_STRING"] == 180){ ?>
<meta http-equiv="refresh" content="180;URL=whos_online.php?180">
<?php }elseif ($_SERVER["QUERY_STRING"] == 120){ ?>
<meta http-equiv="refresh" content="120;URL=whos_online.php?120">
<?php }elseif ($_SERVER["QUERY_STRING"] == 60){ ?>
<meta http-equiv="refresh" content="60;URL=whos_online.php?60">
<?php }elseif ($_SERVER["QUERY_STRING"] == 30){ ?>
<meta http-equiv="refresh" content="30;URL=whos_online.php?30">
<?php } else { ?>
<?php } ?>
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
**<tr>
****<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
****</table></td>
****<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
******<tr>
********<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
**********<tr>
************<td valign="bottom" class="pageHeading">
************<?php echo HEADING_TITLE; ?>
************
Set Refresh Rate:
************<input type='button' value='None' onClick="location.href='whos_online.php'">
************<input type='button' value='3 min' onClick="location.href='whos_online.php?180'">
************<input type='button' value='2 min' onClick="location.href='whos_online.php?120'">
************<input type='button' value='60 sec' onClick="location.href='whos_online.php?60'">
************<input type='button' value='30 sec' onClick="location.href='whos_online.php?30'">
************</td>
************<td align="left">
************<?php echo
************ xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_green.gif' , TEXT_STATUS_ACTIVE_CART) . '' . TEXT_STATUS_ACTIVE_CART . '
' .
************ xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_yellow.gif', TEXT_STATUS_INACTIVE_CART) . '' . TEXT_STATUS_INACTIVE_CART . '
' .
************ xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_white.gif', TEXT_STATUS_NO_SESSION_BOT) . '' . TEXT_STATUS_NO_SESSION_BOT; ?>
************ </td>
************ <td align="left">
************ <?php echo
************ xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_blue.gif' , TEXT_STATUS_ACTIVE_NOCART) . '' . TEXT_STATUS_ACTIVE_NOCART . '
' .
************ xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_red.gif' , TEXT_STATUS_INACTIVE_NOCART) . '' . TEXT_STATUS_INACTIVE_NOCART . '
'; ?>
************</td>
**********</tr>
**********<tr>
************<td><?php echo xt-Commerce / xt:Commerce_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
**********</tr>
********</table></td>
******</tr>
******<tr>
********<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
**********<tr>
************<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
**************<tr class="dataTableHeadingRow">
****************<td></td>
****************<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ONLINE; ?></td>
****************
****************<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_FULL_NAME; ?></td>
****************<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_IP_ADDRESS; ?></td>
****************
****************
****************
****************<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ENTRY_TIME; ?></td>
****************<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_LAST_CLICK; ?></td>
****************<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_LAST_PAGE_URL; ?></td>
****************<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_HTTP_REFERER; ?></td>
**************</tr>
<?php
**// BEGIN GEO MOD
**//require(DIR_WS_INCLUDES . 'geoip.inc');
**//$gi = geoip_open(DIR_WS_INCLUDES . 'GeoIP.dat',GEOIP_STANDARD);
**// END GEO MOD
// EEM Changed order by from IP Address to Last Click and initialized total_bots and total me counts
// $whos_online_query = xt-Commerce / xt:Commerce_db_query("select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, http_referer, session_id from " . TABLE_WHOS_ONLINE . ' order by ip_address');
**$whos_online_query = xt-Commerce / xt:Commerce_db_query("select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, http_referer, session_id from " . TABLE_WHOS_ONLINE . ' order by time_last_click DESC');
**$total_bots=0;
**$total_me=0;
// EEM eof
**while ($whos_online = xt-Commerce / xt:Commerce_db_fetch_array($whos_online_query)) {
****$time_online = ($whos_online['time_last_click'] - $whos_online['time_entry']);
****if ((!isset($_GET['info']) || (isset($_GET['info']) && ($_GET['info'] == $whos_online['session_id']))) && !isset($info)) {
******$info = $whos_online['session_id'];
****}
/ BEGIN COUNT MOD /
****if ($old_array['ip_address'] == $whos_online['ip_address']) {
****$i++;
****}
/ END COUNT MOD /
****if ($whos_online['session_id'] == $info) {
****** if($whos_online['http_referer'] != "")
****** {
********$http_referer_url = $whos_online['http_referer'];
****** }
**** echo '<tr id="defaultSelected" class="dataTableRowSelected">' . "\n";
************} else {
**** echo '<tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cur sor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . xt-Commerce / xt:Commerce_href_link(FILENAME_WHOS_ONLINE, xt-Commerce / xt:Commerce_get_all_get_params(array('info', 'action')) . 'info=' . $whos_online['session_id'], 'NONSSL') . '\'">' . "\n";
****}
// WOL 1.5 - Display Status
****// spider detection??
****if (($whos_online['session_id'] == '') | (!(isset($whos_online['session_id'])))) {
************$noSessionDetected = '?';
****} else {
************$noSessionDetected = '';
****}
?>
**************<td class="dataTableContent" align="left">
****************<?php
****************if ( $noSessionDetected == '' ) {echo '' . xt-Commerce / xt:Commerce_check_cart($whos_online['session_id']);}
****************else {echo '' . xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_white.gif', TEXT_STATUS_NO_SESSION_BOT); }?>
**************</td>
****************<td class="dataTableContent"><?php echo gmdate('H:i:s', $time_online); ?></td>
****************
****************
****************<?php if ( $whos_online['customer_id'] == 0 ) { ?>
****************<td class="dataTableContent"><?php echo $whos_online['full_name']; ?></td>
****************<?php } else { ?>
****************<td class="dataTableContent"><?php echo $whos_online['full_name']; ?> (customers.php?selected_box=customers&cID=<?php echo $whos_online['customer_id']; ?>&action=edit)</td>
****************<?php
****************}
// EEM - Changed so that if IP Address is mine, it displays Me!.
//****** If it's a known Bot, it displays the Bot's name
//****** Otherwise, it displays the IP Address as a link to ShowMyIP.com
//****** Tracks number of Bot and Me sessions
// My own IP
************** if ($whos_online['ip_address'] == $_SERVER["REMOTE_ADDR"]){
**************** echo '<td class="dataTableContent" align="center">Me!</td>';
**************** $total_me++;
************** }else{
**************** //-> open iptable.csv
**************** //-> Konstanten
**************** $ip_data = DIR_FS_CATALOG . DIR_WS_INCLUDES . 'data/iptable.csv';
**************** $delimiter = ',';
**************** $found = false;
**************** $ip_array = array();
**************** if (file_exists($ip_data)) {
******************** $file_list = file($ip_data);
******************** for ($i=0; $i < count($file_list);$i++){
********************** $ip_array = explode($delimiter,$file_list[$i]);
********************** if (sizeof($ip_array) > 1 && substr($ip_array[0], 0, 1) != '#' && substr($ip_array[0], 0, 1) != '//'){
************************ $ip_adress = $ip_array[0];
************************ if (strncmp($whos_online['ip_address'], $ip_adress, 9) == 0 ){
************************** echo '<td class="dataTableContent" align="center">' . $ip_array[1] . '</td>';
************************** $found = true;
************************** $total_bots++;
************************** break;
************************ }//-> if (strncmp
********************** }//-> if (sizeof($ip_array)
****************** }//-> for ($i=0;
**************** }//-> if (file_exists($ip_data))
**************** if ($found == false){
****************** echo '<td class="dataTableContent" align="center">' . $whos_online['ip_address'] . ' (http://www.showmyip.com/?ip='.**$whos_online['ip_address']. ' )</td>';
**************** }//-> if ($found == false)
************** }//-> else
************** ?>
****************
<!--
****************<td class="dataTableContent" align="center">
****************<?php //echo xt-Commerce / xt:Commerce_image('images/flags/' . strtolower(geoip_country_code_by_addr($gi, $whos_online['ip_address'])) . '.gif', geoip_country_name_by_addr($gi, $whos_online['ip_address'])).''. geoip_country_code3_by_addr($gi, $whos_online['ip_address']); ?>
****************</TD>
-->
****************<td class="dataTableContent"><?php echo date('H:i:s', $whos_online['time_entry']); ?></td>
****************<td class="dataTableContent" align="center"><?php echo date('H:i:s', $whos_online['time_last_click']); ?></td>
****************<td class="dataTableContent"><?php if (eregi('^(. )' . xt-Commerce / xt:Commerce_session_name() . '=[a-f,0-9]+[&] (. )', $whos_online['last_page_url'], $array)) { echo $array[1] . $array[2]; } else { echo $whos_online['last_page_url']; } ?> (<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . $whos_online['last_page_url']; ?>)</td>
****************<?php
****************if($whos_online['http_referer'] == "") {
********************echo '<td class="dataTableContent" align="center">'.TEXT_HTTP_REFERER_NOT_FOUND.'</td>';
****************} else {
********************echo '<td class="dataTableContent" align="center">'.TEXT_HTTP_REFERER_FOUND.'</td>';
****************}
?>
**************</tr>
<?php
$old_array = $whos_online;
**}
**// BEGIN GEO MOD
**//geoip_close($gi);
**// END GEO MOD
**if (!$i) {
********$i=0;
**}
**$total_dupes = $i;
**$total_sess = xt-Commerce / xt:Commerce_db_num_rows($whos_online_query);
**// EEM - Subtract Bots and Me from Real Customers.**Only subtract me once as Dupes will remove others
**$total_cust = $total_sess - $total_dupes - $total_bots - ($total_me > 1? 1 : $total_me);
**// EEM eof
?>
<?php
**if(isset($http_referer_url))
**{
?>
**<tr>
********<td class="smallText" colspan="8"><?php echo '' . TEXT_HTTP_REFERER_URL . ': ' . $http_referer_url . ''; ?></td>
**</tr>
**<?php
**}
?>
**************<tr>
****************<td class="smallText" colspan="8"><?php echo sprintf(TEXT_NUMBER_OF_CUSTOMERS, $total_sess); print "
Duplicate IPs: $total_dupes
Bots: $total_bots
Me!: $total_me
Real customers: $total_cust
Your IP Address: ".$_SERVER["REMOTE_ADDR"];?></td>
**************</tr>
************</table></td>
<?php
**$heading = array();
**$contents = array();
// EEM - Always show Shopping Cart column
**$heading[] = array('text' => '' . TABLE_HEADING_SHOPPING_CART . '');
**if (isset($info)) {
//**$heading[] = array('text' => '' . TABLE_HEADING_SHOPPING_CART . '');
// EEM eof
****if (STORE_SESSIONS == 'mysql') {
******$session_data = xt-Commerce / xt:Commerce_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $info . "'");
******$session_data = xt-Commerce / xt:Commerce_db_fetch_array($session_data);
******$session_data = trim($session_data['value']);
****} else {
******if ( (file_exists(xt-Commerce / xt:Commerce_session_save_path() . '/sess_' . $info)) && (filesize(xt-Commerce / xt:Commerce_session_save_path() . '/sess_' . $info) > 0) ) {
********$session_data = file(xt-Commerce / xt:Commerce_session_save_path() . '/sess_' . $info);
********$session_data = trim(implode('', $session_data));
******}
****}
******$user_session = unserialize_session_data($session_data);
******if ($user_session) {
********$products = xt-Commerce / xt:Commerce_get_products($user_session);
********for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
**********$contents[] = array('text' => $products[$i]['quantity'] . ' x ' . $products[$i]['name']);
********}
********if (sizeof($products) > 0) {
**********$contents[] = array('text' => xt-Commerce / xt:Commerce_draw_separator('pixel_black.gif', '100%', '1'));
**********$contents[] = array('align' => 'right', 'text'**=> TEXT_SHOPPING_CART_SUBTOTAL . ' ' . sprintf("%.2F",$user_session['cart']->total) . ' ' . $user_session['currency']);
********} else {
**********$contents[] = array('text' => '');
********}
******}
**}
// EEM - Always show Shopping Cart column
//**if ( (xt-Commerce / xt:Commerce_not_null($heading)) && (xt-Commerce / xt:Commerce_not_null($contents)) ) {
// EEM eof
****echo '************<td valign="top">' . "\n";
****$box = new box;
****echo $box->infoBox($heading, $contents);
****echo '************</td>' . "\n";
//**}
?>
**********</tr>
********</table></td>
******</tr>
****</table></td>
**</tr>
</table>
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
Sorry
Variable passed to each() is not an array or object in /admin/whos_online.php on line 31
Dieser Fehler kommt immer mal wieder.
Zeile 31
while (list($products_id, ) = each($session['cart']->contents)) {
<?php
/
**$Id: whos_online.php,v 1.32 2003/06/29 22:50:52 hpdl Exp $
**osCommerce, Open Source E-Commerce Solutions
**http://www.oscommerce.com
**Copyright (c) 2003 osCommerce
**Released under the GNU General Public License
/
require_once('../includes/classes/xt-Commerce / xt:CommercePrice.php');
if (!function_exists("unserialize_session_data")) {
function unserialize_session_data( $session_data ) {
** $variables = array();
** $a = preg_split( "/(\w+)\|/", $session_data, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
** for( $i = 0; $i < count( $a ); $i = $i+2 ) {
****** $variables[$a[$i]] = unserialize( $a[$i+1] );
** }
** return( $variables );
}
}
if (!function_exists("xt-Commerce / xt:Commerce_get_products")) {
function xt-Commerce / xt:Commerce_get_products($session) {
******if (!is_array($session)) return false;
******$products_array = array();
******reset($session);
******while (list($products_id, ) = each($session['cart']->contents)) {
********$products_query = xt-Commerce / xt:Commerce_db_query("select p.products_id, pd.products_name,p.products_image, p.products_model, p.products_price, p.products_discount_allowed, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id='" . xt-Commerce / xt:Commerce_get_prid($products_id) . "' and pd.products_id = p.products_id and pd.language_id = '" . $_SESSION['languages_id'] . "'");
********if ($products = xt-Commerce / xt:Commerce_db_fetch_array($products_query)) {
**********$prid = $products['products_id'];
**********// dirty workaround
**********$xtPrice = new xt-Commerce / xt:CommercePrice($session['currency'],$session['customers_status']['customers_status_id']);
**********$products_price=$xtPrice->xt-Commerce / xt:CommerceGetPrice($products['products_id'],
****************************************$format=fa lse,
****************************************$session['cart']->contents[$products_id]['qty'],
****************************************$products['products_tax_class_id'],
****************************************$products['products_price']);
**********$products_array[] = array('id' => $products_id,
************************************'name' => $products['products_name'],
************************************'model' => $products['products_model'],
************************************'image' => $products['products_image'],
************************************'price' => $products_price+attributes_price($products_id,$ses sion),
************************************'quantity' => $session['cart']->contents[$products_id]['qty'],
************************************'weight' => $products['products_weight'],
************************************'final_price' => ($products_price+attributes_price($products_id,$se ssion)),
************************************'tax_class_id' => $products['products_tax_class_id'],
************************************'attributes' => $session['contents'][$products_id]['attributes']);
********}
******}
******return $products_array;
****}
}
if (!function_exists("attributes_price")) {
function attributes_price($products_id,$session) {
******$xtPrice = new xt-Commerce / xt:CommercePrice($session['currency'],$session['customers_status']['customers_status_id']);
******if (isset($session['contents'][$products_id]['attributes'])) {
********reset($session['contents'][$products_id]['attributes']);
********while (list($option, $value) = each($session['contents'][$products_id]['attributes'])) {
**********$attribute_price_query = xt-Commerce / xt:Commerce_db_query("select pd.products_tax_class_id, p.options_values_price, p.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " p, " . TABLE_PRODUCTS . " pd where p.products_id = '" . $products_id . "' and p.options_id = '" . $option . "' and pd.products_id = p.products_id and p.options_values_id = '" . $value . "'");
**********$attribute_price = xt-Commerce / xt:Commerce_db_fetch_array($attribute_price_query) ;
**********if ($attribute_price['price_prefix'] == '+') {
************$attributes_price += $xtPrice->xt-Commerce / xt:CommerceFormat($attribute_price['options_values_price'],false,$attribute_price['products_tax_class_id']);
**********} else {
************$attributes_price -= $xtPrice->xt-Commerce / xt:CommerceFormat($attribute_price['options_values_price'],false,$attribute_price['products_tax_class_id']);
**********}
********}
******}
******return $attributes_price;
****}
}
// WOL 1.5 - Checks cart and displays status
function xt-Commerce / xt:Commerce_check_cart($which) {
****if (STORE_SESSIONS == 'mysql') {
******$session_data = xt-Commerce / xt:Commerce_db_query("select sesskey, value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $which . "'");
******$session_data = xt-Commerce / xt:Commerce_db_fetch_array($session_data);
******// $session_data = trim($session_data['value']);
****} else {
******if ( (file_exists(xt-Commerce / xt:Commerce_session_save_path() . '/sess_' . $which)) && (filesize(xt-Commerce / xt:Commerce_session_save_path() . '/sess_' . $which) > 0) ) {
********$session_data = file(xt-Commerce / xt:Commerce_session_save_path() . '/sess_' . $which);
********$session_data = trim(implode('', $session_data));
******}
****}
****$which_query = $session_data;
// removed , host_address
**$who_data =** xt-Commerce / xt:Commerce_db_query(("select session_id, time_entry, time_last_click
******************************** from " . TABLE_WHOS_ONLINE . "
******************************** where session_id='" . $which . "'"));
**$who_query = xt-Commerce / xt:Commerce_db_fetch_array($who_data);
**// longer than 3 minutes = inactive
**$xx_mins_ago_long = (time() - 180);
**switch (true) {
**// no cart
**case (strstr($which_query['value'],'"contents";a:0:')):
****if ($who_query['time_last_click'] < $xx_mins_ago_long) {
********** // inactive
******return xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_STATUS_INACTIVE_NOCART);
****} else {
********** // active
******return xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_blue.gif', TEXT_STATUS_ACTIVE_NOCART);
****}
**// cart
**case (!strstr($which_query['value'],'"contents";a:0:')):
****if ($who_query['time_last_click'] < $xx_mins_ago_long) {
********** // inactive
******return xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_yellow.gif', TEXT_STATUS_INACTIVE_CART);
****} else {
********** // active
******return xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_green.gif', TEXT_STATUS_ACTIVE_CART);
****}
**}
}
// WOL 1.5 EOF
**$xx_mins_ago = (time() - 900);
**require('includes/application_top.php');
**require(DIR_WS_CLASSES . 'currencies.php');
**$currencies = new currencies();
// remove entries that have expired
**xt-Commerce / xt:Commerce_db_query("delete from " . TABLE_WHOS_ONLINE . " where time_last_click < '" . $xx_mins_ago . "'");
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Tranistional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<?php if( $_SERVER["QUERY_STRING"] == 300 ){**?>
<meta http-equiv="refresh" content="300;URL=whos_online.php?300">
<?php }elseif ($_SERVER["QUERY_STRING"] == 180){ ?>
<meta http-equiv="refresh" content="180;URL=whos_online.php?180">
<?php }elseif ($_SERVER["QUERY_STRING"] == 120){ ?>
<meta http-equiv="refresh" content="120;URL=whos_online.php?120">
<?php }elseif ($_SERVER["QUERY_STRING"] == 60){ ?>
<meta http-equiv="refresh" content="60;URL=whos_online.php?60">
<?php }elseif ($_SERVER["QUERY_STRING"] == 30){ ?>
<meta http-equiv="refresh" content="30;URL=whos_online.php?30">
<?php } else { ?>
<?php } ?>
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
**<tr>
****<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
****</table></td>
****<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
******<tr>
********<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
**********<tr>
************<td valign="bottom" class="pageHeading">
************<?php echo HEADING_TITLE; ?>
************
Set Refresh Rate:
************<input type='button' value='None' onClick="location.href='whos_online.php'">
************<input type='button' value='3 min' onClick="location.href='whos_online.php?180'">
************<input type='button' value='2 min' onClick="location.href='whos_online.php?120'">
************<input type='button' value='60 sec' onClick="location.href='whos_online.php?60'">
************<input type='button' value='30 sec' onClick="location.href='whos_online.php?30'">
************</td>
************<td align="left">
************<?php echo
************ xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_green.gif' , TEXT_STATUS_ACTIVE_CART) . '' . TEXT_STATUS_ACTIVE_CART . '
' .
************ xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_yellow.gif', TEXT_STATUS_INACTIVE_CART) . '' . TEXT_STATUS_INACTIVE_CART . '
' .
************ xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_white.gif', TEXT_STATUS_NO_SESSION_BOT) . '' . TEXT_STATUS_NO_SESSION_BOT; ?>
************ </td>
************ <td align="left">
************ <?php echo
************ xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_blue.gif' , TEXT_STATUS_ACTIVE_NOCART) . '' . TEXT_STATUS_ACTIVE_NOCART . '
' .
************ xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_red.gif' , TEXT_STATUS_INACTIVE_NOCART) . '' . TEXT_STATUS_INACTIVE_NOCART . '
'; ?>
************</td>
**********</tr>
**********<tr>
************<td><?php echo xt-Commerce / xt:Commerce_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
**********</tr>
********</table></td>
******</tr>
******<tr>
********<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
**********<tr>
************<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
**************<tr class="dataTableHeadingRow">
****************<td></td>
****************<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ONLINE; ?></td>
****************
****************<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_FULL_NAME; ?></td>
****************<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_IP_ADDRESS; ?></td>
****************
****************
****************
****************<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ENTRY_TIME; ?></td>
****************<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_LAST_CLICK; ?></td>
****************<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_LAST_PAGE_URL; ?></td>
****************<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_HTTP_REFERER; ?></td>
**************</tr>
<?php
**// BEGIN GEO MOD
**//require(DIR_WS_INCLUDES . 'geoip.inc');
**//$gi = geoip_open(DIR_WS_INCLUDES . 'GeoIP.dat',GEOIP_STANDARD);
**// END GEO MOD
// EEM Changed order by from IP Address to Last Click and initialized total_bots and total me counts
// $whos_online_query = xt-Commerce / xt:Commerce_db_query("select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, http_referer, session_id from " . TABLE_WHOS_ONLINE . ' order by ip_address');
**$whos_online_query = xt-Commerce / xt:Commerce_db_query("select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, http_referer, session_id from " . TABLE_WHOS_ONLINE . ' order by time_last_click DESC');
**$total_bots=0;
**$total_me=0;
// EEM eof
**while ($whos_online = xt-Commerce / xt:Commerce_db_fetch_array($whos_online_query)) {
****$time_online = ($whos_online['time_last_click'] - $whos_online['time_entry']);
****if ((!isset($_GET['info']) || (isset($_GET['info']) && ($_GET['info'] == $whos_online['session_id']))) && !isset($info)) {
******$info = $whos_online['session_id'];
****}
/ BEGIN COUNT MOD /
****if ($old_array['ip_address'] == $whos_online['ip_address']) {
****$i++;
****}
/ END COUNT MOD /
****if ($whos_online['session_id'] == $info) {
****** if($whos_online['http_referer'] != "")
****** {
********$http_referer_url = $whos_online['http_referer'];
****** }
**** echo '<tr id="defaultSelected" class="dataTableRowSelected">' . "\n";
************} else {
**** echo '<tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cur sor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . xt-Commerce / xt:Commerce_href_link(FILENAME_WHOS_ONLINE, xt-Commerce / xt:Commerce_get_all_get_params(array('info', 'action')) . 'info=' . $whos_online['session_id'], 'NONSSL') . '\'">' . "\n";
****}
// WOL 1.5 - Display Status
****// spider detection??
****if (($whos_online['session_id'] == '') | (!(isset($whos_online['session_id'])))) {
************$noSessionDetected = '?';
****} else {
************$noSessionDetected = '';
****}
?>
**************<td class="dataTableContent" align="left">
****************<?php
****************if ( $noSessionDetected == '' ) {echo '' . xt-Commerce / xt:Commerce_check_cart($whos_online['session_id']);}
****************else {echo '' . xt-Commerce / xt:Commerce_image(DIR_WS_IMAGES . 'icon_status_white.gif', TEXT_STATUS_NO_SESSION_BOT); }?>
**************</td>
****************<td class="dataTableContent"><?php echo gmdate('H:i:s', $time_online); ?></td>
****************
****************
****************<?php if ( $whos_online['customer_id'] == 0 ) { ?>
****************<td class="dataTableContent"><?php echo $whos_online['full_name']; ?></td>
****************<?php } else { ?>
****************<td class="dataTableContent"><?php echo $whos_online['full_name']; ?> (customers.php?selected_box=customers&cID=<?php echo $whos_online['customer_id']; ?>&action=edit)</td>
****************<?php
****************}
// EEM - Changed so that if IP Address is mine, it displays Me!.
//****** If it's a known Bot, it displays the Bot's name
//****** Otherwise, it displays the IP Address as a link to ShowMyIP.com
//****** Tracks number of Bot and Me sessions
// My own IP
************** if ($whos_online['ip_address'] == $_SERVER["REMOTE_ADDR"]){
**************** echo '<td class="dataTableContent" align="center">Me!</td>';
**************** $total_me++;
************** }else{
**************** //-> open iptable.csv
**************** //-> Konstanten
**************** $ip_data = DIR_FS_CATALOG . DIR_WS_INCLUDES . 'data/iptable.csv';
**************** $delimiter = ',';
**************** $found = false;
**************** $ip_array = array();
**************** if (file_exists($ip_data)) {
******************** $file_list = file($ip_data);
******************** for ($i=0; $i < count($file_list);$i++){
********************** $ip_array = explode($delimiter,$file_list[$i]);
********************** if (sizeof($ip_array) > 1 && substr($ip_array[0], 0, 1) != '#' && substr($ip_array[0], 0, 1) != '//'){
************************ $ip_adress = $ip_array[0];
************************ if (strncmp($whos_online['ip_address'], $ip_adress, 9) == 0 ){
************************** echo '<td class="dataTableContent" align="center">' . $ip_array[1] . '</td>';
************************** $found = true;
************************** $total_bots++;
************************** break;
************************ }//-> if (strncmp
********************** }//-> if (sizeof($ip_array)
****************** }//-> for ($i=0;
**************** }//-> if (file_exists($ip_data))
**************** if ($found == false){
****************** echo '<td class="dataTableContent" align="center">' . $whos_online['ip_address'] . ' (http://www.showmyip.com/?ip='.**$whos_online['ip_address']. ' )</td>';
**************** }//-> if ($found == false)
************** }//-> else
************** ?>
****************
<!--
****************<td class="dataTableContent" align="center">
****************<?php //echo xt-Commerce / xt:Commerce_image('images/flags/' . strtolower(geoip_country_code_by_addr($gi, $whos_online['ip_address'])) . '.gif', geoip_country_name_by_addr($gi, $whos_online['ip_address'])).''. geoip_country_code3_by_addr($gi, $whos_online['ip_address']); ?>
****************</TD>
-->
****************<td class="dataTableContent"><?php echo date('H:i:s', $whos_online['time_entry']); ?></td>
****************<td class="dataTableContent" align="center"><?php echo date('H:i:s', $whos_online['time_last_click']); ?></td>
****************<td class="dataTableContent"><?php if (eregi('^(. )' . xt-Commerce / xt:Commerce_session_name() . '=[a-f,0-9]+[&] (. )', $whos_online['last_page_url'], $array)) { echo $array[1] . $array[2]; } else { echo $whos_online['last_page_url']; } ?> (<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . $whos_online['last_page_url']; ?>)</td>
****************<?php
****************if($whos_online['http_referer'] == "") {
********************echo '<td class="dataTableContent" align="center">'.TEXT_HTTP_REFERER_NOT_FOUND.'</td>';
****************} else {
********************echo '<td class="dataTableContent" align="center">'.TEXT_HTTP_REFERER_FOUND.'</td>';
****************}
?>
**************</tr>
<?php
$old_array = $whos_online;
**}
**// BEGIN GEO MOD
**//geoip_close($gi);
**// END GEO MOD
**if (!$i) {
********$i=0;
**}
**$total_dupes = $i;
**$total_sess = xt-Commerce / xt:Commerce_db_num_rows($whos_online_query);
**// EEM - Subtract Bots and Me from Real Customers.**Only subtract me once as Dupes will remove others
**$total_cust = $total_sess - $total_dupes - $total_bots - ($total_me > 1? 1 : $total_me);
**// EEM eof
?>
<?php
**if(isset($http_referer_url))
**{
?>
**<tr>
********<td class="smallText" colspan="8"><?php echo '' . TEXT_HTTP_REFERER_URL . ': ' . $http_referer_url . ''; ?></td>
**</tr>
**<?php
**}
?>
**************<tr>
****************<td class="smallText" colspan="8"><?php echo sprintf(TEXT_NUMBER_OF_CUSTOMERS, $total_sess); print "
Duplicate IPs: $total_dupes
Bots: $total_bots
Me!: $total_me
Real customers: $total_cust
Your IP Address: ".$_SERVER["REMOTE_ADDR"];?></td>
**************</tr>
************</table></td>
<?php
**$heading = array();
**$contents = array();
// EEM - Always show Shopping Cart column
**$heading[] = array('text' => '' . TABLE_HEADING_SHOPPING_CART . '');
**if (isset($info)) {
//**$heading[] = array('text' => '' . TABLE_HEADING_SHOPPING_CART . '');
// EEM eof
****if (STORE_SESSIONS == 'mysql') {
******$session_data = xt-Commerce / xt:Commerce_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $info . "'");
******$session_data = xt-Commerce / xt:Commerce_db_fetch_array($session_data);
******$session_data = trim($session_data['value']);
****} else {
******if ( (file_exists(xt-Commerce / xt:Commerce_session_save_path() . '/sess_' . $info)) && (filesize(xt-Commerce / xt:Commerce_session_save_path() . '/sess_' . $info) > 0) ) {
********$session_data = file(xt-Commerce / xt:Commerce_session_save_path() . '/sess_' . $info);
********$session_data = trim(implode('', $session_data));
******}
****}
******$user_session = unserialize_session_data($session_data);
******if ($user_session) {
********$products = xt-Commerce / xt:Commerce_get_products($user_session);
********for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
**********$contents[] = array('text' => $products[$i]['quantity'] . ' x ' . $products[$i]['name']);
********}
********if (sizeof($products) > 0) {
**********$contents[] = array('text' => xt-Commerce / xt:Commerce_draw_separator('pixel_black.gif', '100%', '1'));
**********$contents[] = array('align' => 'right', 'text'**=> TEXT_SHOPPING_CART_SUBTOTAL . ' ' . sprintf("%.2F",$user_session['cart']->total) . ' ' . $user_session['currency']);
********} else {
**********$contents[] = array('text' => '');
********}
******}
**}
// EEM - Always show Shopping Cart column
//**if ( (xt-Commerce / xt:Commerce_not_null($heading)) && (xt-Commerce / xt:Commerce_not_null($contents)) ) {
// EEM eof
****echo '************<td valign="top">' . "\n";
****$box = new box;
****echo $box->infoBox($heading, $contents);
****echo '************</td>' . "\n";
//**}
?>
**********</tr>
********</table></td>
******</tr>
****</table></td>
**</tr>
</table>
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
Sorry