login form

Discussion in 'PHP' started by papyne28, Aug 28, 2009.

  1. #1
    Assist me correct the error...it says:
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Inetpub\wwwroot\46135\DynoLink\support\Activate.php:2) in C:\Inetpub\wwwroot\46135\DynoLink\support\connect.php on line 25
    This is my connect.php:
    <?php
    // connect to the server
    $connect = mysql_connect("192.168.170.15", "46135", "46135");
    // $con = mysql_connect("localhost", "user", "pass");

    //test if the connection was successful
    if(!$connect){
    //display an error message and quit the page if connection failed.
    echo "Server Connection Failed.<br/>";
    echo "Error: <strong>".mysql_error()."</strong><br/>";
    }

    // connect to the database
    $db = mysql_select_db("db46135");
    // $db = mysql_select_db("");

    // test if the database connection was successful
    if(!$connect){
    //display an error message and quit the page if connection failed.
    echo "Database Connection Failed.<br/>";
    echo "Error: <strong>".mysql_error()."</strong><br/>";
    }

    //begins the session on every database connection OR carries forward a session that is already running
    session_start();
    ?>


    and my activate.php:
    <!--connection to the database-->
    <?php

    require_once('connect.php');
    //gets the pin number of the account to be activated that has been passed to the page
    $pin = $_GET['pin'];
    ?>

    <!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 http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>Curios User Activation</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <link href="../default.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <a name = "top">
    <div id="header">
    <h1><a href="#">Curios</a></h1>
    <h2><a href="#">ONLINE SALES </a></h2>
    </div>
    <div id="page">

    <?PHP
    //activates the user's account
    $query = "UPDATE users SET isRegistered = 1 WHERE pin = '".$pin."'";
    mysql_query($query) or die('Error, insert query failed');
    echo "<br /><p align='center'>Account Activated <br />
    <a href='../index1.php' title=''>Home Page</a></p>";
    ?>
    </div>
    <div id="footer">
    <p id="legal">Site designed by <a href="http://www.freecsstemplate.net">Ease co. </a></p>
    <p id="links"><a href="#top" title="This page validates as XHTML 1.0 Transitional"><abbr title="eXtensible HyperText Markup Language">Back to Top </abbr></a><a href="#" title="This page validates as CSS"><abbr title="Cascading Style Sheets"></abbr></a></p>
    </div>
    </body>
    </html>

    Will appreciate your help
     
    papyne28, Aug 28, 2009 IP
  2. crivion

    crivion Notable Member

    Messages:
    1,669
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    210
    Digital Goods:
    3
    #2
    in connect.php you should have session_start(); just after <?php, not at the bottom
     
    crivion, Aug 28, 2009 IP
  3. basheer

    basheer Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    session_start() always come at the top of the script... you write in the bottom of the script... no statement will be executed before the session_start()....
    if you write at the top you can eliminate the warning and error...:cool:
     
    basheer, Aug 28, 2009 IP
  4. weboy

    weboy Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    put the session_start(); at the top of script.
     
    weboy, Aug 28, 2009 IP
  5. papyne28

    papyne28 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks alot,it worked!
     
    papyne28, Aug 29, 2009 IP