Veröffentlicht 14. März 200520 j Hallo Leute ich habe mir einen Webserver (IIS) mit PHP und MySql aufgesetzt. mun habe ich danach meine HP rüberkopiert und bekam bei dem Counter diese Fehlermeldung: Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub\wwwroot\homepage\quelltext\php\navigation.php:2) in C:\Inetpub\wwwroot\homepage\quelltext\php\counter.php on line 3 4937 Notice: Undefined index: count in C:\Inetpub\wwwroot\homepage\quelltext\php\counter.php on line 30 kann mir jemand da weiterhelfen? ist das ein berechtigungsproblem ? mfg Xandie
15. März 200520 j Das ist der Quelltext das in den ersten 4 Zeilen steht. 1. <?php 2. // Cookie wird gesetzt 3. setcookie("count","yes"); 4. ?> mfg Xandie
15. März 200520 j Bingo. Wenn man setcookie aufruft, dann wird ein Header gesendet. Deshalb die Fehlermeldung. Frank
15. März 200520 j <?php // Cookie wird gesetzt setcookie("count","yes"); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <title>bla bla</title> <head> <title>bla bla</title> <meta name="author" content="bla bla"> <link rel='Stylesheet' href='../../css/page.css' type='text/css'> <style type="text/css"> body { scrollbar-arrow-color: #FF4D00; scrollbar-base-color: #000000; scrollbar-track-color: #000000; scrollbar-face-color: #000000; scrollbar-highlight-color: #FFFFFF; scrollbar-3dlight-color: #000000; scrollbar-darkshadow-color: #000000; scrollbar-shadow-color: #FFFFFF; } </style> </head> <body text="#FF4D00" link="#FF4D00" vlink="#FF4D00" alink="#FF4D00" bgcolor="black" > <font face="Arial Black"><?php $fp=fopen("../../include/counter.txt","r+"); $counter=fgets($fp,10); echo $counter; if ($_COOKIE["count"]!="yes") { $counter++; } rewind($fp); fputs($fp,$counter); fclose($fp); ?> </font> </body> </html> Das komisce ist, dass es mit xampp funktionert! mfg Xandie
15. März 200520 j <HTML> <? include('../../include/head.txt'); ?> <body bgcolor="black"> <font face="Arial" size="-1" color="#FF4D00"><b>Navigation</b></font> <br> <hr noshade size="1" color="#FFFFFF"> <a href="../html/unten.html" target="iframe2"><font size="-10">Home</font></a><br> <a href="../html/impressum.html" target="iframe2"><font size="-10">Impressum</font></a><br> <hr noshade size="1" color="#FFFFFF"> <a href="../php/burningbook/index.php" target="iframe2"><font size="-10">Gästebuch</font></a><br> <a href="../php/wbboard/index.php" target="iframe2"><font size="-10">Forum</font></a><br> <hr noshade size="1" color="#FFFFFF"> <a href="../html/bilder_2004.html" target="iframe2"><font size="-10">Bilder 2004</font></a><br> <a href="../html/bilder_2005.html" target="iframe2"><font size="-10">Bilder 2005</font></a><br> <hr noshade size="1" color="#FFFFFF"> <br><br><br><br><br><br><br><br><br><br> <? include('counter.php'); ?> </BODY> </HTML> mfg Xandie
15. März 200520 j <HTML> [...] <hr noshade size="1" color="#FFFFFF"> <br><br><br><br><br><br><br><br><br><br> <? include('counter.php'); ?> [...] In include.php willst du einen Cookie setzen. Das geht aber nur, wenn davor noch keine Ausgabe erfolgt ist. In deiner Datei erfolgt aber schon ne Menge an Ausgaben, bevor der Cookie gesetzt werden soll. Das kann nicht funktionieren, ausser du hast deinen XAMPP so eingestellt, dass die Ausgaben gecached werden, also erst ganz am Ende die Ausgabe erfolgt. Die sollte man aber nicht nutzen, weil es eben für den Server belatender ist.
15. März 200520 j wär noch für ne lösung dankbar!Was verstehst du denn an den Erklärungen weiter oben nicht? Du musst sämtliche Header setzen, bevor du Content an den Browser schickst.
15. März 200520 j Header senden und DANN Content schreiben. Content ist HTML aber auch Kommentare... also am Besten Header als erstes senden.
15. März 200520 j wär noch für ne lösung dankbar! [b]<? include('counter.php'); ?> [/b] <HTML> <? include('../../include/head.txt'); ?> <body bgcolor="black"> <font face="Arial" size="-1" color="#FF4D00"><b>Navigation</b></font> <br> <hr noshade size="1" color="#FFFFFF"> <a href="../html/unten.html" target="iframe2"><font size="-10">Home</font></a><br> <a href="../html/impressum.html" target="iframe2"><font size="-10">Impressum</font></a><br> <hr noshade size="1" color="#FFFFFF"> <a href="../php/burningbook/index.php" target="iframe2"><font size="-10">Gästebuch</font></a><br> <a href="../php/wbboard/index.php" target="iframe2"><font size="-10">Forum</font></a><br> <hr noshade size="1" color="#FFFFFF"> <a href="../html/bilder_2004.html" target="iframe2"><font size="-10">Bilder 2004</font></a><br> <a href="../html/bilder_2005.html" target="iframe2"><font size="-10">Bilder 2005</font></a><br> <hr noshade size="1" color="#FFFFFF"> <br><br><br><br><br><br><br><br><br><br> EDIT: Da du in der cookie.php auch Ausgaben machst, solltest du dies aufteilen... wieso Teilst du das ganze eigentlich in 2 Dateien? Kannst du das nicht in einer machen? Dann prüfst du eben, ob der Cookie gesetzt ist z.B.: if (isset($_COOKIE["counter"])) { } oder so...
Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.