fullyloaded Posted June 28, 2008 Share Posted June 28, 2008 hi can anyone help me? im getting this error on my site thanks... Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/scriptsr/public_html/conn.php:1) in /home/scriptsr/public_html/conn.php on line 26[code] [/code] Quote Link to comment Share on other sites More sharing options...
br0ken Posted June 28, 2008 Share Posted June 28, 2008 When sending any headers to browser you must not have already sent any actual output. This includes html tags, white space or general text. Based on the error message you are receiving I would say you've outputted something on '/home/scriptsr/public_html/conn.php' on the first line. It's probably just white space but what ever it is just remove it and it will work fine. Quote Link to comment Share on other sites More sharing options...
fullyloaded Posted June 28, 2008 Author Share Posted June 28, 2008 here is the script its saying the error is thanks... <? //^^^^^^^^^^^^^^^^^ MySQL database connection ! ^^^^^^^^^^^^^^^^\\ $db_host = "localhost"; # Enter your MySQL database hostname, often it is not necessary to edit this line $db_username = "ttttt"; # Enter your MySQL database username $db_password = "tttt"; # Enter your MySQL database password $db_name = "tttt"; # Enter the MySQL database name //\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\ //^^^^^^^^^^^^^^^^^^^^^^^ DO NOT EDIT BELOW THIS LINE ! ^^^^^^^^^^^^^^^^^^^^^^\\ //\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\ require_once('tplparser.php'); $conn = mysql_connect($db_host, $db_username, $db_password) or die(mysql_error()); $db = mysql_select_db($db_name, $conn) or $err = 'Unknown database '.$db_name.', you must create it before continuing!'; session_start(); $t = time(); $PHPSESSID = session_id(); if(!ereg("/install.php", @$_SERVER['REQUEST_URI'])) { //get the main site settings $qset = "SELECT * FROM pc_settings"; $rset = mysql_query($qset) or die(mysql_error()); $aset = mysql_fetch_array($rset); $style = $aset['Style']; $currsymbol = $aset['CurrSymbol']; $currcode = $aset['CurrCode']; $sec_dir = $aset['SecDir']; $tpl = new TplParser; $tpl->setDir('templates/'.$style.'/'); //get the Topbanner (full) $qfull = "SELECT * FROM pc_banners WHERE BannerType = 'Full' "; $rfull = mysql_query($qfull) or die(mysql_error()); if(mysql_num_rows($rfull) > '1') { while($afull = mysql_fetch_array($rfull)){ $fullBannerID[] = $afull['BannerID']; } srand((float)microtime() * 10000000); $fullID = array_rand($fullBannerID); $FullBID = $fullBannerID[$fullID]; //get the selected banner $qfull1 = "SELECT * FROM pc_banners WHERE BannerID = '$FullBID' "; $rfull1 = mysql_query($qfull1) or die(mysql_error()); $afull1 = mysql_fetch_array($rfull1); $TopBanner = "<a href=\"$afull1[bannerURL]\" target=_blank><img src=\"banners/$afull1[bannerFile]\" border=0 title=\"$afull1[AltText]\"></a>"; } elseif(mysql_num_rows($rfull) == '1') { $afull = mysql_fetch_array($rfull); $TopBanner = "<a href=\"$afull[bannerURL]\" target=_blank><img src=\"banners/$afull[bannerFile]\" border=0 title=\"$afull[AltText]\"></a>"; } //get the SideBanner (menu) $qbb = "SELECT * FROM pc_banners WHERE BannerType = 'Menu' "; $rbb = mysql_query($qbb) or die(mysql_error()); if(mysql_num_rows($rbb) > '1') { while($abb = mysql_fetch_array($rbb)){ $bBannerID[] = $abb['BannerID']; } srand((float)microtime() * 10000000); $bID = array_rand($bBannerID); $ButtonID = $bBannerID[$bID]; //get the selected banner $qbb1 = "SELECT * FROM pc_banners WHERE BannerID = '$ButtonID' "; $rbb1 = mysql_query($qbb1) or die(mysql_error()); $abb1 = mysql_fetch_array($rbb1); $SideBanner = "<a href=\"$abb1[bannerURL]\" target=_blank><img src=\"banners/$abb1[bannerFile]\" border=0 title=\"$abb1[AltText]\"></a>"; } elseif(mysql_num_rows($rbb) == '1') { $abb = mysql_fetch_array($rbb); $SideBanner = "<a href=\"$abb[bannerURL]\" target=_blank><img src=\"banners/$abb[bannerFile]\" border=0 title=\"$abb[AltText]\"></a>"; } //show cart status $q1 = "select * from pc_orders_content where OrderID = '$PHPSESSID' "; $r1 = mysql_query($q1) or die(mysql_error()); $rows = mysql_num_rows($r1); if($rows == '0'){ $cart_total = '0.00';$num_items = '0'; } else { while($a1 = mysql_fetch_array($r1)) { $num_items = $rows; if ($currsymbol != '€'){ @$cart_total = number_format($cart_total + $a1['ItemPrice'], 2, ".", ""); } else { $cprice = $a1['ItemPrice']; @$ctotal = number_format($ctotal + $cprice, 2, ".", ""); $cart_total = str_replace('.', ',', $ctotal); }} } if($aset['LogMode'] == '1'){ if(!empty($_SESSION['cmr_name']) && !empty($_SESSION['cmr_pass'])){ $user_name = $_SESSION['cmr_name']; @$user_pass = $_SESSION['cmr_pass']; $status = $tpl->tbHtml('session_tpl.php', 'MY_CART_1'); }else{ @$user_name = $_SESSION['cmr_name']; $status = $tpl->tbHtml('session_tpl.php', 'LOGIN_FORM'); } } else{ $_SESSION['cmr_name'] = 'customer'; $user_name = $_SESSION['cmr_name']; $status = $tpl->tbHtml('session_tpl.php', 'MY_CART_2'); } } ?> Quote Link to comment Share on other sites More sharing options...
br0ken Posted June 28, 2008 Share Posted June 28, 2008 You need to make sure your '<?' tag is snug right to the top of the file and there are no spaces or lines breaks present before this. If this doesn't solve it can you show me your 'tplparser.php' as that could be causing the problem. Quote Link to comment Share on other sites More sharing options...
fullyloaded Posted June 28, 2008 Author Share Posted June 28, 2008 hi here is the tplparser.php thanks for your time <?php /** * // Load template file // * * $tpl = new tplparser; * $tpl->setDir( 'tpl/' ); * $tpl->dHtml( 'file_name.tpl' ); * $content = $tpl->tHtml( 'file_name.tpl' ); * * * // Load template block // * $tpl->dbHtml( 'file_name.tpl', 'HEAD' ); * $content = $tpl->tbHtml( 'file_name.tpl', 'HEAD' ); * <!-- BEGIN HEAD --> * <!-- END HEAD --> * */ class TplParser { var $content; var $TplFile; var $block; var $startBlock; var $endBlock; var $endBlockLine; var $fileContent; var $blockContent; var $cache; var $iso; var $directory; function TplParser( ){ $this->content = ''; $this->TplFile = ''; $this->block = ''; $this->startBlock = '<!-- BEGIN_'; $this->endBlock = '<!-- END_'; $this->endBlockLine = ' -->'; $this->cache = true; $this->iso = true; } // end function TplParser function dHtml( $sFile, $bCache = true, $bIso = true ){ $this->setFile( $this->directory.$sFile ); $this->cache = $bCache; $this->iso = $bIso; $this->display( ); echo $this->content; unset( $this->content ); flush( ); } // end function dHtml function tHtml( $sFile, $bCache = true, $bIso = true ){ $this->setFile( $this->directory.$sFile ); $this->cache = $bCache; $this->iso = $bIso; $this->display( ); return $this->content; } // end function tHtml function dbHtml( $sFile, $sBlock, $bCache = true, $bIso = true ){ $this->setFile( $this->directory.$sFile ); $this->setBlock( $sBlock ); $this->cache = $bCache; $this->iso = $bIso; $this->display( true ); echo $this->content; unset( $this->content ); flush( ); } // end function dbHtml function tbHtml( $sFile, $sBlock, $bCache = true, $bIso = true ){ $this->setFile( $this->directory.$sFile ); $this->setBlock( $sBlock ); $this->cache = $bCache; $this->iso = $bIso; $this->display( true ); return $this->content; } // end function tbHtml function display( $bBlock = null ){ if( $this->checkFile( ) ){ if( isset( $bBlock ) ) $this->blockParse( ); else $this->allParse( ); } } // end function display function checkFile( ){ if( is_file( $this->TplFile ) ){ return true; } else { $this->content = null; //echo 'No template file: <i>'.$this->TplFile.'</i><br />'; return false; } } // end function checkFile function parse( ){ if( !isset( $poz ) ) $poz[1][1] = 0; while( strpos( $this->content, '$', $poz[1][1] ) ) { $poz[1][1] = strpos( $this->content, '$', $poz[1][1] ) + 1; preg_match( '/\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\[\]x7f-\xff]*/', $this->content, $wyniki ); if( ereg( '\]', $wyniki[0] ) ){ if( ereg( '\[', $wyniki[0] ) ){ $poz[1][2] = $poz[1][1] + strpos( $wyniki[0], ']' ); $bArray = true; } else{ $poz[1][2] = $poz[1][1] + strpos( $wyniki[0], ']' ) - 1; $bArray = null; } } else{ $poz[1][2] = $poz[1][1] + strlen( $wyniki[0] ) - 1; $bArray = null; } $TplVar = substr( $this->content, $poz[1][1], $poz[1][2] - $poz[1][1] ); if( isset( $bArray ) ){ list($var,) = explode( '[', $TplVar ); if( isset( $GLOBALS[$var] ) ){ global $$var; $poz[2][1]= strpos( $TplVar, '[' )+1; $poz[2][2]= strpos( $TplVar, ']' ); $key = substr( $TplVar, $poz[2][1], $poz[2][2]-$poz[2][1] ); if( isset( ${$var}[$key] ) ) $tekst = ${$var}[$key]; else $tekst = null; } else{ $tekst = null; } } else { global $$TplVar; $tekst = $$TplVar; } $this->content = substr( $this->content, 0, $poz[1][1] - 1 ) . $tekst . substr( $this->content, $poz[1][2] ); } // end while $this->content = substr( $this->content, 0 ); return true; } // end function parse function allParse( ){ if( isset( $this->fileContent[$this->TplFile] ) ){ $this->content = $this->fileContent[$this->TplFile]; } else{ $this->content = $this->getContent( ); } $this->parse( ); } // end function allParse function blockParse( ){ if( isset( $this->blockContent[$this->TplFile][$this->block] ) ){ $this->content = $this->blockContent[$this->TplFile][$this->block]; } else{ $this->content = $this->getFileBlock( ); if( isset( $this->content ) ){ if( $this->cache == true ){ $this->blockContent[$this->TplFile][$this->block] = $this->content; } } } $this->parse( ); } // end function blockParse function getContent( $bBlock = null ){ if( isset( $this->fileContent[$this->TplFile] ) ){ $mReturn = $this->fileContent[$this->TplFile]; } else{ if( isset( $bBlock ) ){ $mReturn = $this->getFile( $this->TplFile ); } else{ $mReturn = $this->getFile( $this->TplFile ); } if( $this->cache == true ) $this->fileContent[$this->TplFile] = $mReturn; } return $mReturn; } // end function getContent function getFile( $sFile ){ $rFile = fopen( $sFile, 'r' ); $iSize = filesize( $sFile ); if( $iSize > 0 ) $sContent = fread( $rFile, $iSize ); else $sContent = null; fclose( $rFile ); return ' '.$sContent; } // end function getFile function getFileBlock( $sFile = null, $sBlock = null ){ if( isset( $sFile ) && isset( $sBlock ) ){ $this->setFile( $sFile ); $this->setBlock( $sBlock ); } $sFile = $this->getContent( true ); $iStart = strpos( $sFile, $this->startBlock.$this->block.$this->endBlockLine ); $iEnd = strpos( $sFile, $this->endBlock.$this->block.$this->endBlockLine ); if( is_int( $iStart ) && is_int( $iEnd ) ){ $iStart += strlen( $this->startBlock.$this->block.$this->endBlockLine ); return ' '.substr( $sFile, $iStart, $iEnd - $iStart ); } else { echo 'No block: <i>'.$this->block.'</i> in file: '.$this->TplFile.' <br />'; return null; } } // end function getFileBlock function getFileArray( $sFile ){ return file( $sFile ); } // end function getFileArray function getDir( ){ return $this->directory; } // end function getDir function setDir( $sDir ){ $this->directory = $sDir; } // end function setDir function setFile( $sFile ){ $this->TplFile = $sFile; } // end function setFile function setBlock( $sBlock ){ $this->block = $sBlock; } // end function setBlock }; // end class TplParser ?> Quote Link to comment Share on other sites More sharing options...
br0ken Posted June 28, 2008 Share Posted June 28, 2008 Hmmm this is quite wierd. The error message states that on conn.php file output has been started on line 1. (output started at /home/scriptsr/public_html/conn.php:1) Try taking session_start() and moving it right below the opening PHP tag like this: <?php session_start(); Quote Link to comment Share on other sites More sharing options...
fullyloaded Posted June 28, 2008 Author Share Posted June 28, 2008 hi ok thanks what i dont understand is i installed the script yesterday and it worked great so i deleted the script and reuploaded it and now im getting that error i even upload a new copy i will try that and let you know if it worked thanks... 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.