1.11M Members

reg warning plz help me.... thanks in advance

 
0
 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\trail\index.php:1) in C:\xampp\htdocs\trail\index.php on line 2

whenever i run this file.... i will get a warning like this... i will attach the login page... after i will logged in i will get this same warning....

i am new to php.... pls help me.......

i gave the pages... with CSS.............

// index.php
<?php
session_start();
ob_start();
?>
<!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=utf-8" />
<title>Book Store Template, Free CSS Template, CSS Website Layout</title>
<meta name="keywords" content="Book Store Template, Free CSS Template, CSS Website Layout, CSS, HTML" />
<meta name="description" content="Book Store Template, Free CSS Template, Download CSS Website" />
<link href="book_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!--  Free CSS Templates from www.book.com -->
<div id="book_container">
<div id="book_menu">
<ul>
<li>
<?php
//echo $_SESSION['username'];
if(!empty($_SESSION['username']))

echo '<lil><a href="logout.php">Logout</a></lil>';
echo '<lil><a href="order_tracking.php">Tracking</a></lil>';
echo '<lil>Welcome  '.$_SESSION['username'].'</lil>';
}
if(empty($_SESSION['username']))
{
            echo '<li><a href="admin.php">Admin</a></li>';
            echo '<lil><a href="#">Contact</a></lil>';
            echo '<lil><a href="login.php">Login</a></lil>';
            echo '<lil><a href="register.php">Register</a></lil>';
            echo '<lil><a href="index.php" class="current">Home</a></lil>';

}
?>
    </li>
        </ul>
    </div>
    <div id="book_header">
        <div id="book_special_offers">
            <p>
                <span>25%</span> discounts for
        purchase over $80
            </p>
            <a href="subpage.html" style="margin-left: 50px;">Read more...</a>
        </div>


        <div id="book_new_books">
            <ul>
                <li>Suspen disse</li>
                <li>Maece nas metus</li>
                <li>In sed risus ac feli</li>
            </ul>
            <a href="subpage.html" style="margin-left: 50px;">Read more...</a>
        </div>
    </div> <!-- end of header -->

    <div id="book_content">

        <div id="book_content_left">
            <div class="book_content_left_section">
                <h1>Categories</h1>
                <ul>
                    <li><a href="c.php">C language</a></li><br /><br />
                    <li><a href="C++.php">C++</a></li></li><br /><br />
                    <li><a href="java.php">JAVA</a></li></li><br /><br />
                    <li><a href="net.php"> .NET</a></li></li><br /><br />
                    <li><a href="php.php">PHP</a></li></li><br /><br />
            <li><a href="j2e.php">J2E</a></li></li><br /><br />
                <li><a href="perl.php">PERl</a></li></li><br /><br />
                    <li><a href="python.php">PYTHON</a></li></li><br /><br />
            <li><a href="general.php">GENERAL</a></li></li><br /><br />
                    <li><a href="apptitude.php">APPTITUDE</a></li></li><br /><br />
                </ul>
            </div>


        </div> <!-- end of content left -->

        <div id="book_content_right">
            <div class="book_product_box">
                <h1>Photography  <span>(by Best Author)</span></h1>
          <img src="images/book_image_01.jpg" alt="image" />
                <div class="product_info">
                    <p>Etiam luctus. Quisque facilisis suscipit elit. Curabitur...</p>
                  <h3>$55</h3>
                    <div class="buy_now_button"><a href="addtocart.php?i=1">Add Cart</a></div>
                    <div class="detail_button"><a href="subpage.html">Detail</a></div>
                </div>
                <div class="cleaner"> </div>
            </div>

            <div class="cleaner_with_width"> </div>

            <div class="book_product_box">
                <h1>Cooking  <span>(by New Author)</span></h1>
            <img src="images/book_image_02.jpg" alt="image" />
                <div class="product_info">
                    <p>Aliquam a dui, ac magna quis est eleifend dictum.</p>
                    <h3>$35</h3>
                    <div class="buy_now_button"><a href="subpage.html">Buy Now</a></div>
                    <div class="detail_button"><a href="subpage.html">Detail</a></div>
                </div>
                <div class="cleaner"> </div>
            </div>

            <div class="cleaner_with_height"> </div>

            <div class="book_product_box">
                <h1>Gardening <span>(by Famous Author)</span></h1>
          <img src="images/book_image_03.jpg" alt="image" />
                <div class="product_info">
                    <p>Ut fringilla enim sed turpis. Sed justo dolor, convallis at.</p>
                    <h3>$65</h3>
                    <div class="buy_now_button"><a href="addtocart.php?i=3">Add Cart</a></div>
                    <div class="detail_button"><a href="subpage.html">Detail</a></div>
                </div>
                <div class="cleaner"> </div>
            </div>

            <div class="cleaner_with_width"> </div>

            <div class="book_product_box">
                <h1>Sushi Book  <span>(by Japanese Name)</span></h1>
                <img src="images/book_image_04.jpg" alt="image" />
                <div class="product_info">
                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p>
                    <h3>$45</h3>
                    <div class="buy_now_button"><a href="subpage.html">Buy Now</a></div>
                    <div class="detail_button"><a href="subpage.html">Detail</a></div>
                </div>
                <div class="cleaner"> </div>
            </div>

            <div class="cleaner_with_height"> </div>

            <a href="subpage.html"><img src="images/book_ad.jpg" alt="ads" /></a>
        </div> <!-- end of content right -->

        <div class="cleaner_with_height"> </div>
    </div> <!-- end of content -->

    <div id="book_footer">

           <p> -------------CONTACT INFO------------</p><br />
        <p>ONLINE BOOK STORE</p><br />
        <p>11A/2, VALLALAR STREET, RAJAPALAYAM</p><br />
        <p>MOBILE NO. 9940839247
            </div> 
    <!-- end of footer -->

