markus-so
Goto Top

Problem mit einem Script - Was hat php mit einer Tabelle zu tun?

Die Situation ist folgende:

Ich habe eine Datei, die sieht so aus:
if (!$isAdmin) header("LOCATION: ?m=public"); ?>  
<table width="100%" border="0" cellspacing="0" cellpadding="0">  
   <tr>
      <td align="left" width=50% valign="top" class="content">  
         <a href="?m=public" class="link">  
            Home
         </a>
      </td>
      <td align="right" width=50% valign="top" class="text">  
         Date
      </td>
   </tr>
</table></font>
Diese Datei wird in meine index.php (bzw. in dem fall heisst sie index2.php) includet.

In der Index-Datei gibt es einen Button um sich auszuloggen, das script dazu liegt in der login.php und sieht so aus:

if ($action == logout && $cookie) {
  setcookie("username","");  
  setcookie("password","");  
  header("LOCATION: " . $_SERVER["PHP_SELF"]);  //aktualisieren  
}

Das ganze funktioniert einwandfrei. Wenn ich nun aber die oben genannte tabelle erweitere, so dass sie so aussieht:

*?php if (!$isAdmin) header("LOCATION: ?m=public"); ?>  
*table width="100%" border="0" cellspacing="10" cellpadding="0">  
   *tr>
      *td align="left" width=50% valign="top" class="content">  
         *a href="?m=public" class="link">  
            Home
         */a>
      */td>
      *td align="right" width=50% valign="top" class="text">  
         Date
      */td>
   */tr>
   *tr>
      *td colspan="2">  
            nbsp; (da kommt nocht ein kaufmaennisches und vor)
      */td>
   */tr>
   *tr>
      *td colspan="2">  
      *table width="100%" border="0">  
         *tr>
            *td align="left" width="43">  
               *img src="images/icons/users.png" />  
            */td>
            *td align="left" class="main">  
               *a href="?m=admin&a=users" class="link">  
               Benutzerverwaltung
            */td>
         */tr>
      */table>
      */td>
   */tr>
*/table>

Bekomme ich beim logout folgende Fehlermeldung:

Warning: Cannot modify header information - headers already sent by (output started at C:\apachefriends\xampp\htdocs\cms2\index2.php:92) in C:\apachefriends\xampp\htdocs\cms2\login.php on line 16

Warning: Cannot modify header information - headers already sent by (output started at C:\apachefriends\xampp\htdocs\cms2\index2.php:92) in C:\apachefriends\xampp\htdocs\cms2\login.php on line 17

Warning: Cannot modify header information - headers already sent by (output started at C:\apachefriends\xampp\htdocs\cms2\index2.php:92) in C:\apachefriends\xampp\htdocs\cms2\login.php on line 18

Die Zeilen verweisen jeweils auf die oben geschriebenen Zeilen in der login.php.

Kann mir da jemand weiterhelfen??? Ich habe echt kein plan, was das mit den zwei tabellenzeilen, die ich hinzugefuegt habe, zu tun hat.


Gruss Markus

Content-Key: 11221

Url: https://administrator.de/contentid/11221

Printed on: April 25, 2024 at 05:04 o'clock

Member: pc-pure
pc-pure May 29, 2005 at 21:52:03 (UTC)
Goto Top
Kannst du mal die beiden kompletten Dateien posten?
Member: markus-so
markus-so Jun 12, 2005 at 16:02:08 (UTC)
Goto Top
Sorry, ich habe den Fehler inzwischen selbst gefunden.

Das Problem war, dass ich saemtliche Cookies etc. nur ganz am Anfang setzen darf, bevor irgenweicher HTML-Code kommt. Anscheinend hat das am Anfang nichts aus gemacht, als der HTML-Code vor den Cookies aber dann "zu viel" gings nicht mehr.


Gruss Markus
Member: ueberlasteter-admin
ueberlasteter-admin Jun 23, 2005 at 22:57:03 (UTC)
Goto Top
also nimms mir nicht übel ich bin zu besoffen und das alles jetzt zu lesen aber wenn diese meldung kommt wie im letzten fenster, heisst das du hast was über deinem inluce geschrieben, wenn du eine session inclides darf nichts da drüber stehen ok?

erst das r eine inclide, dann erst dein programmcode!

mfg