Ciao ragazzi ho un problema con le sessioni, ho letto i vari post degli utenti ma purtroppo io non sono riuscito a risolvere. Vi posto il codice per vedere se ci sono errori.
pagina login.php
Codice PHP:
<?php
session_start();
$_SESSION['username1'] = $_POST['username'];
$_SESSION['password1'] = $_POST['password'];
$_SESSION['NumeroPagine'] = 1;
?>
<!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>
<meta http-equiv="Content-Language" content="it" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Senza nome 1</title>
<style type="text/css">
.style1 {
text-align: center;
}
</style>
</head>
<body style="color: #FFFFFF; background-color: #000000">
<div class="style1">
<div class="style1">
<p class="style1">[img]2.png[/img]</p>
</div>
</div>
<form action = "verifica.php" method="post">
<div class="style1">
<input type = "submit" VALUE = "Accedi all'area riservata">
</div>
</form>
</body>
</html>
Pagina verifica.php
Codice PHP:
<?php
session_start();
$_SESSION['NumeroPagine'] += 1;
if($_SESSION['username1'] == "root" && $_SESSION['password1'] == "admin")
{ $url = "fd8287a9ccd43u8geht3gewy/";
header("Location: $url");
}
else {
$url = "error.php";
header("Location: $url");
}
?>
Cosa c'è di sbagliato in quello che ho scritto?
Nella pagina login.php mi da questi errori:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /stu$/sito/www/login.php:1) in /stu$/sito/www/login.php on line 2
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /stu$/sito/www/login.php:1) in /stu$/sito/www/login.php on line 2
Nella pagina verifica.php mi da questo errore:
Warning: Cannot modify header information - headers already sent by (output started at /stu$/sito/www/verifica.php:1) in /stu$/sito/www/verifica.php on line 10