[ Index ] |
|
Code source de osCommerce 2.2ms2-060817 |
1 <?php 2 /* 3 $Id: whos_online.php,v 1.32 2003/06/29 22:50:52 hpdl Exp $ 4 5 osCommerce, Open Source E-Commerce Solutions 6 http://www.oscommerce.com 7 8 Copyright (c) 2003 osCommerce 9 10 Released under the GNU General Public License 11 */ 12 13 $xx_mins_ago = (time() - 900); 14 15 require ('includes/application_top.php'); 16 17 require (DIR_WS_CLASSES . 'currencies.php'); 18 $currencies = new currencies(); 19 20 // remove entries that have expired 21 tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where time_last_click < '" . $xx_mins_ago . "'"); 22 ?> 23 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 24 <html <?php echo HTML_PARAMS; ?>> 25 <head> 26 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 27 <title><?php echo TITLE; ?></title> 28 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 29 <script language="javascript" src="includes/general.js"></script> 30 </head> 31 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"> 32 <!-- header //--> 33 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 34 <!-- header_eof //--> 35 36 <!-- body //--> 37 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 38 <tr> 39 <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> 40 <!-- left_navigation //--> 41 <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> 42 <!-- left_navigation_eof //--> 43 </table></td> 44 <!-- body_text //--> 45 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 46 <tr> 47 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 48 <tr> 49 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 50 <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 51 </tr> 52 </table></td> 53 </tr> 54 <tr> 55 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 56 <tr> 57 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 58 <tr class="dataTableHeadingRow"> 59 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ONLINE; ?></td> 60 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_CUSTOMER_ID; ?></td> 61 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_FULL_NAME; ?></td> 62 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_IP_ADDRESS; ?></td> 63 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ENTRY_TIME; ?></td> 64 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_LAST_CLICK; ?></td> 65 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_LAST_PAGE_URL; ?> </td> 66 </tr> 67 <?php 68 $whos_online_query = tep_db_query("select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, session_id from " . TABLE_WHOS_ONLINE); 69 while ($whos_online = tep_db_fetch_array($whos_online_query)) { 70 $time_online = (time() - $whos_online['time_entry']); 71 if ((!isset($HTTP_GET_VARS['info']) || (isset($HTTP_GET_VARS['info']) && ($HTTP_GET_VARS['info'] == $whos_online['session_id']))) && !isset($info)) { 72 $info = $whos_online['session_id']; 73 } 74 75 if ($whos_online['session_id'] == $info) { 76 echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n"; 77 } else { 78 echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_WHOS_ONLINE, tep_get_all_get_params(array('info', 'action')) . 'info=' . $whos_online['session_id'], 'NONSSL') . '\'">' . "\n"; 79 } 80 ?> 81 <td class="dataTableContent"><?php echo gmdate('H:i:s', $time_online); ?></td> 82 <td class="dataTableContent" align="center"><?php echo $whos_online['customer_id']; ?></td> 83 <td class="dataTableContent"><?php echo $whos_online['full_name']; ?></td> 84 <td class="dataTableContent" align="center"><?php echo $whos_online['ip_address']; ?></td> 85 <td class="dataTableContent"><?php echo date('H:i:s', $whos_online['time_entry']); ?></td> 86 <td class="dataTableContent" align="center"><?php echo date('H:i:s', $whos_online['time_last_click']); ?></td> 87 <td class="dataTableContent"><?php if (eregi('^(.*)' . tep_session_name() . '=[a-f,0-9]+[&]*(.*)', $whos_online['last_page_url'], $array)) { echo $array[1] . $array[2]; } else { echo $whos_online['last_page_url']; } ?> </td> 88 </tr> 89 <?php 90 } 91 ?> 92 <tr> 93 <td class="smallText" colspan="7"><?php echo sprintf(TEXT_NUMBER_OF_CUSTOMERS, tep_db_num_rows($whos_online_query)); ?></td> 94 </tr> 95 </table></td> 96 <?php 97 $heading = array(); 98 $contents = array(); 99 100 if (isset($info)) { 101 $heading[] = array('text' => '<b>' . TABLE_HEADING_SHOPPING_CART . '</b>'); 102 103 if (STORE_SESSIONS == 'mysql') { 104 $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $info . "'"); 105 $session_data = tep_db_fetch_array($session_data); 106 $session_data = trim($session_data['value']); 107 } else { 108 if ( (file_exists(tep_session_save_path() . '/sess_' . $info)) && (filesize(tep_session_save_path() . '/sess_' . $info) > 0) ) { 109 $session_data = file(tep_session_save_path() . '/sess_' . $info); 110 $session_data = trim(implode('', $session_data)); 111 } 112 } 113 114 if ($length = strlen($session_data)) { 115 if (PHP_VERSION < 4) { 116 $start_id = strpos($session_data, 'customer_id[==]s'); 117 $start_cart = strpos($session_data, 'cart[==]o'); 118 $start_currency = strpos($session_data, 'currency[==]s'); 119 $start_country = strpos($session_data, 'customer_country_id[==]s'); 120 $start_zone = strpos($session_data, 'customer_zone_id[==]s'); 121 } else { 122 $start_id = strpos($session_data, 'customer_id|s'); 123 $start_cart = strpos($session_data, 'cart|O'); 124 $start_currency = strpos($session_data, 'currency|s'); 125 $start_country = strpos($session_data, 'customer_country_id|s'); 126 $start_zone = strpos($session_data, 'customer_zone_id|s'); 127 } 128 129 for ($i=$start_cart; $i<$length; $i++) { 130 if ($session_data[$i] == '{') { 131 if (isset($tag)) { 132 $tag++; 133 } else { 134 $tag = 1; 135 } 136 } elseif ($session_data[$i] == '}') { 137 $tag--; 138 } elseif ( (isset($tag)) && ($tag < 1) ) { 139 break; 140 } 141 } 142 143 $session_data_id = substr($session_data, $start_id, (strpos($session_data, ';', $start_id) - $start_id + 1)); 144 $session_data_cart = substr($session_data, $start_cart, $i); 145 $session_data_currency = substr($session_data, $start_currency, (strpos($session_data, ';', $start_currency) - $start_currency + 1)); 146 $session_data_country = substr($session_data, $start_country, (strpos($session_data, ';', $start_country) - $start_country + 1)); 147 $session_data_zone = substr($session_data, $start_zone, (strpos($session_data, ';', $start_zone) - $start_zone + 1)); 148 149 session_decode($session_data_id); 150 session_decode($session_data_currency); 151 session_decode($session_data_country); 152 session_decode($session_data_zone); 153 session_decode($session_data_cart); 154 155 if (PHP_VERSION < 4) { 156 $broken_cart = $cart; 157 $cart = new shoppingCart; 158 $cart->unserialize($broken_cart); 159 } 160 161 if (is_object($cart)) { 162 $products = $cart->get_products(); 163 for ($i = 0, $n = sizeof($products); $i < $n; $i++) { 164 $contents[] = array('text' => $products[$i]['quantity'] . ' x ' . $products[$i]['name']); 165 } 166 167 if (sizeof($products) > 0) { 168 $contents[] = array('text' => tep_draw_separator('pixel_black.gif', '100%', '1')); 169 $contents[] = array('align' => 'right', 'text' => TEXT_SHOPPING_CART_SUBTOTAL . ' ' . $currencies->format($cart->show_total(), true, $currency)); 170 } else { 171 $contents[] = array('text' => ' '); 172 } 173 } 174 } 175 } 176 177 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { 178 echo ' <td width="25%" valign="top">' . "\n"; 179 180 $box = new box; 181 echo $box->infoBox($heading, $contents); 182 183 echo ' </td>' . "\n"; 184 } 185 ?> 186 </tr> 187 </table></td> 188 </tr> 189 </table></td> 190 <!-- body_text_eof //--> 191 </tr> 192 </table> 193 <!-- body_eof //--> 194 195 <!-- footer //--> 196 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 197 <!-- footer_eof //--> 198 <br> 199 </body> 200 </html> 201 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 19:48:25 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |