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.php:51) in C:\xampp\xampp\htdocs\xxxxxx\librerie\login.inc.php on line 34
il file login.inc.php
Per connetermi con mysql e php e apache uso xampp su windows 7 64bit
Mettendo tutto il sito su altervista funziona tutto.
aiutooooo :incazz2:
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.php:51) in C:\xampp\xampp\htdocs\xxxxxx\librerie\login.inc.php on line 34
Codice:
<?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">
<p>Username:<br />
<input name="usern" type="text" class="textfield" id="usern" size="30"></p>
<p>Password:<br />
<input name="passw" type="password" class="textfield" id="passw" size="30"></p>
<input name="submit" type="submit" value="Login">
</form>
</div>
<?php
pagefooter();
mainfooter();
?>
Codice:
<?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;
}
?>
Per connetermi con mysql e php e apache uso xampp su windows 7 64bit
Mettendo tutto il sito su altervista funziona tutto.
aiutooooo :incazz2:
Ultima modifica: