ciao gente.
mi sapreste aiutare:
ho questo schema:
header.php
starter.php (contiene una parte di scrit per caricare le immagini per la navigazione)
login.php
elabora_login.php
header contiene solo codice html coi css.
starter NON contiene alcn header
login è una pagina html che contiene un form e qualche script per le immagini,
elabora contiene:
Codice PHP:
<?php
include_once('script/check_login.php');
include('header.php');
include('starter.php');
include('script/conn.php');
if(!$_POST['username'] | !$_POST['password']){
echo'<h1 align=center >:: Errore ::</h1>Devi inserire tutti i campi<br>';
echo"<a href=javascript:history.back()>Indietro</a>";
exit;
}
$usern = $_POST['username'];
$query = "SELECT * FROM utenti WHERE username='$usern'";
$check = mysql_query($query);
if(!$check){
die(mysql_error());
}
$row = mysql_fetch_array($check);
if($check && mysql_num_rows($check)<=0){
die("<h1 align=center>:: Errore ::</h1>Non risulti registrato. <br>Torna <a href=javascript:history.back()>Indietro</a> <br>oppure <a href='reg.php'> Registrati</a>.");
}
$passw = md5($_POST['password']);
if($passw != $row['password']){
die('<h1 align=center>:: Errore ::</h1>Password inserita <b>NON</b> corretta!. Torna <a href=javascript:history.back()>Indietro</a> ');
}
else{
header("Refresh: 3; URL=index.php"); //GUARDA QUI
$_SESSION['username'] = $usern;
$_SESSION['password'] = $passw;
if($_POST['auto_log']){
setcookie('autolog','loggato',time()+864000);
setcookie('user',$usern,time()+864000);
setcookie('pw',$passw,time()+864000);
}
echo"<h1>:: Bentornato $usern ::</h1>Login effettuato con successo! Attendi il reindirizzamento in 3 secondi...<br>Oppure <a href=index.php> clicca qui per tornare alla home page</a>.";
}
include("footer.php");
?>
mi sapreste dire perchè al login effettuato con successo, ricevo il classico messaggio d'errore:
Warning: Cannot modify header information - headers already sent by (output started at C:\WM\www\lsdBlogs\starter.php:59) in C:\WM\www\lsdBlogs\login.php on line 30
e la stessa cosa al logout?
ora, posso pure togliere il redirect, ma mi rode!
grazie
PS:
PAGINA STARTER.PHP
Codice PHP:
<?
$load = $_GET['page'];
if($load == ''){
$load = 'index';
}
$pos = strstr($load,'S') ;
if($pos){
$path = '../';
$load = substr($load,1,strlen($load));
}
else{
$path = '';
}
?>
<body>
<div align="center" style="position:absolute; top: 0; width:734px; height:133px; z-index:4; left: 20%; background-image: url(<? echo $path."img/menu.jpg)"; ?>; border: 1px none #000000;"></div>
<div id="barramenu" style="position:absolute; top:97px; width:734px; height:45px; z-index:5; border: 1px none #000000; left: 20%;">
<?
if($load == 'index'){
echo"<img src=\"".$path."img/menuHome.jpg\" width=\"735\" height=\"47\" border=\"0\" usemap=\"#Map\"> ";
}
elseif($load == 'lista'){
echo"<img src=\"".$path."img/menuLista.jpg\" width=\"735\" height=\"47\" border=\"0\" usemap=\"#Map\"> ";
}
elseif($load == 'richiedi'){
echo"<img src=\"".$path."img/menuRichiedi.jpg\" width=\"735\" height=\"47\" border=\"0\" usemap=\"#Map\"> ";
}
elseif($load == 'fam'){
echo"<img src=\"".$path."img/menufamily.jpg\" width=\"735\" height=\"47\" border=\"0\" usemap=\"#Map\"> ";
}
elseif($load == 'faq'){
echo"<img src=\"".$path."img/menuFAQ.jpg\" width=\"735\" height=\"47\" border=\"0\" usemap=\"#Map\"> ";
}
?>
<map name="Map">
<area shape="rect" coords="10,7,161,44" href="<? echo $path."index.php?page=index"; ?> ">
<area shape="rect" coords="170,7,321,42" href="<? echo $path."lista.php?page=lista"; ?> ">
<area shape="rect" coords="332,8,484,45" href="<? echo $path."richiedi.php?page=richiedi"; ?> ">
<area shape="rect" coords="495,10,648,52" href="<? echo $path."family.php?page=fam"; ?> ">
<area shape="rect" coords="658,10,729,44" href="<? echo $path."faq.php?page=faq"; ?> ">
</map>
</div>
<div id="centratore" style="position: absolute; top:110px; left: 19%; z-index:1">
<div class="angolo">
<div class="top-left-corner">
<div class="top-left-inside">•</div>
</div>
<div class="bottom-left-corner">
<div class="bottom-left-inside">•</div>
</div>
<div class="top-right-corner">
<div class="top-right-inside">•</div>
</div>
<div class="bottom-right-corner">
<div class="bottom-right-inside">•</div>
</div>
<div class="box-contents">
<br><br><br>