Toon posts:

[php] header already sent fout.

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

Verwijderd

Topicstarter
Ik krijg bij een top 100 script de 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?

Het gebruikt geen cookies.

Het script is:
<?php
$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 && $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> <b>Totale Inhits</b> </center></font></td><td><font face='Arial,Helvetica' size=1><center> <b>Totale Outhits</b> </center></font></td><td><font face='Arial,Helvetica' size=1><center> <b>URL</b> </center></font></td></tr>\n");

natsort($TophitsFile);

function MaakLijst($waarden, $nummer) {
$TophitsSplit = explode("|",$waarden);
echo("<tr><td><font face='Arial,Helvetica' size=1> $TophitsSplit[0] </font></td><td><font face='Arial,Helvetica' size=1> $TophitsSplit[1] </font></td>");
if(!trim($TophitsSplit[3])) { echo("<td><font face='Arial,Helvetica' size=1> <a href='$PHP_SELF?pagina=$TophitsSplit[2]' target='_blank'>$TophitsSplit[2]</a> </font></td></tr>\n"); }
else { echo("<td><font face='Arial,Helvetica' size=1> <a href='$PHP_SELF?pagina=$TophitsSplit[2]' target='_blank'><image border=0 src='".trim($TophitsSplit[3])."'></a> </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;
}

?>
<?php
include("../../includes/onder.php");
?>

Wie weet wat er fout kan zijn?

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

mulder

ik spuug op het trottoir

[php]<?Zet effe
PHP:
1
 tags er omheen?>

Het zit um btw denk ik die redirects. echo anders een java redir.

oogjes open, snaveltjes dicht


  • R4NCOR
  • Registratie: December 2000
  • Laatst online: 03-09 14:50

R4NCOR

eigenlijk gewoon Niels

Staat er toch letterlijk? Jij wil een header versturen, maar dat kan niet, omdat dat al gebeurt is in boven.php (line12)

:{

Verwijderd

Topicstarter
[php]<?php
$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 && $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> <b>Totale Inhits</b> </center></font></td><td><font face='Arial,Helvetica' size=1><center> <b>Totale Outhits</b> </center></font></td><td><font face='Arial,Helvetica' size=1><center> <b>URL</b> </center></font></td></tr>\n");

natsort($TophitsFile);

function MaakLijst($waarden, $nummer) {
$TophitsSplit = explode("|",$waarden);
echo("<tr><td><font face='Arial,Helvetica' size=1> $TophitsSplit[0] </font></td><td><font face='Arial,Helvetica' size=1> $TophitsSplit[1] </font></td>");
if(!trim($TophitsSplit[3])) { echo("<td><font face='Arial,Helvetica' size=1> <a href='$PHP_SELF?pagina=$TophitsSplit[2]' target='_blank'>$TophitsSplit[2]</a> </font></td></tr>\n"); }
else { echo("<td><font face='Arial,Helvetica' size=1> <a href='$PHP_SELF?pagina=$TophitsSplit[2]' target='_blank'><image border=0 src='".trim($TophitsSplit[3])."'></a> </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;
}

?>
<?php
include("../../includes/onder.php");
?> [php]
Zo bedoel je?
Wist niet dat dat kon!

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

D2k

www.php.net/header
aandachtig lezen

Doet iets met Cloud (MS/IBM)


Dit topic is gesloten.