Results 1 to 7 of 7

Threaded View

  1. #5
    Join Date
    Mar 2008
    Location
    Victoria AU
    Posts
    48
    Plugin Contributions
    0

    Default Re: Who's Online Performance Issue

    I've isolated the problem area to the following code, can anyone give me pointers as to why the response from this section appears to be causing a timeout?

    PHP Code:
    <?php
      $heading 
    = array();
      
    $contents = array();
      if (
    $info) {
        
    $heading[] = array('text' => '<b>' TABLE_HEADING_SHOPPING_CART '</b>');

        if (
    STORE_SESSIONS == 'db') {
          
    $session_data $db->Execute("select value from " TABLE_SESSIONS "
                                        WHERE sesskey = '" 
    $info "'");

          
    $session_data trim($session_data->fields['value']);
        } else {
          if ( (
    file_exists(zen_session_save_path() . '/sess_' $info)) && (filesize(zen_session_save_path() . '/sess_' $info) > 0) ) {
            
    $session_data file(zen_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'customer_id[==]s');
            
    $start_cart strpos($session_data'cart[==]o');
            
    $start_currency strpos($session_data'currency[==]s');
            
    $start_country strpos($session_data'customer_country_id[==]s');
            
    $start_zone strpos($session_data'customer_zone_id[==]s');
          } else {
            
    $start_id strpos($session_data'customer_id|s');
            
    $start_cart strpos($session_data'cart|O');
            
    $start_currency strpos($session_data'currency|s');
            
    $start_country strpos($session_data'customer_country_id|s');
            
    $start_zone strpos($session_data'customer_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));
    // fix nnobo bug
          
    $session_data_cart substr($session_data$start_cart$i $start_cart);
          
    $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 (
    PHP_VERSION 4) {
            
    $broken_cart $cart;
            
    $cart = new shoppingCart;
            
    $cart->unserialize($broken_cart);
          }

          if (
    is_object($_SESSION['cart'])) {
            
    $contents[] = array('text' => $full_name ' - ' $ip_address '<br />' $info);
            
    $products $_SESSION['cart']->get_products();
            for (
    $i 0$n sizeof($products); $i $n$i++) {
              
    $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>');
    // cPath=23&pID=74
            
    }

            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 
    '            <td width="25%" valign="top">' "\n";

        
    $box = new box;
        echo 
    $box->infoBox($heading$contents);

        echo 
    '            </td>' "\n";
      }
    ?>
    If I remove this section of code the who's online responds instantly with a list of users and their cart status. But I would like to be able to see what is in their carts as it provides useful info.
    Last edited by kanine; 26 Apr 2009 at 02:16 AM. Reason: More info...

 

 

Similar Threads

  1. Who's Online sidebox a server load issue?
    By scrapgabbie in forum General Questions
    Replies: 3
    Last Post: 15 Sep 2009, 12:13 PM
  2. who's online issue
    By SQUAREGUM in forum General Questions
    Replies: 4
    Last Post: 19 Sep 2008, 04:50 PM
  3. who's online issue
    By robear in forum General Questions
    Replies: 0
    Last Post: 15 Jun 2008, 05:12 AM
  4. Who's Online - User gone, but Admin says online
    By johnd in forum General Questions
    Replies: 2
    Last Post: 23 Sep 2007, 01:57 AM
  5. Who is online...side admin vs online group pricing mod
    By csfound in forum General Questions
    Replies: 8
    Last Post: 18 Jul 2007, 04:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg