digitalgod Posted October 7, 2006 Share Posted October 7, 2006 hey guys,I keep getting this header errorWarning: Cannot modify header information - headers already sent by (output started at /cart/plugins/szukanie/szukanie.php:156) in /cart/actions_client/orders.php on line 50line 50 in orders.php has a header redirect and session_start is at the very begining of the fileso I'm guessing that the problem is from szukanie.php but I can't seem to see what's causing the error...here's the content of szukanie.php[code]<?phpif( !function_exists( 'listProductsSearch' ) ){ /** * List products and return content * @return string * @param string $sFile * @param string $sOption * @param mixed $mValue * @param int $iList */ function listProductsSearch( $sFile = 'products_list.tpl', $sOption = 'list', $mValue = null, $iList = null ){ if( !isset( $_GET['iPage'] ) || !is_numeric( $_GET['iPage'] ) || $_GET['iPage'] < 1 ) $_GET['iPage'] = 1; $iStatus = throwStatus( ); if( !isset( $iList ) ) { if( $iStatus == 1 ) $iList = PRODUCTS_LIST; else $iList = ADMIN_LIST; } if( $sOption == 'search' ){ if (isset($mValue[1])) $aData = dbListProductsSearchExtended ( $iStatus, array(trim( $mValue[0] ), $mValue[1], $mValue[2], $mValue[3]), $iList ); if (isset($mValue[1])) $sPage = $_GET['p'].'&sSearchWord='.$_GET['sSearchWord'].'&Category='.$mValue[1].'&fPriceFrom='.$mValue[2].'&fPriceTo='.$mValue[3]; } if( isset( $aData ) && is_array( $aData ) ) $content = throwProductsData( $sFile, $aData, $sPage, $iList ); else $content = $_GET['tpl']->tbHtml( $sFile, 'NOT_FOUND' ); return $content; } // end function listProductsSearch}function show_categories ($iStatus) { $aFile = file( DB_CATEGORIES ); $iCount = count( $aFile ); $kategorie = null; for( $i = 1; $i < $iCount; $i++ ) { $aExp = explode( '$', $aFile[$i]); if( $aExp[3] >= $iStatus ) { $kategorie[$aExp[0]] = $aExp[1]; if( is_numeric( $aExp[2] ) && $aExp[2] > 0 ) {$kategorie[$aExp[0]] = $kategorie[$aExp[2]].' '.$kategorie[$aExp[0]]; } } } return $kategorie; }function show_products_ex () { $aFile = file(DB_PRODUCTS_EXT); $iCount = count( $aFile ); $produkty_ex = null; for( $i = 1; $i < $iCount; $i++ ) { $aExp = explode( '$', $aFile[$i]); if (isset($aExp[1])) {$produkty_ex[$aExp[0]] = $aExp[1];} if (!isset($aExp[1])) {$produkty_ex[$aExp[0]] = "";} } return $produkty_ex; }function show_products_categories () { $aFile = file(DB_PRODUCTS_CATEGORIES); $iCount = count( $aFile ); $produkty_kategorie = null; for( $i = 1; $i < $iCount; $i++ ) { $aExp = explode( '$', $aFile[$i]); $produkty_kategorie[$aExp[1]] = $aExp[0]; } return $produkty_kategorie; }function show_prices_promo () { $aFile = file(DB_PRODUCT_ATTRIBUTES); $iCount = count( $aFile ); $produkty_ceny_promo = null; for( $i = 1; $i < $iCount; $i++ ) { $aExp = explode( '$', $aFile[$i]); $produkty_ceny_promo[$aExp[0]] = $aExp[2]; } return $produkty_ceny_promo; }if( !function_exists( 'dbListProductsSearchExtended' ) ){ /** * Return array of products list, search by word * @return array * @param int $iStatus * @param string $sWord * @param int $iList */ function dbListProductsSearchExtended( $iStatus, $sWord, $iList ){ global $oFF; $aCategories = dbThrowProductsCategories( ); $kategorie = show_categories (0); $produkty_ex = show_products_ex (); $produkty_kategorie = show_products_categories (); $produkty_ceny_promo = show_prices_promo (); return $oFF->throwFileArrayFunctionPages( DB_PRODUCTS, null, $_GET['iPage'], $iList, 'dbListProductsSearchCheckExtended', Array( $iStatus, $aCategories, $sWord[0], $kategorie, $produkty_ex, $produkty_kategorie, $sWord[1], $produkty_ceny_promo, $sWord[2], $sWord[3]) ); } // end function dbListProductsSearchExtended}if( !function_exists( 'dbListProductsSearchCheckExtended' ) ){ /** * Checking data of products * @return bool * @param array $aData * @param array $aCheck */ function dbListProductsSearchCheckExtended( $aData, $aCheck ){ $fPrice = $aData[2]; if (isset($aCheck[7][$aData[0]]) && is_numeric($aCheck[7][$aData[0]])) $fPrice = $aCheck[7][$aData[0]]; if (isset($aCheck[8]) && is_numeric($aCheck[8])) {$fPriceFrom = $aCheck[8];} else {$fPriceFrom = '0';} if (isset($aCheck[9]) && is_numeric($aCheck[9])) {$fPriceTo = $aCheck[9];} else {$fPriceTo = '';} if( is_array( $aData ) && isset( $aCheck[1][$aData[0]] ) && $aData[4] >= $aCheck[0] ) { if (($aCheck[2] == '') || ($aCheck[2] != '' && stristr( implode( ' ', $aData ).' '.$aCheck[3][$aCheck[1][$aData[0]][0]].' '.$aCheck[4][$aData[0]], $aCheck[2] ))) { if (($aCheck[6] == '') || (($aCheck[6] != '') && ($aCheck[5][$aData[0]] == $aCheck[6]))) { if ((($fPriceTo == '') || (($fPriceTo != '') && ($fPrice <= $fPriceTo))) && ($fPrice >= $fPriceFrom)) { return true; } else return null; } else return null; } else return null; } else return null; } // end function dbListProductsSearchCheckExtended}function ShowSearchExtendedForm ( $sFile = 'extended_search.tpl' ) { global $tpl; return $tpl->tbHtml( $sFile, 'EXTENDED_SEARCH_FORM' ); } ?> [/code] Quote Link to comment Share on other sites More sharing options...
marcus Posted October 7, 2006 Share Posted October 7, 2006 [code] if( is_numeric( $aExp[2] ) && $aExp[2] > 0 ) {$kategorie[$aExp[0]] = $kategorie[$aExp[2]].' '.$kategorie[$aExp[0]]; } } } return $kategorie; } //< line 50[/code]i get no errors Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 7, 2006 Share Posted October 7, 2006 What is line 156 of szukanie.php? The error is telling you where the output started.Ken Quote Link to comment Share on other sites More sharing options...
marcus Posted October 7, 2006 Share Posted October 7, 2006 and line 156 is ?> Quote Link to comment Share on other sites More sharing options...
redarrow Posted October 7, 2006 Share Posted October 7, 2006 i only use this method if it is so needed other wise post the lines that are wrong or i think it's in another page.php.put ob_start(); at the top of the pageand at the bottom ob_end_flash(); Quote Link to comment Share on other sites More sharing options...
digitalgod Posted October 7, 2006 Author Share Posted October 7, 2006 @kenrbnsn : line 156 is ?>@redarror : didn't work still get the same error... did you mean to put it in orders.php or szukanie.php?edittried putting that in orders.php as well but got the error except now it's pointing to line 155 which is ob_end_flush(); Quote Link to comment Share on other sites More sharing options...
marcus Posted October 7, 2006 Share Posted October 7, 2006 show us orders.php Quote Link to comment Share on other sites More sharing options...
redarrow Posted October 7, 2006 Share Posted October 7, 2006 your problam is with a page that you have not posted yet so post the page with the problam and yes you can use the provided php syntex on any page ok. Quote Link to comment Share on other sites More sharing options...
digitalgod Posted October 7, 2006 Author Share Posted October 7, 2006 orders.php[code=php:0]<?phpsession_start( );if( !isset( $_SESSION['iCustomer'] ) ) $_SESSION['iCustomer'] = time( ).rand( 100, 999 );require_once DIR_CORE.'couriers-'.$config['db_type'].'.php';require_once DIR_CORE.'couriers.php';require_once DIR_CORE.'orders-'.$config['db_type'].'.php';require_once DIR_CORE.'orders.php';require_once DIR_CORE.'products-'.$config['db_type'].'.php';require_once DIR_CORE.'products.php';if( $a == 'Basket' ){ if( isset( $sOption ) ){ if( isset( $_SESSION['iOrderSession'] ) ) $iOrder = $_SESSION['iOrderSession']; else{ $_SESSION['iOrderSession'] = $iOrder = throwOrderIdTemp( $_SESSION['iCustomer'], 'add' ); } if( $sOption == 'add' ){ if( isset( $iProduct ) && is_numeric( $iProduct ) && isset( $iQuantity ) && is_numeric( $iQuantity ) && $iQuantity >= 1 && $iQuantity < 1000 ){ addOrderProduct( $iProduct, $iQuantity, $iOrder ); } // added for not showing basket after clicking add to basket echo "<script type='text/javascript' language='javascript'> history.go(-1); </script>"; exit; // end // original code header( 'Location: '.$_SERVER['PHP_SELF'].'?p=ordersBasket' ); exit; // original code } elseif( $sOption == 'del' ){ if( isset( $iElement ) && is_numeric( $iElement ) ) delOrderElement( $iOrder, $iElement ); } elseif( $sOption == 'save' ){ if( isset( $_POST['aElements'] ) && is_array( $_POST['aElements'] ) ){ saveOrderProducts( $_POST ); } if( isset( $_POST['sSave'] ) ){ header( 'Location: '.$_SERVER['PHP_SELF'].'?p=ordersDelivery' ); exit; } } } else{ if( isset( $_SESSION['iOrderSession'] ) ) $iOrder = $_SESSION['iOrderSession']; } if( isset( $iOrder ) && is_numeric( $iOrder ) ) $content .= listBasket( $iOrder ); else $content .= $tpl->tbHtml( 'orders_basket.tpl', 'NOT_FOUND' );}elseif( $a == 'Delivery' ){ if( isset( $_SESSION['iOrderSession'] ) ) $iOrder = $_SESSION['iOrderSession']; if( isset( $iOrder ) && is_numeric( $iOrder ) ){ if( isset( $_POST['sOption'] ) && $_POST['sOption'] == 'send' ){ if( checkOrderFields( $_POST ) === true && checkOrderProducts( $iOrder ) === true ){ saveOrder( $iOrder, $_POST ); //--------- Start PayPal Code $aData = throwOrder( $iOrder ); listBasket( $iOrder); $aData['fSummary'] = sprintf( '%01.2f', $aData['fCourierPrice'] + $aList['fSummary'] ); if( $aData['fCourierPrice'] > 0 ){ $content .= $tpl->tbHtml( 'messages.tpl', 'ORDER_PAYPAL' ); } else //-------- End PayPal Code $content .= $tpl->tbHtml( 'messages.tpl', 'ORDER_SAVED' ); unset( $_SESSION['iOrderSession'] ); } else $content .= $tpl->tbHtml( 'messages.tpl', 'FORM_ERROR' ); } else{ if( checkOrderProducts( $iOrder ) === true ){ $sCourierSelect = listCouriers( 'couriers_select.tpl' ); $content .= $tpl->tbHtml( 'orders_delivery.tpl', 'FORM' ); $content .= listBasket( $iOrder, 'orders_delivery.tpl' ); $content .= $tpl->tbHtml( 'orders_delivery.tpl', 'COURIER' ); } else $content .= $tpl->tbHtml( 'messages.tpl', 'NOT_EXISTS' ); } } else $content .= $tpl->tbHtml( 'orders_basket.tpl', 'NOT_FOUND' );}elseif( $a == 'Print' && isset( $iOrder ) && is_numeric( $iOrder ) ){ $aData = throwOrder( $iOrder ); if( isset( $aData ) && is_array( $aData ) && $aData['iClient'] == $_SESSION['iCustomer'] && $aData['iStatus'] > 0 ){ $aData['sComment'] = ereg_replace( '\|n\|', "<br />" , $aData['sComment'] ); $content .= $tpl->tbHtml( 'orders_print.tpl', 'SHOW' ); if( checkOrderProducts( $iOrder ) === true ){ $content .= listBasket( $iOrder, 'orders_print.tpl' ); $aData['fSummary'] = tPrice( $aData['fCourierPrice'] + $aList['fSummary'] ); $content .= $tpl->tbHtml( 'orders_print.tpl', 'COURIER' ); } } else{ $content .= $tpl->tbHtml( 'messages.tpl', 'ERROR' ); }}else $content .= $tpl->tbHtml( 'messages.tpl', 'ERROR' );?>[/code] Quote Link to comment Share on other sites More sharing options...
marcus Posted October 7, 2006 Share Posted October 7, 2006 dreamweaver picks up no errors[code] if( isset( $_POST['sSave'] ) ){ header( 'Location: '.$_SERVER['PHP_SELF'].'?p=ordersDelivery' ); exit; //<line 50[/code] Quote Link to comment Share on other sites More sharing options...
redarrow Posted October 7, 2006 Share Posted October 7, 2006 try this at the end of the code or you can use @ob_end_flash();while (ob_get_level() > 0) { ob_end_flush();} Quote Link to comment Share on other sites More sharing options...
digitalgod Posted October 7, 2006 Author Share Posted October 7, 2006 still getting the same error :S@mgallforever: dreamweaver shouldn't pick up any errors, it's a header problem not a syntax error Quote Link to comment Share on other sites More sharing options...
digitalgod Posted October 7, 2006 Author Share Posted October 7, 2006 well oddly enough the problem was from another file that used headers, I added ob_start() to it and now everything works perfectly.thanks for your help guys Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.