Salve a tutti,
ho scritto uno script in php-html, ma quando voglio modificare l'header con un indirizzo mi visualizza questo errore: 'Warning: Cannot modify header information - headers already sent by (output started at /membri/sito/pagina.php:72) in /membri/sito/pagina.php on line 115'.
Come posso risolvere?
Ecco il codice:
Grazie a tutti in anticipo per il vostro aiuto,
hackersatifal.
ho scritto uno script in php-html, ma quando voglio modificare l'header con un indirizzo mi visualizza questo errore: 'Warning: Cannot modify header information - headers already sent by (output started at /membri/sito/pagina.php:72) in /membri/sito/pagina.php on line 115'.
Come posso risolvere?
Ecco il codice:
PHP:
<?php
if(!isset($_SESSION)){session_start();}
if(!isset($_SESSION['utente'])){
header("location: login2.php?azione=login");
exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="style.css">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="tipsy.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("[title]").tipsy({fade: true});
});
</script>
<style type="text/css">
a.scrittemenu {text-decoration:none}
a.hover{text-decoration:underline}
a.nomeutentebarra {text-decoration:none}
a:hover {text-decoration:underline}
a.logout {text-decoration:none}
a:hover {text-decoration:underline}
a.modifica_dati {text-decoration:none}
a:hover {text-decoration:underlinee}
p.saluto{margin-top:8%; margin-left:25%; color:white; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; font-size:200%; font-weight:bold}
a.profilo{margin-left:30%; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; font-size:150%; color:white}
a:hover {text-decoration:underline}
div.sidebar1 {float: left; width:25%; height:100%; background-color:#0165B6; border:1px solid #48aed1; margin-top:-47%; margin-left:3%}
div.sidebar2 {width:71%; height:100%; background-color:#0165B6; border:1px solid #48aed1; margin-top:0%; margin-left:29%}
p.username {text-decoration:none; color:white; font-size:120%; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; margin-bottom:5%; margin-top:5%}
p.noresult {color:white; font-size:120%; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; margin-bottom:5%; margin-top:5%}
p.bacheca {color:black; font-size:120%; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; margin-bottom:5%; margin-top:5%}
::-webkit-input-placeholder {font-size:90%; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif}
img {max-width:52%;max-height:52%; margin-top:-21%; border: 1px solid black; padding: 2%; background-color:white}
</style>
<script type="text/javascript">
<!--
var stile = "top=300, left=300 width=400, height=10, status=no, menubar=no, toolbar=no scrollbars=no";
function Popup(apri)
{
window.open(apri, "", stile);
}
//-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>KnowEveryone</title>
</head>
<body style="background-color:#036; width: 100%; height: 100%; display: block">
<div id="barra" style="height: 8%; position: fixed; top: 0px; bottom: 0; left: 0; width: 100%; background-color: #006699; border-bottom: 1px solid #133783; position:fixed !important">
<p style="margin-top:1%; margin-bottom:1%; margin-left:1%; color:#FFF; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; font-size:150%; font-weight:bold; text-align:left">KnowEveryone <a class="nomeutentebarra" href="profile2.php" style="color:white"><?php $utente= ucwords($_SESSION['utente']); print "($utente)";?></a><a class="logout" href="login2.php?azione=logout" style="color:#FFF; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; font-size:100%; font-weight:bold; margin-right:1%; margin-left:2%" title="Esci">Esci</a></p>
</div>
<?php
include 'header.php';
print "<p class='saluto'>$utente</p>";
?>
</div>
<div id="menu" style="width:71%;background-color: #0165B6; margin-left: 29%; font-size: 160%; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; color: white; border:1px solid #48aed1;">
<label style="margin-left: 0%"> | </label>
<a href="note.php" style="margin-top:5px; margin-left: 1%; background-color: #0165B6; margin-right: 1%; font-size: 90%; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; color: white" class="scrittemenu" title="Note">Note</a>
<label> | </label>
<a href="chatcomune.php" style="margin-top:5px; margin-left: 1%; background-color: #0165B6; margin-right: 1%; font-size: 90%; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; color: white" class="scrittemenu" title="Chat comune">Chat comune</a>
<label> | </label>
<a href="profile2.php" style="margin-top:5px; margin-left: 1%; background-color: #0165B6; margin-right: 1%; font-size: 90%; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; color: white" class="scrittemenu" title="Bacheca">Bacheca</a>
<label> | </label>
</div>
<div class="sidebar2">
<iframe name="visualizza" width="70%" height="80%" frameborder="1" src="bacheca_visualizza6.php" style="background-color:white; border:1px solid white" scrolling="yes"></iframe>
<iframe name="visualizza3" width="29%" height="80%" src="chat/chatpiccola.php"></iframe>
<center><iframe name="visualizza2" width="100%" height="8%" frameborder="1" src="bacheca_input.php" style="background-color:white; border:1px solid #CCCCCC; background-color:#0165B6" scrolling="no"></iframe></center>
</div>
<table border=0 width=100% cellpadding=0 cellspacing=0>
<div class="sidebar1">
<center>
<?php
error_reporting(E_ALL);
$dati = mysql_query("SELECT foto FROM utenti WHERE username='".$_SESSION['utente']."'");
$risultato= mysql_fetch_array($dati);
$_SESSION['foto'] = $risultato['foto'];
echo <<<EOF
<a href="javascript:Popup('modifica_foto.php')" alt="Modifica la tua foto cliccando qui!" title="Modifica la tua foto cliccando qui!"><img src="uploads/{$risultato['foto']}"></a>
EOF;
?>
<iframe name="visualizza" width="65%" height="20%" frameborder="1" src="infopersonali.php" style="margin-top:10%; background-color:white; border:1px solid black"></iframe>
<p style="margin-top:5%"><a class= "modifica_dati" href="modifica_dati2.php" style="color:white; font-size:120%; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif" title="Modifica i tuoi dati personali cliccando qui!">[modifica dati]</a></p>
<iframe name="visualizza" width="65%" max-height="25%" frameborder="1" src="statoprofilo.php" style="background-color:white; border:1px solid black"></iframe>
<?php
if(!isset($_POST['post'])){ ?>
<form method="post" action="#" id="modificastato" style="alignment-adjust:central">
<ul>
<label for="post" style="font-size:120%; color:white; margin-left:-11%; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif" title="Inserisci il tuo stato nel campo sottostante!">Inserisci il tuo stato:</label>
<br>
<input type="text" name="post" id="post" style="width:65%; height:120%; font-size:120%; border:1px solid black; margin-left:-12%; margin-top:5%" title="Inserisci il tuo stato qui!"/><br>
</ul>
<input type="submit" name="invia" id="salva" value="Salva" style="width:20%; height:9%; color:black; background-color:white; border:1px solid black; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; font-size:110%; margin-bottom:5%" title="Salva"/>
</form>
<?php } else {
// Valori del form
$post = mysql_real_escape_string($_POST['post']);
// Invia dati alla tb utenti
$query="UPDATE utenti SET post='".$post."' WHERE username='".$_SESSION['utente']."'";
$inviautente=mysql_query($query) or die(mysql_error());
header("Refresh: 1; URL= profile2.php?id={$_SESSION['utente']}#");
}
?>
<?php
if(!isset($_POST['cerca'])){ ?>
<form method="post" action="#" id="formricerca" style="alignment-adjust:central">
<input type="text" name="username" id="username" style="margin-bottom:5%; width:65%; height:9%; font-size:120%; border:1px solid black"; placeholder="Cerca una persona qui" title="Cerca una persona qui!"/>
<input type="submit" name="cerca" id="cerca" value="Cerca" style="width:20%; height:9%; color:black; background-color:white; border:1px solid black; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; font-size:110%; margin-bottom:5%" title="Cerca"/>
</form>
<?php } else {
$username = mysql_real_escape_string($_POST['username']);
if($username == ""){
echo "Attenzione, devi compilare tutti i campi";
} else {
$recuperadati = mysql_query("SELECT * FROM utenti WHERE username= '$username'");
$verificadati = mysql_num_rows($recuperadati);
$risultato = ucwords($username);
$risultato2 = strtolower($risultato);
if($verificadati == 1){
echo "<br><a href='result_search2.php?id=".$risultato2."' class='username'>$risultato</a>";
} else {
echo "<p class='noresult'>Nessun risultato trovato!</p>";
}
}
}
?>
</center>
</div>
<center><p style="font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; font-size:150%; color:white">KnowEveryone: una produzione di Giuseppe Ferrara</p></center>
</div>
</body>
</html>
hackersatifal.