[PHP]headers already sent by...

Statut
N'est pas ouverte pour d'autres réponses.
Code:
<?
$base = mysql_connect ('localhost', '*****', '******'); 
mysql_select_db('silly', $base);

$sql = "SELECT password,user_name FROM admin WHERE password='$password' AND user_name='$user_name'";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error()); 
while ($data = mysql_fetch_array($req)) {
$user_name = stripslashes($data['user_name']);
$password = stripslashes($data['password']);


if($_POST["password"]==''.$password.'' and $_POST["user_name"]==''.$user_name.'')
{
setcookie("passe2","ok");

print "<META HTTP-EQUIV=Refresh CONTENT=\"1;url=index.php3\">";}


elseif(@$_GET["password"]!=''.$password.'' and @$_GET["user_name"]!= ''.$user_name.'') {
setcookie("passe2");

}
}

$isOK = (@$_COOKIE["passe2"]!="");

if($isOK) { ?>
<? 
} else { ?><head>
<link href="style.css" rel="stylesheet" type="text/css"> 
</head>

<table border=0 bordercolor="#000000" cellpading=0 cellspacing=0  width="140">
  <tr>
    <td background="haut.gif" width="140" height="12"><p align="center"></p></td>
  </tr>
  <tr>
    <td background="haut2.gif"><p align="center">:: Login ::</p></td>
  </tr>
  <tr>
    <td background="middle.gif">
	   <form method="post">
      <table><tr>
         <td align="center" valign="top"><input type="user_name" name="user_name" size="10"></td></tr><tr>
		<td align="center" valign="top"><input type="password" name="password" size="10"></td></tr><tr>
         <td align="center" valign="top"><input type="Submit" value="Entrer"></td></tr><tr>
      </tr></table>
   </form>
	</td>
  </tr>
  <tr>
  <td background="bas.gif"width="140" height="12"><p align="center"></p></td>
  </tr>
</table>
<? }  ob_end_flush(); ?>

Qqu peux m'aide plz vais pete une case je trouve nul par pk il me fait cette erreur la
Code:
Warning: Cannot modify header information - headers already sent by (output started at /var/www/free.fr/6/a/prout/fruit/index.php3:1) in /var/www/free.fr/6/a/prout/fruit/block_authentication.php3 on line 17
et a la ligne 17 cest setcookie("passe2","ok");
pour explication cest un block qui se trouve dans la page principale koi...
 

Hacko

Elite
tes cookies doivent être garnis avant tout envoi d'informations vers le client
 

Styleman

Touriste
Hacko a dit:
tes cookies doivent être garnis avant tout envoi d'informations vers le client
Allez quoi j'allais le dire :p
 

Styleman

Touriste
Fruitos[silly a dit:
]
Hacko a dit:
tes cookies doivent être garnis avant tout envoi d'informations vers le client
traduction? lol
ça veut dire que tu ne peux pas avoir de code html avant les cookies quoi, c'est assez chiant mais c'est comme ça :?

donc il faut que tu mettre ton cookie avant tout code html, et meme si il y a un espace apres le <? ça foire je pense, donc voila quoi...
 
1er
OP
F
Styleman a dit:
Fruitos[silly a dit:
]
Hacko a dit:
tes cookies doivent être garnis avant tout envoi d'informations vers le client
traduction? lol
ça veut dire que tu ne peux pas avoir de code html avant les cookies quoi, c'est assez chiant mais c'est comme ça :?

donc il faut que tu mettre ton cookie avant tout code html, et meme si il y a un espace apres le <? ça foire je pense, donc voila quoi...
ahh ouai donc laisse tombe mon include que j'ai fait dans ma pages index koi :? mhhh hmhhhh j'arriverai jamais a mettre ca en 1er ligne ... :?
 

guslinux

Gamerz'ien
PAS D'echo() ou de print() AVANT UN header(), une action sur session ou encore une gestion de cookie :!:
 
Statut
N'est pas ouverte pour d'autres réponses.
Haut