Jump to content

headers already sent


Kevinh

Recommended Posts

Hi,

I am having a problem on all my pages that have the session_start() command line

I have been searching for spaces etc before the session command and can't find anything

I am posting two of the pages the seach_results sends data to teh search)add_to_cart page

I am not sure if I am missing something or if there is meta hidden data that I am missing

 

Any help will be appreciated

<?php
session_start();
include 'includes/conn_db.php';
?>
<DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Onecreate</title>
<link rel="stylesheet" type="text/css" href="css/onr.css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

</head>

<body>
<div id="main_top_container">
<table><tr><td><div id="main_top_container_image"></div></td><td style="padding-left:10px"><br /><SCRIPT LANGUAGE="JavaScript"><!--
function PicStrip_DoFSCommand(command, args){
if (command == "status") window.status = args;
}// --></SCRIPT> <SCRIPT LANGUAGE="VBScript"><!--
on error resume next
Sub PicStrip_FSCommand(ByVal command, ByVal args) call PicStrip_DoFSCommand(command, args)
end sub
--></SCRIPT>

<CENTER>

<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
WIDTH="710" HEIGHT="130" id="PicStrip">
<PARAM NAME="flashvars" value="Copyright=(c) Cool Focus [www.coolfocus.com]">
<PARAM NAME="movie" VALUE="PicStrip.swf"> <PARAM NAME="menu" VALUE="false"> <PARAM NAME="quality" VALUE="best"> <PARAM NAME="scale" VALUE="noscale"> <PARAM NAME="salign" VALUE="LT"> <PARAM NAME="bgcolor" VALUE="#FFFFFF"> <PARAM NAME="wmode" VALUE="window"> 
<EMBED src="PicStrip.swf" flashvars="Copyright=(c) Cool Focus [www.coolfocus.com]" menu="false" quality="best" scale="noscale" salign="LT" BGCOLOR="#FFFFFF"  WMODE="window" WIDTH="710" HEIGHT="130" SWLIVECONNECT="TRUE" NAME="PicStrip" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
</OBJECT>

</CENTER>
</td></tr></table>


<table style="background-color:#cbd4db;width:1000px;height:30px;padding:0px 0px 0px 0px"><tr><td><script type='text/javascript' src='exmplmenu_var.js'></script><script type='text/javascript' src='menu_com.js'></script></td><td>
<div id="menu_bar_text">Feel Free to Browse through our beautiful Collection!</div>
</td></tr></table><!--<div id="nav_ctr">-->


<!--</div>--><!--</div>
--><div id="contact_bottom_container"><div id="main_text"><p></p>
<?php
$search_result = $_POST['search'];
$nr = 'No Result';

	$query = "SELECT * from products WHERE Prod_name LIKE '%$search_result%'";

$result = mysql_query($query, $conn);
	while ($row = mysql_fetch_assoc($result)){
	$prodid = $row["Prod_id"];
	$prodid = $row["Prod_id"];
	$prodimage = $row["image_name"];
	$prodname = $row["Prod_name"];
	$text = $row["Text"];
	$_18ct_yellow_gold_out = $row["18ct_yellow_gold"];
	$_18ct_yellow_gold_price_out = $row["18ct_yellow_gold_price"];
	$_18ct_white_gold_out = $row["18ct_white_gold"];
	$_18ct_white_gold_price_out = $row["18ct_white_gold_price"];
	$_9ct_yellow_gold_out = $row["9ct_yellow_gold"];
	$_9ct_yellow_gold_price_out = $row["9ct_yellow_gold_price"];
	$_9ct_white_gold_out = $row["9ct_white_gold"];
	$_9ct_white_gold_price_out = $row["9ct_white_gold_price"];
	$silver_out = $row["silver"];
	$silver_price_out = $row["silver_price"];
	$pewter_out = $row["pewter"];
	$pewter_price_out = $row["pewter_price"];
	$platinum_out = $row["platinum"];
	$platinum_price_out = $row["platinum_price"];
    $final_text = 'text/' . $text;
		 
?>

<table style="background-color:#e6dbcc"><tr>
<td style="padding-bottom:10px;padding-left:10px;text-align:center">
<font size=2 face=tahoma>
    <b>
    <?php print $prodname ?>
	    </b>
				</font><br />
<img border="2" bordercolor="black" align="left" src="images/<?php print $prodimage ?>"><!--<img src="images/white.jpg" border="0" alt="" align="left">--></td><td>

<?php
$query1 = "SELECT * from admin";
$result1 = mysql_query($query1, $conn);
while ($row1 = mysql_fetch_assoc($result1)){
    $admintel = $row1["Telephone"];
    $adminmail = $row1["email"];
    }
?>
<font face="tahoma" size="2">
<?php 
if ($text != '') { 

readfile( $final_text ); /* int readfile(string filename [, bool use_include_path [, resource context] ] ) */  
}
?><br /><br />



<!--<?php
if ($_18ct_yellow_gold_out == '1' ) {
echo "18 ct Solid Yellow Gold R $_18ct_yellow_gold_price_out <br />";
}
if ($_18ct_white_gold_out == '1' ) {
echo " 18 ct Solid White Gold R $_18ct_white_gold_price_out <br />";
}
if ($_9ct_yellow_gold_out == '1' ) {
echo " 9ct Solid Yellow Gold R $_9ct_yellow_gold_price_out <br />";
}
if ($_9ct_white_gold_out == '1' ) {
echo " 9ct Solid Yellow Gold R $_9ct_white_gold_price_out <br />";
}
if ($silver_out == '1' ) {
echo " Solid Silver R  $silver_price_out <br />";
}
if ($pewter_out == '1' ) {
echo " Pewter R  $pewter_price_out <br />";
}
if ($platinum_out == '1' ) {
echo " Platinum R $platinum_price_out";
}
?>-->



<FORM action="search_add_to_cart.php?prodid=<?php print $prodid ?>" method="post" >
<input type="hidden" name="product" value="<?php print $prodname ?> Charm">
<SELECT name="metal">
<?php
print <<<op3
<OPTION value="$_9ct_yellow_gold_price_out">9ct Solid Yellow Gold (R $_9ct_yellow_gold_price_out)</option>
op3;
print <<<op5
<OPTION value="$silver_price_out">Silver (R $silver_price_out)</option>
op5;
?>
 </SELECT>     
<select name="qty">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>      
<INPUT type="submit" name="submit" value="Order Product">
</FORM>
</tr></table><br />
<?php
}
ob_end_clean();
?>
</font>

</div></div><br /><br /><br /><br />
<div id="main_bg_bottom"><div style="margin-left:60px;font-family:Arial, Helvetica, sans-serif;font-size:11px;color:#666666;margin-top:50px;display:block"><br /><br />Copyright © 2015 Onecreate </div><div style="float: right;margin-right:46px;;font-family:Arial, Helvetica, sans-serif;font-size:11px;color:#666666;display:inline-block;margin-top:-47px">Website designed and developed by <a href="http://www.it-people.co.za" target="_blank"><img src="images/itp_logo.png" alt="IT People" style="margin-top:10px;width:78px;height:35px" /></a></div></div>
</body>
</html>
<?php
session_start();
include 'includes/conn_db.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Onecreate</title>
<link rel="stylesheet" type="text/css" href="css/onr.css" />
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

</head>

<body>
<div id="main_top_container">
<table><tr><td><div id="main_top_container_image"></div></td><td style="padding-left:10px"><br /><SCRIPT LANGUAGE="JavaScript"><!--
function PicStrip_DoFSCommand(command, args){
if (command == "status") window.status = args;
}// --></SCRIPT> <SCRIPT LANGUAGE="VBScript"><!--
on error resume next
Sub PicStrip_FSCommand(ByVal command, ByVal args) call PicStrip_DoFSCommand(command, args)
end sub
--></SCRIPT>

<CENTER>

<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
WIDTH="710" HEIGHT="130" id="PicStrip">
<PARAM NAME="flashvars" value="Copyright=(c) Cool Focus [www.coolfocus.com]">
<PARAM NAME="movie" VALUE="PicStrip.swf"> <PARAM NAME="menu" VALUE="false"> <PARAM NAME="quality" VALUE="best"> <PARAM NAME="scale" VALUE="noscale"> <PARAM NAME="salign" VALUE="LT"> <PARAM NAME="bgcolor" VALUE="#FFFFFF"> <PARAM NAME="wmode" VALUE="window"> 
<EMBED src="PicStrip.swf" flashvars="Copyright=(c) Cool Focus [www.coolfocus.com]" menu="false" quality="best" scale="noscale" salign="LT" BGCOLOR="#FFFFFF"  WMODE="window" WIDTH="710" HEIGHT="130" SWLIVECONNECT="TRUE" NAME="PicStrip" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
</OBJECT>

</CENTER>
</td></tr></table>


<table style="background-color:#cbd4db;width:1000px;height:30px;padding:0px 0px 0px 0px"><tr><td><script type='text/javascript' src='exmplmenu_var.js'></script><script type='text/javascript' src='menu_com.js'></script></td><td>
<div id="menu_bar_text">Feel Free to Browse through our beautiful Collection!</div>
</td></tr></table><!--<div id="nav_ctr">-->