</div> <!-- end of container -->
<div align=center><--  DESIGNED BY T SIVAGURUNATHAN --></div></body>
</html>

// login.php

</html><!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=utf-8" />
<title>Book Store Template, Free CSS Template, CSS Website Layout</title>
<meta name="keywords" content="Book Store Template, Free CSS Template, CSS Website Layout, CSS, HTML" />
<meta name="description" content="Book Store Template, Free CSS Template, Download CSS Website" />
<link href="book_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!--  Free CSS Templates from www.book.com -->
<div id="book_container">
    <div id="book_menu">
        <ul>
        <li><a href="subpage.html">Admin</a></lil>
        <lil><a href="#">Contact</a></lil>
        <lil><a href="subpage.html">Login</a></lil>
        <lil><a href="register.php">Register</a></lil>
        <lil><a href="index.php" class="current">Home</a></lil>
        </ul>
    </div> <!-- end of menu -->

    <div id="book_header">
        <div id="book_special_offers">
            <p>
                <span>25%</span> discounts for
        purchase over $80
            </p>
            <a href="subpage.html" style="margin-left: 50px;">Read more...</a>
        </div>


        <div id="book_new_books">
            <ul>
                <li>Suspen disse</li>
                <li>Maece nas metus</li>
                <li>In sed risus ac feli</li>
            </ul>
            <a href="subpage.html" style="margin-left: 50px;">Read more...</a>
        </div>
    </div> <!-- end of header -->

    <div id="book_content">

        <div id="book_content_left">
            <div class="book_content_left_section">
                <h1>Categories</h1>
                <ul>
                    <li><a href="c.php">C language</a></li><br /><br />
                    <li><a href="C++.php">C++</a></li></li><br /><br />
                    <li><a href="java.php">JAVA</a></li></li><br /><br />
                    <li><a href="net.php"> .NET</a></li></li><br /><br />
                    <li><a href="php.php">PHP</a></li></li><br /><br />
            <li><a href="j2e.php">J2E</a></li></li><br /><br />
                <li><a href="perl.php">PERl</a></li></li><br /><br />
                    <li><a href="python.php">PYTHON</a></li></li><br /><br />
            <li><a href="general.php">GENERAL</a></li></li><br /><br />
                    <li><a href="apptitude.php">APPTITUDE</a></li></li><br /><br />
                </ul>
            </div>


        </div> <!-- end of content left -->

        <div id="book_content_right">
    <div class="table_content">
        <form action='login1.php' method='POST'>
            <table align="center">
        <tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>
        <tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>
            <tr>
                <td colspan="3" align="center">
                    <h1>Login Form</h1>
                </td>
            </tr>
            <tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>
        <tr>
        <td >
        <font size="2">
                       <b>ENTER UR NAME</b>
         </font>
                </td>
        <td>
                       <b>:</b>
                </td>
                <td>
                      <input type="text" name="username" />
                </td>
             </tr>

            <tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>
        <tr>
        <td >
        <font size="2">
                       <b>ENTER UR MAIL ID</b>
         </font>
                </td>
        <td>
                       <b>:</b>
                </td>
                <td>
                      <input type="text" name="mailid" />
                </td>
             </tr>

            <tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>
             <tr>
                <td >
        <font size="2">
                       <b>ENTER UR PASSWORD</b>
         </font>
                </td>
                <td>
                        <b>:</b>
                </td>
                <td>
                        <input type="password" name="password" />
                </td>
             </tr>
        <tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>
         <tr>
         <td align="center" colspan="3">
                     <input type="submit" value="Login" />
                 </td>
             </tr>
<tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>
<tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>
<tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>     </table>
        </form>



            <a href="subpage.html"><img src="images/book_ad.jpg" alt="ads" /></a>
            </div>
        </div> <!-- end of content right -->

        <div class="cleaner_with_height"> </div>
    </div> <!-- end of content -->

    <div id="book_footer">
    <p> -------------CONTACT INFO------------</p><br />
    <p>ONLINE BOOK STORE</p><br />
    <p>11A/2, VALLALAR STREET, RAJAPALAYAM</p><br />
    <p>MOBILE NO. 9940839247
    </div>
    <!-- end of footer -->
<div align=center><--  DESIGNED BY T SIVAGURUNATHAN --></div></body>
</html>

//login1.php

<?php
ob_start();
session_start();
if(isset ($_POST['username']) || isset ($_POST['mailid']) || isset ($_POST['password']))
{
$username = $_POST['username'];
$mailid = $_POST['mailid'];
$password = $_POST['password'];
$encrypt_password=md5($password);
if ( !empty ($username) && !empty($password) && !empty($mailid))
{

  $connect = mysql_connect("localhost","root", "shivaaa") or die("Couldn't connect!!");
  mysql_select_db("phplogin")or die("Couldn't find db");

  $query=mysql_query("SELECT * FROM users WHERE mailid='$mailid' AND password='$encrypt_password'");

  $numrows = mysql_num_rows($query);

  if($numrows!=0)
  {
  while($values=mysql_fetch_assoc($query))
  {

        $dbmailid=$values['mailid'];
        $dbpassword=$values['password'];
            if($mailid==$dbmailid && $encrypt_password==$dbpassword)
        {
                 //echo "you are in!!! ";
                 $_SESSION['username']=$username;
                 $_SESSION['mailid']=$mailid;
                 //echo $_SESSION['username'];
         $url="index.php";
         header("refresh: 2; url=$url");
         ob_start();
                }
            else
                {
                 echo "Incorrect password!!!";
                }
  }
}
}
else
    die("Please enter the username and password");
}
?>



//css............
body {
    margin: 0;
    padding: 0;
    line-height: 1.5em;
    font-family: Verdana, Arial, san-serif;
    font-size: 11px;
    color: #ffffff;
    background: #4b4743;
}

a:link, a:visited { color: #e6e154; text-decoration: none; font-weight: bold;} 
a:active, a:hover { color: #e6e154; text-decoration: underline;}

p {
    margin: 0px;
    padding: 0px;
}

img {
    margin: 0px;
    padding: 0px;
    border: none;
}


.cleaner {
    clear: both;
    width: 100%;
    height: 1px;
    font-size: 1px; 
}

.cleaner_with_height {
    clear: both;
    width: 100%;
    height: 30px;
    font-size: 1px; 
}

.cleaner_with_width {
    float: left;
    width: 20px;
    height: 30px;
    font-size: 1px; 
}

.buy_now_button a{
    clear: both;
    text-align: center;
    display: block;
    width: 100px;
    padding: 4px 0 5px 0;
    margin-bottom: 10px; 
    background: url(images/book_btn_02.jpg) no-repeat;
    color: #FFFFFF;
    font-weight: bold;
    text-decoration: none;
}

.detail_button a{
    clear: both;
    text-align: center;
    display: block;
    width: 100px;
    padding: 4px 0 5px 0;
    margin-bottom: 10px; 
    background: url(images/book_btn_01.jpg) no-repeat;
    color: #ffffff;
    font-weight: bold;
    text-decoration: none;
}

#book_container{
    width: 960px;
    margin: 0 auto;
    padding: 0 10px;
    background: #1c1c1b url(images/book_bg.jpg) repeat-y;
}


/* menu */

#book_menu {
    clear: both;
    width: 960px;
    height: 45px;
    background: url(images/book_menu_bg.jpg) no-repeat;
}

#book_menu ul {
    padding: 13px 0 0 0;
    margin: 0;
    list-style: none;
}

#book_menu ul li{
    display: inline;
}

#book_menu ul li a{
    float: left;
    padding: 0 20px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    color: #969547;
}

#book_menu ul lil a{
    float: right;
    padding: 0 20px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    color: #969547;
}

#book_menu li a:hover, #book_menu li .current{
    color: #fcf88e;
}

/* end of menu*/

/* header */
#book_header {
    clear: both;
    width: 960px;
    height: 285px;
    padding: 0;
    margin: 0;
    background: url(images/book_header_bg.jpg) no-repeat;
}

