Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005
    Posts
    856
    Tokens
    0

    Default Php/mysql error, needs fixing ASAP

    Error:
    Warning: Cannot modify header information - headers already sent by (output started at /home/habbol/public_html/usersystem/home.php:9) in /home/habbol/public_html/usersystem/login.php on line 49

    Warning: Cannot modify header information - headers already sent by (output started at /home/habbol/public_html/usersystem/home.php:9) in /home/habbol/public_html/usersystem/login.php on line 50
    Coding:
    PHP Code:
    <? 
    oB_start
    (); 
    // allows you to use cookies. 
    include("config.php"); 
    if (!
    $logged[username]) 
    { 
    if (!
    $_POST[login]) 
    { 
    echo(
    " 
    <center><form method=\"POST\"> 
    <table> 
    <tr> 
    <td align=\"right\"> 
    Username: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\"> 
    </td> 
    </tr> 
    <tr> 
    <td align=\"right\"> 
    Password: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"password\"> 
    </td></tr><tr> 
    <td align=\"center\"> 
    <input type=\"submit\" name=\"login\" value=\"Login\"> 
    </td></tr><tr> 
    <td align=\"center\"> 
    <a href=\"register.php\">Register Here</a> 
    </td></tr></table></form></center>"
    ); 
    } 
    if (
    $_POST[login]) { 
    // the form has been submitted.  We continue... 
    $username=$_POST['username']; 
    $password = md5($_POST[password]); 
    // the above lines set variables with the submitted information.    
    $info = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
    $data = mysql_fetch_array($info); 
    if(
    $data[banned] == banned) { 
    echo(
    "Your account has been banned!"); 
    } 
    else 
    { 
    echo (
    "Thank You! You have now logged in. Click Homepage at the bottom of the screen to continue");   
    if(
    $data[password] != $password) { 
    // the password was not the user's password! 
    echo "Incorrect username or password!"; 
    }else{ 
    // the password was right! 
    $query = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
    $user = mysql_fetch_array($query); 
    // gets the user's information 
    setcookie("id", $user[id],time()+(60*60*24*5), "/", ""); 
    setcookie("pass", $user[password],time()+(60*60*24*5), "/", "");
    // the above lines set 2 cookies. 1 with the user's id and another with his/her password.    
    } 
    } 
    } 
    } 
    else 
    {   
    $new = mysql_query("select * from pmessages where unread = 'unread' and touser = '$logged[username]'"); 
    $new = mysql_num_rows($new); 
    // we now display the user controls.
    echo ("<p><center>Welcome <b>$logged[username]</b> to HabboLink UserSystem<br /></center> 
    <p>This Section of the site is everything for members only. Have a look around, inform your mates, because this is possibly the best usersystem around.</p>
    <p>This system has taken ages to code and at last is up and ready for public use, so enjoy. Click the links below to continue</p>
    <p><a href=\"editprofile.php\" target=\"usersystem\"><img border=\"0\" src=\"images/nav_editp.gif\"></a><br />
    <a href=\"changepass.php\" target=\"usersystem\"><img border=\"0\" src=\"images/nav_pass.gif\"></a><br />
    <a href=\"friends.php\" target=\"usersystem\"><img border=\"0\" src=\"images/nav_friend.gif\"></a><br />
    <a href=\"messages.php\" target=\"usersystem\"><img border=\"0\" src=\"images/nav_priv.gif\"></a><br />
    <a href=\"find.php\" target=\"usersystem\"><img border=\"0\" src=\"images/nav_find.gif\"></a><br />
    <a href=\"members.php\" target=\"usersystem\"><img border=\"0\" src=\"images/nav_mems.gif\"></a><br />
    <a href=\"links.php\" target=\"usersystem\"><img border=\"0\" src=\"images/nav_links.gif\"></a><br />
    <a href=\"logout.php\" target=\"usersystem\"><img border=\"0\" src=\"images/nav_log.gif\"></a><br />"
    );
    if(
    $logged[username] && $logged[level] == 5)
    echo 
    "<a href=\"admin/index.php\" target=\"usersystem\"><img border=\"0\" src=\"images/nav_admin.gif\"></a><br />"; 
    } 
    ?>

  2. #2
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default

    Code:
    Warning: Cannot modify header information - headers already sent by (output started at /home/habbol/public_html/usersystem/home.php:9) in /home/habbol/public_html/usersystem/login.php on line 49
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/habbol/public_html/usersystem/home.php:9) in /home/habbol/public_html/usersystem/login.php on line 50
    The clues in the error

    (output started at on home.php. You see. So im guessing that means the cookies have already been set. Check this out and let me know.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •