un message d'erreur concernant les sessions en php.
Posté : 31 mai 2005, 15:30
Bonjour à tous et j'éspere qu'il y a quelqu'un qui pourrait m'aider.Merci d'avance.
Voila le message d'erreur que j'ai après exécution(Avec Easy-php):
"Warning: Cannot modify header information - headers already sent by (output started at c:\program files\easyphp1-8\www\php\auth.php:9) in c:\program files\easyphp1-8\www\php\auth.php on line 34"
Le code est le suivant:
Voila le message d'erreur que j'ai après exécution(Avec Easy-php):
"Warning: Cannot modify header information - headers already sent by (output started at c:\program files\easyphp1-8\www\php\auth.php:9) in c:\program files\easyphp1-8\www\php\auth.php on line 34"
Le code est le suivant:
<?php session_start (); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Document sans titre</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
function CheckUser($login,$md5)
{
if($login=="user" && $md5=="ab4f63f9ac65152575886860dde480a1")
return true;
return false;
}
?>
<?php
if(!isset($_POST['md5']))
{
header("Location: ../login.php");
die();
}
$md5=$_POST['md5'];
if(!isset($_POST['login']))
{
header("Location: ../login.php");
die();
}
$login=$_POST['login'];
if(!CheckUser($login,$md5))
{
(ligne34)-----> header("Location: ../login.php");
die();
}
session_start();
$_SESSION['last_access']=time();
$_SESSION['ipaddr']=$_SERVER['REMOTE_ADDR'];
$_SESSION['user']=$login;
header("Location: ../page.php");
?>
</body>
</html>