#book_header a,a:hover {
    color: #ffffff;
}

#book_header #book_special_offers {
    float: left;
    font-size: 14px;    
    margin-top: 95px;
    margin-left: 490px;
    width: 180px;
}

#book_special_offers a {
    font-size: 12px;
}

#book_special_offers  p {
    margin: 0 0 20px 0;
}
#book_special_offers p span {
    font-size: 18px;
}

#book_header #book_new_books {
    float: left;
    margin-top: 90px;   
    margin-left: 55px;
    width: 180px;
}

#book_new_books ul {
     margin: 0 0 10px 0;
     padding: 0 0 0 20px;
}

#book_new_books li {
     margin: 0;
     padding: 0; 
}


/* end of header */


/* content */
#book_content {
    clear: both;
    width: 920px;
    padding: 0 20px;
}

#book_content #book_content_left {
    float: left;
    width: 188px;
    padding: 10px;
    background-color: #171716;
    border: 1px solid #212120;
}

#book_content #book_content_right {
    float: right;
    width: 670px;
}


#book_content_left .book_content_left_section{
    clear: both;
    padding-bottom: 10px;
    border-bottom: 1px solid #2b2b2a;
    margin-bottom: 20px;
}

.book_content_left_section h1 {
    font-size: 20px;
    color: #cbc750;
    padding: 0 0 5px 0;
    margin: 0 0 10px 0;
    border-bottom: 1px dotted #cbc750;
}

.book_content_left_section ul {
    padding: 0;
    margin: 0;
}

.book_content_left_section ul li{
    padding: 0 0 3px 10px;  
    list-style: none;
}

.book_content_left_section ul li a{
    font-size:20px;
    font-weight: normal;
    text-decoration: none;
    color: #969547;
}

.book_content_left_section li a:hover, .book_content_left_section li .current{
    color: #fcf88e;
}





#book_content_right .book_product_box {
    float: left;
    width: 303px;
    height: 210px;
    padding: 10px;
    border: 1px solid #333;
}

#book_content_right h1 {
    padding: 10px;
    margin: 0 0 20px 0;
    font-size: 15px;
    color: #cbc750;
    background: url(images/book_h1_bg.jpg);
}

#book_content_right h2 {
    padding: 0 0 0 0;
    margin: 0 0 20px 0;
    font-size: 12px;
    color: #e6e154;
}

#book_content_right h3 {
    padding: 0;
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #85391f;
}

#book_content_right ul {
    margin: 0 0 20px 0;
    padding: 0 0 0 20px;
    list-style: none;
}

#book_content_right li {
    padding: 0 0 3px 0;
}

#book_content_right .image_panel {
    float: left;
    width: 100px;
    margin-right: 20px;
}

#book_content_right p {
    text-align: justify;
    padding: 0 0 8px 0;
}

.book_product_box h1 span {
    font-weight: normal;
}

.book_product_box img {
    float: left;
    margin-right: 20px;
}

.book_product_box .product_info {
    float: left;
    width: 180px;
}

.product_info p {
    margin-bottom: 15px;
}

/* end of content */

/* footer */
#book_footer {
    clear: both;
    width: 960px;
    padding: 20px 0px 20px 0;
    text-align: center;
    border-top: 1px solid #25211e;
    color: #999;
    background-color: #111110;
}

#book_footer a{
    color: #fff;
    font-weight: normal;
}
/* end of footer */


.table_content h1 {
    font-size: 20px;
    color: #cbc750;
    padding: 0 0 5px 0;
    margin: 0 0 10px 0;
}
LastMitch
Deleted Member
 
0
 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\trail\index.php:1) in C:\xampp\htdocs\trail\index.php on line 2

It means you already send your header 2 times meaning this session_start();.

It should be only 1 session_start();.

It has nothing to do with the CSS file.

I'm not sure why you post it.

 
1
 

The trouble is in your first line:

// index.php
<?php
session_start();
ob_start();
?>

You use php comment outside of <?php ?> block so it is not treated as php code but as html code. That means that you send html before calling session_start() and ob_start() which is incorrect since both functions have to be started before ANY output is sent. Simply remove the first line or put it within a <?php ?> block.

<?php
// index.php
session_start();
ob_start();
?>
 
0
 

my coding starts frm <?php.....
i just differentiate for u... thats y i started with // index page... its not in my coding....

 
0
 

OK. There are two things that vome to my mind:

  • there is some outbut (mybe a space or newline) before session_start(). Make sure session_start() on the very top of the script and nothing else is before it.
  • your php.ini has session.cache_limiter set up incorrectly, try setting it to:

    session.cache_limiter = public

(found this on google, not sure if it solves the problem of yours)

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article