<!--</div>--><!--</div>
--><div id="main_products_container"><div id="main_text" ><?php
   
	/*$catid_out = $_GET['catid'];
	if (!preg_match("/^[0-9]{1,3}$/", $catid_out)) die("Bad product, please re-enter.");
*/	
	/*$query_cat = "SELECT * from categories WHERE cat_id = '$catid_out'";
	$result_cat = mysql_query($query_cat, $conn);
	while ($row_cat = mysql_fetch_assoc($result_cat)){
	$category_out = $row_cat["category"];
	$main_cat_id_out = $row_cat["main_cat_id"];
	}
	$query_cat = "SELECT * from main_cats WHERE main_cat_id = '$main_cat_id_out'";
	$result_cat = mysql_query($query_cat, $conn);
	while ($row_cat = mysql_fetch_assoc($result_cat)){
	$main_category_out = $row_cat["category"];
	$main_cat_id_out = $row_cat["main_cat_id"];
	}*/

	

$prodid_out= $_GET['prodid'];
if (!preg_match("/^[0-9]{1,3}$/", $prodid_out)) die("Bad product, please re-enter.");
$metal_out = $_POST['metal'];
$qty_out= $_POST['qty'];
if (!preg_match("/^[0-9]{1,3}$/", $qty_out)) die("Bad product, please re-enter.");

$_SESSION['prodid'] = $prodid_out;	
	
$query_prod_detail = "SELECT * FROM products WHERE prod_id = '$prodid_out'"; // display the products in each subcat
	 
	 	$result_prod_detail = mysql_query($query_prod_detail, $conn);
		while ($row_prod_detail = mysql_fetch_assoc($result_prod_detail)){
		$Prod_name_out = $row_prod_detail["Prod_name"];
		$prod_type_out = $row_prod_detail["prod_type"];
		$final_prod =  $Prod_name_out . ' (' . $prod_type_out . ')';
    	}
    	
    	// Set order number
    	if (!isset($_SESSION['refno'])) {
	 
	 	$query4 = "SELECT * FROM ref_no ORDER BY reference ASC"; // display the products in each subcat
	 
	 	$result4 = mysql_query($query4, $conn);
		while ($row4 = mysql_fetch_assoc($result4)){
		$reference_out = $row4["reference"];
		$final_ref = $reference_out + 1;
		$_SESSION['refno'] = $final_ref;
			$query_ref_no = "INSERT INTO ref_no (reference, date) VALUES ('$final_ref', CURDATE())";
			 $result_ref_no = mysql_query($query_ref_no);
	}
	
	}
	
	$final_ref = $_SESSION['refno'];
	
     if (is_numeric ($_SESSION['prodid'])) { // check for a print id


    $pid = $_SESSION['prodid'];
    	
    $query4 = "SELECT * from line_items WHERE ref_no = '$final_ref' AND prod_code = '$pid'"; // display the products in each subcat
		$result4 = mysql_query($query4, $conn);
		
		$num_rows = mysql_num_rows($result4);


    
     $query_add_item = "INSERT INTO line_items (ref_no, prod_code, unit_qty, prod_name, prod_price) VALUES ('$final_ref', '$pid', '$qty_out', '$final_prod', '$metal_out')";
 $result_add_item = mysql_query($query_add_item);

      
        // check to see if the cart already contains one of these products
       /* if (isset ($_session['cart'][$pid])) {
        $qty_out = $_SESSION['cart'][$pid] + $qty1;
        
        } else {
        $qty = $qty1;
        }
        
        
		

        // add to the cart session variable
        $_SESSION['cart'][$pid] = $qty;
*/        
        
        // Display a message
        
                        
        echo '                        <table border="0" width="400" cellpadding="3" style="border: thin black double;margin-left:200px;margin-top:55px"><tr><td>
';
        echo '<p><font face="arial" size="2" style="margin-left: 10px">Your product has been added to your cart<br>To continue purchasing please make use of the Charms and Pendants navigation buttons</font><form action="view_cart.php" method="post"><input type="submit" name="view_barrel" value="View Cart" style="margin-left: 20px"></form></td></tr></table>';
        
}
?></div></div>


<div id="main_bg_bottom"><div style="margin-left:60px;font-family:Arial, Helvetica, sans-serif;font-size:11px;color:#666666;margin-top:50px;display:block"><br /><br />Copyright © 2015 Onecreate </div><div style="float: right;margin-right:46px;;font-family:Arial, Helvetica, sans-serif;font-size:11px;color:#666666;display:inline-block;margin-top:-47px">Website designed and developed by <a href="http://www.it-people.co.za" target="_blank"><img src="images/itp_logo.png" alt="IT People" style="margin-top:10px;width:78px;height:35px" /></a></div></div>
</div>
</div>
</body>
</html>
Link to comment
Share on other sites

if the error message, which you didn't post, states that there's output on line 1 of your file, but you don't have anything in your file before the <?php tag that's on line 1, your files have likely been saved by your programming editor with the BOM (Byte Order Mark) characters as part of the file. save you file without the BOM characters. there's usually a character encoding setting in your programming editor to do this.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.