Execute("select sesskey, value
from " . TABLE_SESSIONS . "
where sesskey= '" . $which . "'");
$who_query = $db->Execute("select session_id, time_entry, time_last_click, host_address, user_agent
from " . TABLE_WHOS_ONLINE . "
where session_id='" . $which . "'");
// longer than 2 minutes light color
$xx_mins_ago_long = (time() - WHOIS_TIMER_INACTIVE);
$chk_cart_status = base64_decode($which_query->fields['value']);
switch (true) {
case ($which_query->RecordCount() == 0):
if ($who_query->fields['time_last_click'] < $xx_mins_ago_long) {
return zen_image(DIR_WS_IMAGES . 'icon_status_red_light.gif');
} else {
return zen_image(DIR_WS_IMAGES . 'icon_status_red.gif');
}
break;
case (strstr($chk_cart_status,'"contents";a:0:')):
if ($who_query->fields['time_last_click'] < $xx_mins_ago_long) {
return zen_image(DIR_WS_IMAGES . 'icon_status_red_light.gif');
} else {
return zen_image(DIR_WS_IMAGES . 'icon_status_red.gif');
}
break;
case (!strstr($chk_cart_status,'"contents";a:0:')):
if ($who_query->fields['time_last_click'] < $xx_mins_ago_long) {
return zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif');
} else {
return zen_image(DIR_WS_IMAGES . 'icon_status_green.gif');
}
break;
}
}
// time since last click
function zen_check_minutes($the_time_last_click) {
$the_seconds = (time() - $the_time_last_click);
$the_time_since= gmdate('H:i:s', $the_seconds);
return $the_time_since;
}
require('includes/application_top.php');
require(DIR_WS_CLASSES . 'currencies.php');
$currencies = new currencies();
// same time_entry as time_last_click for 600 seconds = 10 minutes assumed to have left immediately
$xx_mins_ago_dead = (time() - WHOIS_TIMER_DEAD);
// remove after how many seconds? default= 1200 = 20 minutes
$xx_mins_ago = (time() - WHOIS_TIMER_REMOVE);
// remove entries that have expired
$db->Execute("delete from " . TABLE_WHOS_ONLINE . "
where time_last_click < '" . $xx_mins_ago . "'
or (time_entry=time_last_click
and time_last_click < '" . $xx_mins_ago_dead . "')");
if (!isset($_SESSION['wo_exclude_admins'])) {
$_SESSION['wo_exclude_admins'] = TRUE;
}
if (isset($_GET['na'])) {
$_SESSION['wo_exclude_admins'] = ($_GET['na'] == 0) ? FALSE : TRUE;
}
if (!isset($_SESSION['wo_exclude_spiders'])) {
$_SESSION['wo_exclude_spiders'] = TRUE;
}
if (isset($_GET['ns'])) {
$_SESSION['wo_exclude_spiders'] = ($_GET['ns'] == 0) ? FALSE : TRUE;
}
if (isset($_GET['t']) ) {
$_SESSION['wo_timeout'] = (int)$_GET['t'];
}
if (!isset($_SESSION['wo_timeout'])) {
$_SESSION['wo_timeout'] = $defaultRefreshInterval;
}
if (!isset($_SESSION['wo_timeout']) || $_SESSION['wo_timeout'] < 3) {
$_SESSION['wo_timeout'] = 0;
}
$listing = $_GET['q'];
switch ($listing) {
case "full_name-desc":
$order = "full_name DESC, LPAD(ip_address,11,'0')";
break;
case "full_name":
$order = "full_name, LPAD(ip_address,11,'0')";
break;
case "ip_address":
$order = "ip_address, session_id";
break;
case "ip_address-desc":
$order = "ip_address DESC, session_id";
break;
case "time_last_click-desc":
$order = "time_last_click DESC, LPAD(ip_address,11,'0')";
break;
case "time_last_click":
$order = "time_last_click, LPAD(ip_address,11,'0')";
break;
case "time_entry-desc":
$order = "time_entry DESC, LPAD(ip_address,11,'0')";
break;
case "time_entry":
$order = "time_entry, LPAD(ip_address,11,'0')";
break;
case "last_page_url-desc":
$order = "last_page_url DESC, LPAD(ip_address,11,'0')";
break;
case "last_page_url":
$order = "last_page_url, LPAD(ip_address,11,'0')";
break;
case "session_id":
$order = "session_id, ip_address";
break;
case "session_id-desc":
$order = "session_id DESC, ip_address";
break;
default:
$order = "time_entry, LPAD(ip_address,11,'0')";
}
$where = '';
if ($_SESSION['wo_exclude_spiders']) {
$where = "where session_id != '' ";
}
if ($_SESSION['wo_exclude_admins']) {
$where .= ($where == '') ? " where " : " and ";
$where .= "ip_address != '' and ip_address not in ('" . implode("','", preg_split('/[\s,]/', EXCLUDE_ADMIN_IP_FOR_MAINTENANCE . ',' . $_SERVER['REMOTE_ADDR'])) . "') ";
}
$sql = "select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, session_id, host_address, user_agent
from " . TABLE_WHOS_ONLINE . " :where: order by :orderby:";
$sql = $db->bindVars($sql, ':where:', $where, 'passthru');
$sql = $db->bindVars($sql, ':orderby:', $order, 'passthru');
$whos_online = $db->Execute($sql);
$total_sess = $whos_online->RecordCount();
$optURL = FILENAME_WHOS_ONLINE . '.php?' . zen_get_all_get_params(array('t', 'na', 'ns'));
$listingURL = FILENAME_WHOS_ONLINE . '.php?' . zen_get_all_get_params(array('q', 't', 'na', 'ns'));
?>
>
|
|
' . '' . WHOS_ONLINE_REFRESH_LIST_TEXT . '' . '' .
' ' . "\n" . WHOS_ONLINE_LEGEND_TEXT . ' ' .
zen_image(DIR_WS_IMAGES . 'icon_status_green.gif') . ' ' . WHOS_ONLINE_ACTIVE_TEXT . ' ' .
zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif') . ' ' . WHOS_ONLINE_INACTIVE_TEXT . ' ' .
zen_image(DIR_WS_IMAGES . 'icon_status_red.gif') . ' ' . WHOS_ONLINE_ACTIVE_NO_CART_TEXT . ' ' .
zen_image(DIR_WS_IMAGES . 'icon_status_red_light.gif') . ' ' . WHOS_ONLINE_INACTIVE_NO_CART_TEXT . ' ' .
WHOS_ONLINE_INACTIVE_LAST_CLICK_TEXT . ' ' . WHOIS_TIMER_INACTIVE . 's' .' || ' . WHOS_ONLINE_INACTIVE_ARRIVAL_TEXT . ' ' .
WHOIS_TIMER_DEAD . 's ' . WHOS_ONLINE_REMOVED_TEXT;?>
0 ? sprintf(TEXT_WHOS_ONLINE_TIMER_EVERY, $_SESSION['wo_timeout']) : TEXT_WHOS_ONLINE_TIMER_DISABLED); ?>
|
|
|
|
|
'' . TABLE_HEADING_SHOPPING_CART . '');
$tag = 0;
$session_data = '';
$result = $db->Execute("select value from " . TABLE_SESSIONS . "
WHERE sesskey = '" . $info . "'");
$session_data = trim($result->fields['value']);
$hardenedStatus = FALSE;
$suhosinExtension = extension_loaded('suhosin');
$suhosinSetting = strtoupper(@ini_get('suhosin.session.encrypt'));
// if (!$suhosinExtension) {
if (strpos($session_data, 'cart|O') == 0) $session_data = base64_decode($session_data);
if (strpos($session_data, 'cart|O') == 0) $session_data = '';
// }
// uncomment the following line if you have suhosin enabled and see errors on the cart-contents sidebar
//$hardenedStatus = ($suhosinExtension == TRUE || $suhosinSetting == 'On' || $suhosinSetting == 1) ? TRUE : FALSE;
if ($session_data != '' && $hardenedStatus == TRUE) $session_data = '';
if ($length = strlen($session_data)) {
$start_id = (int)strpos($session_data, 'customer_id|s');
$start_currency = (int)strpos($session_data, 'currency|s');
$start_country = (int)strpos($session_data, 'customer_country_id|s');
$start_zone = (int)strpos($session_data, 'customer_zone_id|s');
$start_cart = (int)strpos($session_data, 'cart|O');
$end_cart = (int)strpos($session_data, '|', $start_cart+6);
$end_cart = (int)strrpos(substr($session_data, 0, $end_cart), ';}');
$session_data_id = substr($session_data, $start_id, (strpos($session_data, ';', $start_id) - $start_id + 1));
$session_data_cart = substr($session_data, $start_cart, ($end_cart - $start_cart+2));
$session_data_currency = substr($session_data, $start_currency, (strpos($session_data, ';', $start_currency) - $start_currency + 1));
$session_data_country = substr($session_data, $start_country, (strpos($session_data, ';', $start_country) - $start_country + 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_country);
session_decode($session_data_zone);
session_decode($session_data_cart);
if (is_object($_SESSION['cart'])) {
$contents[] = array('text' => $full_name . ' - ' . $ip_address . ' ' . $info);
$products = $_SESSION['cart']->get_products();
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' => zen_draw_separator('pixel_black.gif', '100%', '1'));
$contents[] = array('align' => 'right', 'text' => TEXT_SHOPPING_CART_SUBTOTAL . ' ' . $currencies->format($_SESSION['cart']->show_total(), true, $_SESSION['currency']));
} else {
$contents[] = array('text' => TEXT_EMPTY_CART);
}
}
}
}
if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
echo ' ' . "\n";
$box = new box;
echo $box->infoBox($heading, $contents);
echo ' | ' . "\n";
}
?>
|
|