Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2005
    Posts
    4,486
    Tokens
    921

    Latest Awards:

    Default Code Help Again =D [+ Rep]

    Hi people I'm sorry about all my threads, I am pretty new to php ect...
    I have this piece of code:
    setcookie("in", 1, time()+3600);
    // Start hidden page
    header("Location: http://cowly.co.uk/staff/logged.htm");
    Which are lines 24, 25, 26.
    I get this error when trying to log in...
    Warning: Cannot modify header information - headers already sent by (output started at /home/cowly1a/public_html/staff/index.php:6) in /home/cowly1a/public_html/staff/index.php on line 24

    Warning: Cannot modify header information - headers already sent by (output started at /home/cowly1a/public_html/staff/index.php:6) in /home/cowly1a/public_html/staff/index.php on line 26
    Login Failed.

    Help will be appreciated and repped, or put on my rep list.
    Thanks,
    - T.</SPAN>
    "RETIRED" FROM HABBO(X)

    :¬:

    TOMSPIT / COWLY05


  2. #2
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

    Default

    can you post whole code.


  3. #3
    Join Date
    Nov 2005
    Posts
    4,486
    Tokens
    921

    Latest Awards:

    Default

    Sure, Its from the user system in the tut section, I need to just get it..
    <!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>Login</title>
    <?php
    if ($_SERVER['REQUEST_METHOD']=="POST"){
    // Get UserNames and Passwords.
    $Logi = file("users/log.txt");
    // Work out how many there are
    $size = sizeof($Logi);
    // Break appart passwords and usernames
    foreach($Logi as $Key => $Val)
    { $Data[$Key] = explode("||", $Val); }
    // run threw list and see if any match
    for($K = 0; $K<$size; $K++)
    {
    $user = $Data[$K][0];
    $pass = $Data[$K][1];
    // If match set cookie and redirect.
    if ($user == trim(addslashes($_POST["user"])) && $pass == trim(addslashes($_POST["pass"])) )
    {
    setcookie("in", 1, time()+3600);
    // Start hidden page
    header("Location: http://cowly.co.uk/staff/logged.htm");
    }
    }
    echo "Login Failed.";
    // If you didnt log in show login form
    } else { ?>
    </div>
    <style type="text/css">
    <!--
    .style1 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 9px;
    font-weight: bold;
    color: #666666;
    }
    body,td,th {
    color: #999999;
    }
    body {
    background-color: #FFC900;
    }
    .style2 {color: #000000}
    .style3 {font-size: 9px; font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif;}
    -->
    </style>
    <div align="center" class="style1">
    <div style="width:250px">
    <div class="style2">
    <p>&nbsp; </p>
    <p>&nbsp; </p>
    <p>&nbsp; </p>
    <p>Login</p>
    </div>
    <div class="style2">
    <form action="<?=$_SERVER['PHP_SELF'];?>" method="post" name="Login" id="Login">
    Username:
    <input name="user" type="text" class="style3">
    <br />
    Password:
    <input name="pass" type="password" class="style3">
    <br />
    <input name="Submit" type="submit" class="style3" value="Login!" />
    </form>
    </div>
    </div>
    <p class="style2"></p>
    <p class="style2"></p>
    <p>
    <span class="style2">
    <?php
    }
    ?>
    </span></p>
    </div>
    "RETIRED" FROM HABBO(X)

    :¬:

    TOMSPIT / COWLY05


  4. #4
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    3,285
    Tokens
    0

    Latest Awards:

    Default

    It is because you can't use headers after you've already send data to the browser.



    i used to be NintendoNews. visit my blog or add me on twitter.
    need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!


    "I am the way, the truth, and the life. No one comes to the Father except through me"
    John 14:6 (NIV)


  5. #5
    Join Date
    Nov 2005
    Posts
    4,486
    Tokens
    921

    Latest Awards:

    Default

    What are headers plz...
    I AM A PHP NOOB!

    - T.
    "RETIRED" FROM HABBO(X)

    :¬:

    TOMSPIT / COWLY05


  6. #6
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by nets View Post
    you need to move ob_start to the top. cookie info is stored in the packet's header, when you start outputting contnet, the header gets sent (therefore you cannot ammend/add to it). by putting ob_start at the top, yuo buffer the output and send it once the server finishes parsing the file (so practically, the header doesn't get sent off.. and you can mess about with it).
    sdfbdfbdurfngrd
    kinda quit.

Posting Permissions

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