[PHP] Problema con header location
Ciao a tutti, ho provato ad installare AppServ (addio Wamp Server! XD) e ho riscontrato questo problema, che prima con Wamp Server non avevo:
Citazione:
Warning: Cannot modify header information - headers already sent by (output started at index.php:6) in index.php on line 36
Questa è la parte in PHP:
Codice PHP:
<?
if($_POST["parola"] OR $_GET["parola"]) {
$site = "http://www.google.it"; # url del sito con pagina
if($_POST["parola"]) {
$word = trim(addslashes($_POST["parola"]));
}
else {
$word = trim(addslashes($_GET["parola"]));
}
if(empty($word)) {
header("Location: index.php"); exit();
}
else {
$echo = file_get_contents($site."?parola=$word");
if(stristr($echo, "La ricerca di <b>$word</b> non ha prodotto alcun risultato.") == FALSE) {
# echo "<script type=\"text/javascript\">window.open(\"$site?parola=$word\",\"\",\"\");</script>";
# echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php?parola=$word\" />";
header("Location: $site?parola=$word");
}
else {
# echo "<script>window.open(\"$site?parola=$word&md=ff\",\"\",\"\");</script>";
# echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php?parola=$word\" />";
header("Location: $site?parola=$word&md=ff");
}
}
}
?>
Non credo di aver nulla di sbagliato nel codice, la versione di PHP è la 5.2.6...la devo aggiornare? XD
Grazie mille!! <3