Jump to content

[SOLVED] Help with coding php here :)


gameduels

Recommended Posts

Im making a shopping cart in PHP for my web site. I get this error and i cant figure it out .

 

 

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/dtecneon/public_html/newsite/store.php:6) in /home/dtecneon/public_html/newsite/library/config.php on line 2

 

 

 

 

 

If i take the Session_start() out of the config i cant log into the Admin panel of the shopping chart....

 

 

 

Here is my Config:

 

LINE 2 is after <?php

 

 

 


<?php

session_start();

ini_set('display_errors', 'On');



//ob_start("ob_gzhandler");

error_reporting(E_ALL);



// database connection config



$dbHost = 'localhost';

$dbUser = 'dtecneon920_1022';

$dbPass = 'ymd920894s';

$dbName = 'dtecneon920_cart22222';



// setting up the web root and server root for

// this shopping cart application



$thisFile = str_replace('\\', '/', __FILE__);

$docRoot = $_SERVER['DOCUMENT_ROOT'];

$webRoot  = str_replace(array($docRoot, 'library/config.php'), '', $thisFile);

$srvRoot  = str_replace('library/config.php', '', $thisFile);

define('WEB_ROOT', $webRoot);

define('SRV_ROOT', $srvRoot);



// these are the directories where we will store all

// category and product images



define('CATEGORY_IMAGE_DIR', 'images/category/');

define('PRODUCT_IMAGE_DIR',  'images/product/');



// some size limitation for the category

// and product images

// all category image width must not 

// exceed 75 pixels



define('MAX_CATEGORY_IMAGE_WIDTH', 75);



// do we need to limit the product image width?

// setting this value to 'true' is recommended



define('LIMIT_PRODUCT_WIDTH',     true);



// maximum width for all product image



define('MAX_PRODUCT_IMAGE_WIDTH', 300);



// the width for product thumbnail



define('THUMBNAIL_WIDTH',         75);

if (!get_magic_quotes_gpc()) {

if (isset($_POST)) {

  foreach ($_POST as $key => $value) {

   $_POST[$key] =  trim(addslashes($value));

  }

}



if (isset($_GET)) {

  foreach ($_GET as $key => $value) {

   $_GET[$key] = trim(addslashes($value));

  }

} 

}

// since all page will require a database access

// and the common library is also used by all

// it's logical to load these library here



require_once 'database.php';

require_once 'common.php';



// get the shop configuration ( name, addres, etc ), all page need it

$shopConfig = getShopConfig();

?>

 

 

 

 

 

Thanks,

 

Cody.

 

Happy New Year :)

Link to comment
https://forums.phpfreaks.com/topic/83945-solved-help-with-coding-php-here/
Share on other sites

The Store.php thats what i mean im sorry not the index.php its showing the error in store.php. Down blow is the store php

 

<TITLE>Neon Dtec Equipment.</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<link href="images/css.css" rel="stylesheet" type="text/css">
<?php
require_once 'library/config.php';
require_once 'library/category-functions.php';
require_once 'library/product-functions.php';
require_once 'library/cart-functions.php';

$_SESSION['shop_return_url'] = $_SERVER['REQUEST_URI'];

$catId  = (isset($_GET['c']) && $_GET['c'] != '1') ? $_GET['c'] : 0;
$pdId   = (isset($_GET['p']) && $_GET['p'] != '') ? $_GET['p'] : 0;

?>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
</HEAD>
<BODY BGCOLOR=#CC0F0F LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<!-- ImageReady Slices (1_home.psd) -->
<TABLE WIDTH=766 BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<TD COLSPAN=11>
<IMG SRC="images/index_01.jpg" WIDTH=766 HEIGHT=63 ALT=""></TD>
</TR>
<TR>
<TD ROWSPAN=7>
<IMG SRC="images/index_02.jpg" WIDTH=73 HEIGHT=637 ALT=""></TD>
<TD COLSPAN=9>
<IMG SRC="images/index_03.jpg" WIDTH=625 HEIGHT=122 ALT=""></TD>
<TD ROWSPAN=7>
<IMG SRC="images/index_04.jpg" WIDTH=68 HEIGHT=637 ALT=""></TD>
</TR>
<TR>
<TD ROWSPAN=4>
<IMG SRC="images/index_05.jpg" WIDTH=10 HEIGHT=451 ALT=""></TD>
<TD>
  <a href="Home.php"><IMG SRC="images/menu_01.jpg" ALT="" WIDTH=109 HEIGHT=22 border="0"></a></TD>
