[ burtonium @ 19.09.2004. 11:55 ] @
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

[ Ilija Studen @ 19.09.2004. 13:46 ] @
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...
[ boccio @ 19.09.2004. 14:37 ] @
izbaci ovu liniju:

echo "<"."?xml version=\"1.0\" encoding=\"UTF-8\"?".">";
[ burtonium @ 19.09.2004. 16:02 ] @
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
[ webmaster1 @ 20.09.2004. 09:40 ] @
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...