Jump to content

Headers Already Sent


csmcgoo

Recommended Posts

I have a form as a php include and it's giving me this error:

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/altimusw/public_html/www.csmsolution.com/register.php:6) in /home/altimusw/public_html/www.csmsolution.com/core.php on line 17

 

Here is the main page that includes the php include:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>CSM Solution </title>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
left:100px;
top:70px;
width:800;
height:62px;
z-index:1;
}
.style1 {
font-family: Arial, Helvetica, sans-serif;
color: #535959;
font-size: 12px;
}
-->
</style>
</head>
<body>
<div id="Layer1">
  <table width="800" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td height="97"><img src="images/header.jpg" width="800" height="59" border="0" usemap="#Map" /><br />
      <img src="images/navbar.jpg" width="800" height="38" border="0" usemap="#Map2" />
      <map name="Map2" id="Map2">
        <area shape="rect" coords="506,1,552,26" href="contact.php" /><area shape="rect" coords="459,1,502,26" href="form.php" /><area shape="rect" coords="396,-1,455,25" href="login.php" />
        <area shape="rect" coords="357,0,393,26" href="index.php" />
      </map>
      </td>
    </tr>
    <tr>
      <td><img src="images/welcome_img.jpg" width="131" height="21" /></td>
    </tr>
    <tr>
      <td><?php include("form.php"); ?></td>
    </tr>
    <tr>
      <td><img src="images/placeholderclouds_bottem.jpg" width="800" height="60" /></td>
    </tr>
  </table>
</div>
</body>
</html>

 

Here is the Core.php the error is referring to:

 

<?php
//CSM Solution Core. Rahul Parkar 2010
$_config = array();
$_config['db_type'] = "mysql";
$_config['db_server'] = "localhost";
$_config['db_username'] = "altimusw_csm";
$_config['db_password'] = ']17=rXh7tJ0~';
$_config['db_database'] = "altimusw_csm";
$_config['db_tbl_prefix'] = '';
$_config['user_table'] = "customers";
$_config['user_username'] = "username";
$_config['user_password'] = "password";
$_config['user_active'] = "approved";
$_config['user_role1'] = "prirole";
$_config['user_role2'] = "secrole";
$_config['pass_hash_func'] = "SHA1";
session_start();

function fetch_row($query)
{
        build_connection($db);
        sql_exec($db, $query, $result);
        sql_fetchone($result, $row);
        finish_connection($db);
        return $row;
}

function build_connection(&$db)
{
global $_config;
if ($_config['db_type'] == "mysql")
{
	$db = mysql_connect($_config['db_server'], $_config['db_username'], $_config['db_password']) or die(mysql_error());
	mysql_select_db($_config['db_database'], $db) or die(mysql_error());
}
}

function sql_exec(&$db, $query, &$result)
{
        global $_config;
        if ($_config['db_type'] == "mysql")
              $result = mysql_query($query, $db) or die(mysql_error() . "/$query");
}

function sql_fetchone(&$result, &$row)
{
global $_config;
      if ($_config['db_type'] == "mysql")
      {
              $row = mysql_fetch_assoc($result);
              @mysql_free_result($result);
      }
}

function sql_do(&$db, $query)
{
global $_config;
sql_exec($db, $query, $noclue);
finish_connection($db);
}

function finish_result(&$result)
{
global $_config;
if ($_config['db_type'] == "mysql")
	@mysql_free_result($result);
}

function finish_connection(&$db)
{
global $_config;
if ($_config['db_type'] == 'mysql')
	mysql_close($db);
}

function check_auth($username, $password)
{
global $_config;
      $row = fetch_row("SELECT `" . $_config['user_active'] . "`, `" . $_config['user_password'] . "`, " . $_config['pass_hash_func'] . "('" . $password . "') AS `passcheck`, `fname`, `lname` FROM `" . $_config['user_table'] . "` WHERE `" . $_config['user_username'] . "`='" . $username . "' LIMIT 1");
      if (!$row[$_config['user_active']]) { return -1; }
      else
      {
              if ($row[$_config['user_active']] != 1) { return -2; }
              else if ($row[$_config['user_password']] == $row['passcheck'])
              {
                      $_SESSION['username'] = $username;
                      $_SESSION['fname'] = $row['fname'];
				  $_SESSION['lname'] = $row['lname'];
                      return 1;
              }
              else
              {
                      return -1;
              }
      }
}

function load_access()
{
global $_config;
        if ($_SESSION['username'])
        {
                $row = fetch_row("SELECT `" . $_config['user_role1'] . "` FROM `" . $_config['user_table'] . "` WHERE `" . $_config['user_username'] . "`='" . $_SESSION['username'] . "' LIMIT 1");
                $role1 = $row[$_config['user_role1']];
                $_SESSION['role1'] = $role1;
        }
        else
        {
                return -1;
        }
}

function has_level()
{
for ($i = 0; $i < func_num_args(); $i++)
{
	if (func_get_arg($i) == $_SESSION['role1']) { return 1; }
}
return 0;
}
?>

 

 

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.