<TD>
  <a href="pro.php"><IMG SRC="images/menu_02.jpg" ALT="" WIDTH=86 HEIGHT=22 border="0"></a></TD>
<TD COLSPAN=2>
  <a href="howto.php"><IMG SRC="images/menu_03.jpg" ALT="" WIDTH=109 HEIGHT=22 border="0"></a></TD>
<TD>
  <a href="support.php"><IMG SRC="images/menu_04.jpg" ALT="" WIDTH=124 HEIGHT=22 border="0"></a></TD>
<TD>
  <a href="contact.php"><IMG SRC="images/menu_05.jpg" ALT="" WIDTH=93 HEIGHT=22 border="0"></a></TD>
<TD>
  <a href="links.php"><IMG SRC="images/menu_06.jpg" ALT="" WIDTH=83 HEIGHT=22 border="0"></a></TD>
<TD ROWSPAN=4>
<IMG SRC="images/index_12.jpg" WIDTH=11 HEIGHT=451 ALT=""></TD>
</TR>
<TR>
<TD width="604" height="378" COLSPAN=7 align="left" valign="top" nowrap background="images/index_13.jpg"> 
  <div align="center"><br>
    <?php
require_once 'include/leftNav.php';
?>
    <br>
    <?php
if ($pdId) {
require_once 'include/productDetail.php';
} else if ($catId) {
require_once 'include/productList.php';
} else {
require_once 'include/categoryList.php';
}
?><br>
      <br>
  </div></TD>
</TR>
<TR>
<TD COLSPAN=7>
<IMG SRC="images/index_14.jpg" WIDTH=604 HEIGHT=32 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=3>
<IMG SRC="images/index_15.jpg" WIDTH=211 HEIGHT=19 ALT=""></TD>
<TD COLSPAN=2>
  <a href="copyright.php"><IMG SRC="images/index_16.jpg" ALT="" WIDTH=217 HEIGHT=19 border="0"></a></TD>
<TD COLSPAN=2>
<IMG SRC="images/index_17.jpg" WIDTH=176 HEIGHT=19 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=9>
<IMG SRC="images/index_18.jpg" WIDTH=625 HEIGHT=9 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=9>
<IMG SRC="images/index_19.jpg" WIDTH=625 HEIGHT=55 ALT=""></TD>
</TR>
<TR>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=73 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=10 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=109 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=86 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=16 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=93 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=124 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=93 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=83 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=11 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=68 HEIGHT=1 ALT=""></TD>
</TR>
</TABLE>

There you have it. This is being outputted before you start the session:

<TITLE>Neon Dtec Equipment.</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<link href="images/css.css" rel="stylesheet" type="text/css">

 

To fix this, I suggest adding the "session_start" on the top of this page or better yet, if all the library files don't output something, put them at the top of the page instead:

 

<?php
require_once 'library/config.php';
require_once 'library/category-functions.php';
require_once 'library/product-functions.php';
require_once 'library/cart-functions.php';
?>
<TITLE>Neon Dtec Equipment.</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<link href="images/css.css" rel="stylesheet" type="text/css">
<?php
$_SESSION['shop_return_url'] = $_SERVER['REQUEST_URI'];

$catId  = (isset($_GET['c']) && $_GET['c'] != '1') ? $_GET['c'] : 0;
$pdId   = (isset($_GET['p']) && $_GET['p'] != '') ? $_GET['p'] : 0;

?>
<style type="text/css">
...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.