Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Cannot send session cookie - headers already sent

[es] :: PHP :: Cannot send session cookie - headers already sent

[ Pregleda: 1995 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

burtonium
Slovenia

Član broj: 3918
Poruke: 76
*.cable.triera.net



Profil

icon Cannot send session cookie - headers already sent19.09.2004. u 11:55 - pre 238 meseci
Pozdrav svima,

imam jedan problem, a taj je vidljiv na donjoj adresi:
http://213.161.21.80:8080/milojko/finalplan2/admin/index2.php

Prilazem i index2.php, kao i index3.php koji radi kako treba ali nije dokument u obliku xhtml. Samo me interesuje kako bih mogao da upotrebim xhtml header a da ne dobijam pomenuti error:

Code:

Warning: session_start(): Cannot send session cookie - headers already sent by 
(output started at /var/www/localhost/htdocs/milojko/finalplan2/admin/index2.php:1) 
in /var/www/localhost/htdocs/milojko/finalplan2/admin/index2.php on line 2


Code:
 
<?
session_start();    
include ("protection/accesscontrol.php"); 
echo "<"."?xml version=\"1.0\" encoding=\"UTF-8\"?".">";
?>
<!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>
        <title>One Hundred Percent Height Divs</title>
                
        <![if IE]>
        <link rel="stylesheet" type="text/css" href="neki_mojga.css" />
        <![endif]>
        
        <![if !IE]>
        <link rel="stylesheet" type="text/css" href="neki_mojgaFF.css" />
        <![endif]>
        
    </head>

    <body>

        <div id="header">
        <table width="100%">
        <tr>
        <td bgcolor=lightgreen><a href=http://213.161.21.80:8080/milojko/finalplan2/admin/index.php?f=uredi><b>urejevalnik</b></a></td>
        <td bgcolor=lightblue ><a href=http://213.161.21.80:8080/milojko/finalplan2/admin/index.php?f=drevo><b>struktura</b></a></td>
        <td bgcolor=yellow    ><a href=http://213.161.21.80:8080/milojko/finalplan2/admin/index.php?sess=678529>Odjavi se</a></td>
        </tr>
        </table>
        </div>

        <div class="content">
        <?

    
    if ($GLOBALS[f] == "") {
        if ($_SESSION[tema] == "") {
                $_SESSION[tema] = "uredi";            
            } 
        } else {
                $_SESSION[tema] = $GLOBALS[f];
        }

         
    if ($_SESSION[tema] == "uredi") {
            include ("classes/commonclass.php");
                $obj=New commonclass;
                $obj->zacetna_stran();
        } 
    
    else if ($_SESSION[tema] == "drevo") {
            include ("classes/drevo.php");
                $obj = New drevo;
                $obj->izpis(0);
        }
        ?>
        </div>
        
    </body>
</html>


index3.php sa obicnim html tagom radi.
http://213.161.21.80:8080/milojko/finalplan2/admin/index3.php


Code:

<?
session_start();    
include ("protection/accesscontrol.php"); 
?>

<html>
    <head>
        <title>One Hundred Percent Height Divs</title>
                
        <![if IE]>
        <link rel="stylesheet" type="text/css" href="neki_mojga.css" />
        <![endif]>
        
        <![if !IE]>
        <link rel="stylesheet" type="text/css" href="neki_mojgaFF.css" />
        <![endif]>
        
    </head>

    <body>

        <div id="header">
        <table width="100%">
        <tr>
        <td bgcolor=lightgreen><a href=http://213.161.21.80:8080/milojko/finalplan2/admin/index.php?f=uredi><b>urejevalnik</b></a></td>
        <td bgcolor=lightblue ><a href=http://213.161.21.80:8080/milojko/finalplan2/admin/index.php?f=drevo><b>struktura</b></a></td>
        <td bgcolor=yellow    ><a href=http://213.161.21.80:8080/milojko/finalplan2/admin/index.php?sess=678529>Odjavi se</a></td>
        </tr>
        </table>
        </div>

        <div class="content">
        <?

    
    if ($GLOBALS[f] == "") {
        if ($_SESSION[tema] == "") {
                $_SESSION[tema] = "uredi";            
            } 
        } else {
                $_SESSION[tema] = $GLOBALS[f];
        }

         
    if ($_SESSION[tema] == "uredi") {
            include ("classes/commonclass.php");
                $obj=New commonclass;
                $obj->zacetna_stran();
        } 
    
    else if ($_SESSION[tema] == "drevo") {
            include ("classes/drevo.php");
                $obj = New drevo;
                $obj->izpis(0);
        }
        ?>
        </div>
        
    </body>
</html>


HVALA UNAPRED!

Dusan


I tako dalje sve do smaka sveta ...
 
Odgovor na temu

Ilija Studen
Novi Sad

Član broj: 3864
Poruke: 859
*.ftn.ns.ac.yu

Sajt: www.activecollab.com


+1 Profil

icon Re: Cannot send session cookie - headers already sent19.09.2004. u 13:46 - pre 238 meseci
Header može da se pošalje samo pre nego što isprintaš nešto (sa print i echo). Znači, ne smeš printati NIŠTA pre nego što setuješ Cookie, šalješ specifičan header browseru ili startuješ sesije...

Pravila igre...
http://www.activecollab.com - Alat za upravljanje projektima
 
Odgovor na temu

boccio
Boris Krstović
Spoonlabs.com
nbgd

Član broj: 7594
Poruke: 2458
213.212.252.*

Sajt: bocc.io


+771 Profil

icon Re: Cannot send session cookie - headers already sent19.09.2004. u 14:37 - pre 238 meseci
izbaci ovu liniju:

echo "<"."?xml version=\"1.0\" encoding=\"UTF-8\"?".">";
Jeff, one day you’ll understand that it’s harder to be kind than clever.
 
Odgovor na temu

burtonium
Slovenia

Član broj: 3918
Poruke: 76
*.cable.triera.net



Profil

icon Re: Cannot send session cookie - headers already sent19.09.2004. u 16:02 - pre 238 meseci
Cao!

Hvala obojici na pomoci. Resio sam problem. Prilazem index2.php, kakav funkcionise.

;)

