Toon posts:

[php] header fout (kom er niet uit)

Pagina: 1
Acties:
  • 41 views sinds 30-01-2008

Verwijderd

Topicstarter
Ik heb een header fout:
Warning: Cannot add header information - headers already sent by (output started at /www/htdocs/kerstmis/includes/boven.php:12) in /www/htdocs/kerstmis/scripts/top100/tophits.php on line 40

Het adres = http://www.kerstmisonline.nl/scripts/top100/tophits.php?pagina=http://kerstmarkt.startkabel.nl
Wat kan er fout zijn?
PHP:
1
<?$paginanaam="Kerst top 100";include("../../includes/boven.php");?><?php// --------------------------------------------------------------- //////    Verander de variabelen hieronder.      $DataBestand = "tophits.dat";      $JouwSite = "http://www.kerstmisonline.nl/";//    Na hier hoef je niks meer te veranderen!//    Ga naar tophits.php?actie=checktophits//    Om de statistieken te zien.//    Mensen kunnen links plaatsen naar tophits.php?in=hunsite//// --------------------------------------------------------------- //$TophitsFile = file($DataBestand);$TophitsFileLengte = count($TophitsFile);if($TophitsFileLengte == 0) {$TophitsBestand = fopen($DataBestand,"w");fputs($TophitsBestand,"0|0|http://www.webmensen.nl/|\n");fclose($TophitsBestand);$TophitsFile = file($DataBestand);$TophitsFileLengte = count($TophitsFile);}if($pagina) {$TophitsBestand = fopen($DataBestand,"w");for($i = 0; $i < $TophitsFileLengte; $i++) {list($Var1,$Var2,$Var3,$Var4) = explode("|",$TophitsFile[$i]);if($Var3 == $pagina &amp;&amp; $Var4 != $REMOTE_ADDR) { fputs($TophitsBestand,"$Var1|".(intval($Var2)+1)."|$Var3|$REMOTE_ADDR|\n"); }else { fputs($TophitsBestand,$TophitsFile[$i]); }}fclose($TophitsBestand);header("Location: $pagina");exit;}elseif($actie == "checktophits") {echo("<html><body><center><font face='Arial,Helvetica' size=2><h2>Tophits Statistieken</h2><br><table border=1><tr><td><font face='Arial,Helvetica' size=1><center>&amp;nbsp;<b>Totale Inhits</b>&amp;nbsp;</center></font></td><td><font face='Arial,Helvetica' size=1><center>&amp;nbsp;<b>Totale Outhits</b>&amp;nbsp;</center></font></td><td><font face='Arial,Helvetica' size=1><center>&amp;nbsp;<b>URL</b>&amp;nbsp;</center></font></td></tr>\n");natsort($TophitsFile);function MaakLijst($waarden, $nummer) {$TophitsSplit = explode("|",$waarden);echo("<tr><td><font face='Arial,Helvetica' size=1>&amp;nbsp;$TophitsSplit[0]&amp;nbsp;</font></td><td><font face='Arial,Helvetica' size=1>&amp;nbsp;$TophitsSplit[1]&amp;nbsp;</font></td>");if(!trim($TophitsSplit[3])) { echo("<td><font face='Arial,Helvetica' size=1>&amp;nbsp;<a href='$PHP_SELF?pagina=$TophitsSplit[2]' target='_blank'>$TophitsSplit[2]</a>&amp;nbsp;</font></td></tr>\n"); }else { echo("<td><font face='Arial,Helvetica' size=1>&amp;nbsp;<a href='$PHP_SELF?pagina=$TophitsSplit[2]' target='_blank'><image border=0 src='".trim($TophitsSplit[3])."'></a>&amp;nbsp;</font></td></tr>\n"); }}array_walk(array_reverse($TophitsFile), 'MaakLijst');echo("</table></font></center></body></html>");}elseif($in) {$inhit = $in;$TophitsBestand = fopen($DataBestand,"w");$TophitsGevonden = false;for($i = 0; $i < $TophitsFileLengte; $i++) {$Split = explode("|",$TophitsFile[$i]);if(strstr($TophitsFile[$i],$inhit)) {$TophitsGevonden = true;$Teller = intval($Split[0]);if($Split[3] != $REMOTE_ADDR) { $Teller++; }@fputs($TophitsBestand,"$Teller|$Split[1]|$inhit|$REMOTE_ADDR|\n");}else { fputs($TophitsBestand,$TophitsFile[$i]); }}if(!$TophitsGevonden) { fputs($TophitsBestand,"1|0|$inhit|$REMOTE_ADDR|\n"); }fclose($TophitsBestand);header("Location: $JouwSite");exit;}?><?phpinclude("../../includes/onder.php");?>

  • mulder
  • Registratie: Augustus 2001
  • Laatst online: 10:21

mulder

ik spuug op het trottoir

*FLASHBACK*

HET ZIT IN DIE HEADER REDIRECT!!!

*hijg*

oogjes open, snaveltjes dicht


  • D2k
  • Registratie: Januari 2001
  • Laatst online: 31-08 10:19

D2k

http://www.php.net/manual/en/function.header.php

Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.
ECHT BETER KIJKEN

Doet iets met Cloud (MS/IBM)


Dit topic is gesloten.