Page 1 of 1

Help --- index.php get blank page for some users

Posted: Mon Jun 28, 2010 4:50 pm
by tommycc
hi all, recently, we upgraded our website php, apache and mysql version. now, get some customers feedback said they cannot open our website (get blank page without any error). we do some testing in our local, no this kind of issues. seems the issues are from some customers who are using French version windows. Then I have a small php file that only one statement phpinfo(). our customers do the testing and they can open and get the result no problem at all.
any advice is appreciated.

Re: Help --- index.php get blank page for some users

Posted: Mon Jun 28, 2010 6:29 pm
by JakeJ
Post the contents of index.php so we can take a look at it. Without that, it's just about impossible to come to a conclusion.

For your own testing purposes though, comment out most of the code and test small sections at a time. Also, test it on Firefox, Chrome and Safari on the same version of Windows (I assume we're talking about IE here).

Perhaps one of your french customers experiencing the problem would let you take over their pc with logmein.com so they didn't have to be present for the testing.

When testing... ISOLATE...ISOLATE...ISOLATE.

Re: Help --- index.php get blank page for some users

Posted: Mon Jun 28, 2010 7:21 pm
by califdon
It would be useful to have one of the customers who has this problem view the source code on his browser and tell you if there is ANY source code being sent to the browser. If there is not, it sounds like you may have a problem with your server, since the php should either generate code or not, regardless of what browser has requested it. I would look for something in your php code that is failing under some circumstances. Is it possible that your php script checks the $_SERVER['HTTP_USER_AGENT'] environment variable and takes some action based on what browser is requesting the page?

Re: Help --- index.php get blank page for some users

Posted: Tue Jun 29, 2010 9:11 am
by tommycc
thanks for your input guys, here is the index.php code, let me know if you find something. thanks again.

Code: Select all

<?php
/*
  index.php 06/19/2009 10:06 

*/
$prgPath = dirname(__FILE__);
  chdir($prgPath);

  require('includes/application_top.php');
  global $customer_id;

 // require('translation.php');
// the following cPath references come from application_top.php
  $category_depth = 'top';
  if (isset($cPath) && tep_not_null($cPath)) {
    $categories_products_query = tep_db_query("select p.categories_name,p.web_title from categories_description p where p.categories_id = '" . (int)$current_category_id . "'");
    $cateqories_products = tep_db_fetch_array($categories_products_query);
	if(tep_not_null($cateqories_products['web_title'])){
	  $title =$cateqories_products['web_title'];
	}
	 else {
	  $title ="Buy " . $cateqories_products['categories_name'] . ' in Canada';
	 }
      $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
      $category_parent = tep_db_fetch_array($category_parent_query);
      if ($category_parent['total'] > 0) {
           $category_depth = 'nested'; // navigate through the categories
      } else {
        $category_depth = 'products'; // category has no products, but display the 'no products' message
      }
    }
  else {
      $title= "Your Neighbourhood Computer Store and Service Centre - PC Systems, PC Components, Computer Parts & Accessories, Notebooks, Netbooks, Electronics, and more.";
  }
  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);
?>
<!--<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=6;FF=3;OtherUA=4">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Keywords" content="CanadaComputers, Canada Computers.com, Computer Components, Computer Parts, LCD Monitors, Video Cards, Processors and CPUs, Computer Memory, RAM, Digital Cameras, Printers, Notebook Computers, Laptops, Motherboards, Flash Memory, PC Speakers">
<meta name="Description" content="Canadacomputers.com offers the best prices on Hard Drives, External Hard Drives, Internal Hard Drives, Laptop Hard Drives, Portable Hard Drives, Computer Hard Drives, SATA Hard Drives, Hard Drive with fast shipping and top-rated customer service.">
<meta name="robots" content="index,follow">
<meta name="copyright" content="&copy; 2003-2010 Canada Computers">
<meta name="google-site-verification" content="3CndLAATdMc2Qj24wzMnCcd4ZJEoPkrwqU9TxRCEya8">
<title><?php echo 'Canada Computers - ' . $title; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="shortcut icon" type="image/x-icon" href="pictures/favicon.ico">
<link rel="stylesheet" type="text/css" href="css/general.css" media="all">
<link rel="stylesheet" type="text/css" href="css/SpryMenuBarHorizontal.css">
<script src="flash/AC_RunActiveContent.js" type="text/javascript"></script>
<script type="text/javascript" src="home/Scripts/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="home/Scripts/SpryMenuBar.js"></script>
<script type="text/javascript" src="home/Scripts/jquery.jstockticker-1.1.js"></script>
<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE7.js" type="text/javascript"></script>

</head>
<body>
<center>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<?php
  if ($category_depth == 'nested') {
    $category_query = tep_db_query("select cd.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "'");
    $category = tep_db_fetch_array($category_query);
?>
<table width="1015" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="175" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"  style="background-color:#ffffff;  color:#000000; text-align:left;">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
    </table></td>
	<td width="10"></td>
     <td width="645" valign="top">
<?php
    if (isset($cPath) && strpos('_', $cPath)) {
// check to see if there are deeper categories within the current category
      $category_links = array_reverse($cPath_array);
      for($i=0, $n=sizeof($category_links); $i<$n; $i++) {
        $categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id");
        $categories = tep_db_fetch_array($categories_query);
        $count=$categories['total'];
		if ($categories['total'] < 1) {
          // do nothing, go through the loop
		  } else {
		  $flag=1;
          $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
          break; 
	 // we have found the deepest category the customer is in
        }
      }
    } else {
      $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id order by sort_order, cd.categories_name");
    }

    $number_of_categories = tep_db_num_rows($categories_query);
    if((int)$current_category_id ==568 || (int)$current_category_id ==569){
		   require('includes/sub_featured.php'); 
		}
     else{
?>
     <table width="645" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
	   <tr>
	   <td class="trail"><?php echo $breadcrumb->trail('&raquo;');?></td>
          </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
<?php
	  $rows = 0;
	  if($n==1){
	   echo '<td><div class="subcat"><ul>';
       echo '<li><h2>' . $category['categories_name']. '</h2></li><li>';
       while ($categories = tep_db_fetch_array($categories_query)) {
	     $rows++;
         $cPath_new = tep_get_path($categories['categories_id']);
         $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';
		 $categories_count= tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . $categories['categories_id'] . "'");
		 $categories_count1 = tep_db_fetch_array($categories_count);
		 if($categories_count1['total']>0){
			 $prefix='+ ';
		   }
		  else {
			 $prefix='&raquo; ';
		  }
	     echo '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $prefix . $categories['categories_name'] . '</a>' . '<br>';
	   }
	   }
		 $category_links = array_reverse($cPath_array);
	//     echo $category_links[$n-2];
         if($n==2){
		    echo '<td><div class="subcat"><ul>';
			 $categories_qu1 = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$category_links[$n-1] . "'");
			 $categories_result1 = tep_db_fetch_array($categories_qu1);
            echo '<li><h2>' . $categories_result1['categories_name'] . '</h2></li><li>';
			$categories_qu2= tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$n-1] . "' and c.categories_id = cd.categories_id order by sort_order, cd.categories_name");
             while ($categories1 = tep_db_fetch_array($categories_qu2)) {
		//	     echo $cPath_new1;
	             $cPath_new1 = tep_get_path($categories1['categories_id']);
				 $categories_count= tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . $categories1['categories_id'] . "'");
				 $categories_count1 = tep_db_fetch_array($categories_count);
				 if($categories_count1['total']>0){
					 $prefix='+ ';
				   }
				  else {
					$prefix='&raquo; ';
					}
           	     echo '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new1) . '">' . $prefix . $categories1['categories_name'] . '</a>' . '<br />';
		    }
			echo '</li><li>';
			$categories_qu3= tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id order by sort_order, cd.categories_name");
             while ($categories1 = tep_db_fetch_array($categories_qu3)) {
		//	     echo $cPath_new1;
	             $cPath_new1 = tep_get_path($categories1['categories_id']);
           	     echo '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new1) . '">&raquo; ' . $categories1['categories_name'] . '</a>' . '<br />';
		    }
		}
// needed for the new products module shown below
    $new_products_category_id = $current_category_id;
?>           </li></ul></div>
			</td>
          </tr>
          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
          </tr>
          <tr>
            <td><?php require('includes/sub_featured.php'); ?></td>
          </tr>
		  </table>

<?php
  }
 }  elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufact_name'])) {
// create column list
    $define_list = array('PRODUCT_LIST_PART' => PRODUCT_LIST_MODEL,
                         'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
                         'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
                         'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
     //                  'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
                         'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
                         'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);

    asort($define_list);

    $column_list = array();
    reset($define_list);
    while (list($key, $value) = each($define_list)) {
      if ($value > 0) $column_list[] = $key;
    }

    $select_column_list = '';

    for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
      switch ($column_list[$i]) {
        case 'PRODUCT_LIST_PART':
          $select_column_list .= 'p.manufact_partnum, ';
          break;
        case 'PRODUCT_LIST_NAME':
          $select_column_list .= 'p.item_description, ';
          break;
        case 'PRODUCT_LIST_MANUFACTURER':
          $select_column_list .= 'p.manufact_name, ';
          break;
         case 'PRODUCT_LIST_IMAGE':
          $select_column_list .= 'ph.item_photo, ';
          break;
      }
    }

// show the products of a specified manufacturer
    if (isset($HTTP_GET_VARS['manufact_name'])) {
      if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only a specific category
        $listing_sql = "select " . $select_column_list . " p.itemid, p.itemcode,p.price3, p.price4, p.rebateamt from " . TABLE_ITEM . " p where p.active=1 and p.showweb=1 and p.categories_id = '" . $HTTP_GET_VARS['filter_id'] . "'";
      } else {
// We show them all
        $listing_sql = "select " . $select_column_list . " p.itemid, p.itemcode, p.price3, p.price4, p.rebateamt from " . TABLE_ITEM . " where p.active=1 and p.showweb=1";
      }
    } else {
// show the products in a given categorie
      if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory
        if($HTTP_GET_VARS['filter_id']=='No Name')
		  $listing_sql = "select p.* from " . TABLE_ITEM . " p where p.active=1 and p.showweb=1 and p.mfg = '' and p.categories_id = '" . (int)$current_category_id . "'";
         else
          $listing_sql = "select p.* from " . TABLE_ITEM . " p where p.active=1 and p.showweb=1 and p.mfg = '" . $HTTP_GET_VARS['filter_id'] . "' and p.categories_id = '" . (int)$current_category_id . "'";
		} else {
// We show them all
        $listing_sql = "select p.* from " . TABLE_ITEM . " p where p.active=1 and p.showweb=1 and p.categories_id = '" . (int)$current_category_id . "'";
      }
    }
    if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
      for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
        if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
          $HTTP_GET_VARS['sort'] = $i+1 . 'a';
          $listing_sql .= " order by p.mfg,p.descrip";
          break;
        }
      }
    } else {
      $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
      $sort_order = substr($HTTP_GET_VARS['sort'], 1);

      switch ($column_list[$sort_col-1]) {
        case 'PRODUCT_LIST_MODEL':
          $listing_sql .= " order by p.specfication " . ($sort_order == 'd' ? 'desc' : '') . ", p.descrip";
          break;
        case 'PRODUCT_LIST_NAME':
          $listing_sql .= " order by p.descrip " . ($sort_order == 'd' ? 'desc' : '');
          break;
        case 'PRODUCT_LIST_MANUFACTURER':
          $listing_sql .= " order by p.mfg " . ($sort_order == 'd' ? 'desc' : '') . ", p.descrip";
          break;
    //    case 'PRODUCT_LIST_QUANTITY':
    //      $listing_sql .= " order by p.item_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", p.item_description";
    //      break;
        case 'PRODUCT_LIST_IMAGE':
          $listing_sql .= " order by p.descrip";
          break;
        case 'PRODUCT_LIST_PRICE':
          $listing_sql .= " order by p.price4 " . ($sort_order == 'd' ? 'desc' : '') . ", p.descrip";
          break;
      }
    }
	 if ($current_category_id) {
      $name = tep_db_query("select p.categories_name from " . TABLE_ITEM . " a left join " . TABLE_CATEGORIES_DESCRIPTION . " p on a.categories_id=p.categories_id where a.categories_id<>0 and a.active=1 and a.showweb=1 and p.categories_id = '" . (int)$current_category_id . "'");
      $cate_name = tep_db_fetch_array($name);
      $category_name = $cate_name['categories_name'];
	  $total_query = tep_db_query("select count(*) as total from " . TABLE_ITEM . " a left join " . TABLE_CATEGORIES_DESCRIPTION . " p on a.categories_id=p.categories_id where a.categories_id<>0 and a.active=1 and a.showweb=1 and p.categories_id = '" . (int)$current_category_id . "'");
	  $total_result=tep_db_fetch_array($total_query);
	  $total=$total_result['total'];
    }
?>
  <table width="1015" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="175" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"  style="background-color:#ffffff;  color:#000000; text-align:left;">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
    </table></td>
<td width="10"></td>
    <td width="645" valign="top"><table width="645" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">

		<tr>
			<td class="trail"><?php echo $breadcrumb->trail('&raquo;');;?></td>
         </tr>
		 <tr>
	       <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '10'); ?></td>
		   </tr>
		 <tr>
        <td><?php require('includes/banner.php'); ?></td>
        </tr>
		 <tr>
	       <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '5'); ?></td>
		   </tr>

          <tr>
		    <td class="pageHeading">
<?php 
		     $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.itemid');
             if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])){
              echo $listing_split->manufact_count(TEXT_PRODUCT_NUMBER, $category_name,$HTTP_GET_VARS['filter_id']);
				}
			else{
			   if(tep_not_null($category_name))
				echo '&nbsp;' . $total . " Item(s) in <i>" . $category_name . "</i><br><br>"; 
              else
				echo '&nbsp;' . $total . " Item(s)<br><br>"; 
			 }
?>
		</td>
		  </tr>
		   <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '10'); ?></td>
		   </tr>
          <tr>

		  <tr>
<?php
// optional Product List Filter
    if (PRODUCT_LIST_FILTER > 0) {
      if (isset($HTTP_GET_VARS['manufact_name'])) {
        $filterlist_sql = "select c.categories_id as id, cd.categories_name as name from " . TABLE_ITEM . " p, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.active=1 and p.showweb=1 and p.categories_id = c.categories_id and p.categories_id = cd.categories_id and p.mfg = '" . $HTTP_GET_VARS['manufact_name'] . "'";
      } else {
        $filterlist_sql= "select distinct p.mfg as name from " . TABLE_ITEM . " p where p.active=1 and p.showweb=1 and p.categories_id = '" . (int)$current_category_id . "' order by p.mfg"; 
      }
      $filterlist_query = tep_db_query($filterlist_sql);
      if (tep_db_num_rows($filterlist_query) > 0) {
        echo '<td align="left" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . '&nbsp;Brand Name:' . '&nbsp;';
        if (isset($HTTP_GET_VARS['manufact_name'])) {
          echo tep_draw_hidden_field('manufact_name', $HTTP_GET_VARS['manufact_name']);
          $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES));
        } else {
          echo tep_draw_hidden_field('cPath', $cPath);
          $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS));
        }
        echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);
        while ($filterlist = tep_db_fetch_array($filterlist_query)) {
		  if($filterlist['name']=='')
			 $filterlist['name']='No Name';
          $options[] = array('id' => $filterlist['name'], 'text' => $filterlist['name']);
		  $manulist[]=$filterlist['name'];
	 //     echo $options[3]['text'];
        }
        echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id'])?$HTTP_GET_VARS['filter_id']: ''), 'onchange="this.form.submit()"');
		
        echo tep_hide_session_id() . '</form></td>' . "\n";
      }
    }

// Get the right image for the top-right
  //  $image = DIR_WS_IMAGES . 'table_background_list.gif';

?>
      </tr>
      <tr>
        <td>
<?php    include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); 
?>
      </td>
	  </tr>
     </table>
      </td>
<?php
  } else { // default page
?>
 <table width="1015" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="175" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"  style="background-color:#ffffff;  color:#000000; text-align:left;">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
    </table></td>
	<td width="10"></td>
    <td width="645" valign="top" align="center">
 <?php  
		require('home/index.html'); 

  }
?>
       </td>
<!-- body_text_eof //-->
<td width="10"></td>
   <td width="175" valign="top" align="left"><table border="0" cellspacing="1" cellpadding="0">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
    </table></td>
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php 
  require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</center>
</body>
</html>
<?php  $_SESSION['back']= htmlentities($_SERVER['REQUEST_URI']); 
 require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>