Code:

<?
session_start();    
?>
<!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>
        <title>One Hundred Percent Height Divs</title>
                
        <![if IE]>
        <link rel="stylesheet" type="text/css" href="neki_mojga.css" />
        <![endif]>
        
        <![if !IE]>
        <link rel="stylesheet" type="text/css" href="neki_mojgaFF.css" />
        <![endif]>
        
    </head>

    <body>
<?
include ("protection/accesscontrol.php"); 
?>

        <div id="header">
        <table width="100%">
        <tr>
        <td bgcolor=lightgreen><a href=http://213.161.21.80:8080/milojko/finalplan2/admin/index.php?f=uredi><b>urejevalnik</b></a></td>
        <td bgcolor=lightblue ><a href=http://213.161.21.80:8080/milojko/finalplan2/admin/index.php?f=drevo><b>struktura</b></a></td>
        <td bgcolor=yellow    ><a href=http://213.161.21.80:8080/milojko/finalplan2/admin/index.php?sess=678529>Odjavi se</a></td>
        </tr>
        </table>
        </div>

        <div class="content">
        <?

    
    if ($GLOBALS[f] == "") {
        if ($_SESSION[tema] == "") {
                $_SESSION[tema] = "uredi";            
            } 
        } else {
                $_SESSION[tema] = $GLOBALS[f];
        }

         
    if ($_SESSION[tema] == "uredi") {
            include ("classes/commonclass.php");
                $obj=New commonclass;
                $obj->zacetna_stran();
        } 
    
    else if ($_SESSION[tema] == "drevo") {
            include ("classes/drevo.php");
                $obj = New drevo;
                $obj->izpis(0);
        }
        ?>
        </div>
        
    </body>
</html>



Pozdrav,

dusan
I tako dalje sve do smaka sveta ...
 
Odgovor na temu

webmaster1
Luka Pilipovic
BG

Član broj: 24183
Poruke: 302
*.ptt.yu

ICQ: 160820372
Sajt: www.montenegro-sea.com


Profil

icon Re: Cannot send session cookie - headers already sent20.09.2004. u 09:40 - pre 238 meseci
A postoje i funkcije za rad sa headerima!!Bas kako bi se izbegle ove i slicne neprijatnosti...Dakle, ne mora bas sve ici u kodu redom koji ce se izvrsavati...
Privatni smeštaj u Crnoj Gori
www.montenegro-sea.com.
 
Odgovor na temu

[es] :: PHP :: Cannot send session cookie - headers already sent

[ Pregleda: 1995 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.