Ho guardato in giro per la rete il significato dell'errore e ho capito che potrebbe capitare che stampo qualcosa prima del header ma nel mio codice non sembra cosi non ditemi di guardare
http://kb.creativepark.it/kb/entry/4/ già fatto.
Ecco l'errore
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\xampp\htdocs\xxxxxx\include\common.inc.ph p:51) in C:\xampp\xampp\htdocs\xxxxxx\librerie\login.inc.ph p on line 34
il file login.inc.phpcodice:<?php session_start(); require_once("librerie/login.inc.php"); include("include/common.inc.php"); require_once("librerie/config.inc.php"); require_once("librerie/db.php"); if (isset($_POST['usern'])) { $result = esegui_login($_POST['usern'],$_POST['passw']); $error_message = $result; } mainheader("login"); pageheader(); ?> <div> <p class="error"><?php echo $error_message; ?></p> <form method="post" name="login"> Username: <input name="usern" type="text" class="textfield" id="usern" size="30"></p> Password: <input name="passw" type="password" class="textfield" id="passw" size="30"></p> <input name="submit" type="submit" value="Login"> </form> </div> <?php pagefooter(); mainfooter(); ?>
aiutooooocodice:<?php function verifica_login() { if (is_null($_SESSION['user'])) { return false; } else { return true; } } function esegui_login($username, $password) { $sql = 'SELECT username, livello FROM users WHERE username = \''.$username.'\' AND password = \''.$password.'\''; $result = db_query($sql); if (db_num_rows($result) == 1) { $row = db_fetch_assoc($result); $_SESSION['user'] = $row['username']; $_SESSION['livello'] = $row['livello']; if($_SESSION['livello']==0) { header('Location: index.php'); } else if ($_SESSION['livello']==1) { header('Location: amministratore.php'); } } else { $errorMessage = 'Username o password errati'; } } return $error_message; } ?>![]()

Rispondi quotando