The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

help script [moved]

Discussion in 'General Discussion' started by hostsky, Feb 26, 2006.

  1. hostsky

    hostsky Member

    Joined:
    Dec 30, 2005
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    help script

    --------------------------------------------------------------------------------
    hi
    Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/gohan89/public_html/zonazeta/www/login.php:5) in /home/gohan89/public_html/zonazeta/www/login.php on line 31 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/gohan89/public_html/zonazeta/www/login.php:5) in /home/gohan89/public_html/zonazeta/www/login.php on line 31

    this problem from to php o apache?
     
  2. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    This is simply a PHP-based error reflecting the fact that the script is coded incorrectly.

    Ensure that if you want to output any header-related data (cookies, redirects etc), that you do so before anything else is output.
     
  3. hostsky

    hostsky Member

    Joined:
    Dec 30, 2005
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    how i modify this paramter?
     
  4. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    This is a bit of a broad question, and if my first response didn't clarify things, you're knowledge of PHP possibly isn't up to scratch.

    However, with specific relevance to the error you posted, you will need to check the script for the PHP function session_start() and ensure that no data is output prior to this command.
     
  5. hostsky

    hostsky Member

    Joined:
    Dec 30, 2005
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
  6. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
  7. hostsky

    hostsky Member

    Joined:
    Dec 30, 2005
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    what you mean=
     
  8. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    You will need to check the script for the PHP function session_start() and ensure that no data is output prior to this command.
     
  9. wwfn

    wwfn Member

    Joined:
    Jun 16, 2005
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    also check the login.php script and make sure there is no spaces at the very end of the script.(after the ?>) i found that causes those errors as well.
     
  10. hostsky

    hostsky Member

    Joined:
    Dec 30, 2005
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    see this is a script


    <html>

    <head>

    </head>

    <body style="background-color:transparent" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">


    <?php

    include("connessione.php");

    $select="SELECT * FROM grafica WHERE tipo='pannello'";

    $mysql=mysql_query($select) or die(mysql_error());

    $row=mysql_fetch_array($mysql);

    $admin=$row["n1"];

    $scheda=$row["n2"];

    $messaggi_letti=$row["n3"];

    $messaggi_nuovi=$row["n4"];

    $logout=$row["n5"];

    $refresh=$row["n6"];

    session_start();
    if($_SESSION['nick']==TRUE){
    if($_SESSION["livello"]=="Amministratore" OR $_SESSION["livello"]=="Web Master" OR $_SESSION["livello"]=="Moderatore" OR $_SESSION["livello"]=="Redattore"){
    ?>
    <a href="admin/admin.php" target="news"><img src="<? echo $admin; ?>" border="0" alt="Admin"></a>
    <?
    }

    else{

    echo "";

    }
    ?>
    <a href="scheda/profilo.php" target="news"><img src="<? echo $scheda; ?>" border="0" alt="Profilo"></a>

    <?
    $nick=$_SESSION["nick"];

    $mex=mysql_query("SELECT * FROM messaggi WHERE destinatario='$nick'") or die(mysql_error());

    $row2=mysql_fetch_array($mex);

    if($row2["stato"]=="nuove"){
    ?>
    <a href="posta/msg.php" target="news"><img src="<? echo $messaggi_nuovi; ?>" border="0" alt="Messaggi Nuovi"></a>
    <?
    }

    else{
    ?>
    <a href="posta/msg.php" target="news"><img src="<? echo $messaggi_letti; ?>" border="0" alt="Messaggi"></a>

    <?
    }
    ?>
    <a href="logout.php" target="news"><img src="<? echo $logout; ?>" border="0" alt="logout"></a>
    <?
    }
    else if(!$_SESSION['nick']){
    echo "";
    }

    ?>
    <a href="pannello.php"><img src="<? echo $refresh; ?>" border="0" alt="Aggiorna"></a>
    </body>

    </html>
     
  11. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    As I have previously mentioned, you will need to check the script for the PHP function session_start() and ensure that no data is output prior to this command.

    In this case, it is quite obvious that some HTML code is being sent as output prior to the session_start() function.

    The session_start() function, or for that matter any function regarding header-related data, must come before any other data is output. It's really that simple!
     
Loading...

Share This Page