Php problem... WTF!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chodadog
    Confirmed User
    • Apr 2002
    • 9736

    #1

    Php problem... WTF!

    ok, i've been working my ass off trying to get this damn site working.. then finally, it's done! finally fixed all the bugs.. or so i thought!

    I try to login to my admin section, and when i get to the index.php of the admin directory, i get this message:

    Warning: Cannot send session cookie - headers already sent by (output started at /home/virtual/site5/fst/var/www/get_env.php:1) in /home/virtual/site5/fst/var/www/html/tagadmin/index.php on line 14

    What in fuck's name does that mean!
    And how do i fix it?
    26 + 6 = 1
  • railz
    Confirmed User
    • Nov 2001
    • 2531

    #2
    What script(s) are you using?
    This Space for Rent

    Comment

    • chodadog
      Confirmed User
      • Apr 2002
      • 9736

      #3
      It's called kDDL. It's a direct downloads script (intended for warez)
      I got it back when i was a warez webmaster. But it's pretty much idealy suited for the TGP i wanna run, so i figured.. hey.. why not..
      26 + 6 = 1

      Comment

      • sweandy
        Confirmed User
        • Jan 2002
        • 422

        #4
        It probably sent some text or blank space before you do a header("location"); redirect or similair..

        Comment

        • chodadog
          Confirmed User
          • Apr 2002
          • 9736

          #5
          hmm.. any idea how to fix it though? :D
          26 + 6 = 1

          Comment

          • sweandy
            Confirmed User
            • Jan 2002
            • 422

            #6
            Check the html source in your browser if it outputs some strange text before the php warning, could even be " " blank space etc that you miss at first.

            Comment

            • chodadog
              Confirmed User
              • Apr 2002
              • 9736

              #7
              This is the source (after i've attempted to login, so there's another error)

              PHP Code:
              <a href=""></a><br>
              <b>Warning</b>:  Cannot send session cookie - headers already sent by (output started at /home/virtual/site5/fst/var/www/get_env.php:1) in <b>/home/virtual/site5/fst/var/www/html/tagadmin/index.php</b> on line <b>14</b><br>
              <br>
              <b>Warning</b>:  Cannot send session cache limiter - headers already sent (output started at /home/virtual/site5/fst/var/www/get_env.php:1) in <b>/home/virtual/site5/fst/var/www/html/tagadmin/index.php</b> on line <b>14</b><br>
              <br>
              <b>Warning</b>:  Cannot add header information - headers already sent by (output started at /home/virtual/site5/fst/var/www/get_env.php:1) in <b>/home/virtual/site5/fst/var/www/html/tagadmin/index.php</b> on line <b>41</b><br> 
              
              26 + 6 = 1

              Comment

              • railz
                Confirmed User
                • Nov 2001
                • 2531

                #8
                http://www.faqts.com/knowledge_base/...d/14388/fid/51

                quote from the amnual page for setcookie():

                setcookie() defines a cookie to be sent along with the rest of the
                header information. Cookies must be sent before any other headers are
                sent (this is a restriction of cookies, not PHP). This requires you to
                place calls to this function before any <html> or <head> tags.
                HTML tags in the wrong place?
                This Space for Rent

                Comment

                • sweandy
                  Confirmed User
                  • Jan 2002
                  • 422

                  #9
                  Yep seems like you put the stuff in wrong order.. set session cookie first then html output.

                  Comment

                  • chodadog
                    Confirmed User
                    • Apr 2002
                    • 9736

                    #10
                    Cheers guys. I'll see if i can fix it now
                    26 + 6 = 1

                    Comment

                    • chodadog
                      Confirmed User
                      • Apr 2002
                      • 9736

                      #11
                      ok.. i'm stumped..

                      this is from the index.php of the admin directory:

                      PHP Code:
                      
                      <?php
                      $inn = false;
                      
                      require "../../config.php";
                      require "../../db.inc.php";
                      require "../../get_env.php";
                      require "sec/session.php";
                      
                      session_start();
                      And this is from get_env.php:

                      PHP Code:
                      
                      <?php
                      
                      $env_q = "SELECT * FROM $mysql_tb_info";
                      if (!$env_get = mysql_query($env_q, $mysql_conn))
                          die($mysql_error_msg."<br><br>".mysql_error());
                      list($user, $pass, $name, $url, $email, $types, $spam_protect, $code_check, $files_max, $files_page, $link_gateway, $link_show_in, $link_show_out, $link_show_zero, $link_cols, $link_max, $link_layout, 
                      $date_format, $layout_ddl, $layout_ddl_rows, $layout_ddl_top) = mysql_fetch_row($env_get);
                      
                      $files_page2 = $files_page;
                      $type = explode("|", $types);
                      $link_layout = explode("|", $link_layout);
                      $layout_ddl = explode("|", $layout_ddl);
                      ?>
                      I haven't got a clue.. i suck so very bad with php
                      26 + 6 = 1

                      Comment

                      • railz
                        Confirmed User
                        • Nov 2001
                        • 2531

                        #12
                        What's on line 14 of index.php?
                        This Space for Rent

                        Comment

                        • chodadog
                          Confirmed User
                          • Apr 2002
                          • 9736

                          #13
                          PHP Code:
                          echo "Logged out!<br><br>\n"; 
                          
                          26 + 6 = 1

                          Comment

                          • sweandy
                            Confirmed User
                            • Jan 2002
                            • 422

                            #14
                            No errors in config.php or db.inc.php that outputs something?

                            Comment

                            • chodadog
                              Confirmed User
                              • Apr 2002
                              • 9736

                              #15
                              Hey.. i dunno how it happened.. but the admin index.php was modified.. i'm not sure if that's supposed to happen.. but anyways. i just replaced hte index.php from admin and the get_env.php from the originals on my hard disk, and it's fixed the problem..

                              Any idea why this happened in the first place? and how do i prevent it from happening. cheers
                              26 + 6 = 1

                              Comment

                              • sweandy
                                Confirmed User
                                • Jan 2002
                                • 422

                                #16
                                No idea. But if you have any more php problems hit me up on icq.

                                Comment

                                Working...