Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1566 connectés 

  FORUM HardWare.fr
  Programmation
  PHP

  Warning: Cannot modify header information - headers already sent by..

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Warning: Cannot modify header information - headers already sent by..

n°2069614
adeel-fbf
Posté le 13-04-2011 à 01:21:58  profilanswer
 

Salut a tous,
 
j'obtient cette erreur la :  
 
Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/forum/authentification.php:10) in /Applications/MAMP/htdocs/forum/authentification.php on line 38

 
Voici mon code :  

Code :
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <title>Document sans nom</title>
  6. </head>
  7. <body>
  8. <h1>Authentification</h1>
  9. <?php
  10. if (isset($_POST['valider']))
  11. {
  12. $login= $_POST['login'];
  13. $password= $_POST['password'];
  14. $password = md5($password);
  15. $pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
  16. $bdd = new PDO('mysql:host=localhost; dbname=forum', 'root', 'root', $pdo_options);
  17. $req = $bdd->prepare
  18. (" SELECT password
  19.  FROM users where username='$login'" );
  20. $req->execute();
  21. $mdp = $req->fetchAll(PDO::FETCH_ASSOC);
  22. $password_md5 = $mdp[0]['password'];
  23. if($password_md5 != $password)
  24. {
  25. echo "erreur de mot de saisie";
  26. }
  27. else
  28. {
  29. header("Location: index2.php" );
  30. }
  31. }
  32. ?>
  33. <form id="authentification" method="post">
  34. <label>Username: </label>
  35. <input id="login" name="login" type="text" />
  36. <label>Password: </label>
  37. <input id="password" name="password" type="text" />
  38. <input type="submit" name="valider"/>
  39. </form>
  40. </body>
  41. </html>


 
Quelqu'un peut m'aider?
 
merci :)  
 


Message édité par adeel-fbf le 13-04-2011 à 01:22:18
mood
Publicité
Posté le 13-04-2011 à 01:21:58  profilanswer
 

n°2069621
esox_ch
Posté le 13-04-2011 à 07:11:16  profilanswer
 

oui, cherche un peu.
Ta question a déjà été posée 450 fois sur ce forum


---------------
Si la vérité est découverte par quelqu'un d'autre,elle perd toujours un peu d'attrait
n°2069674
Paulp
~, sweet ~
Posté le 13-04-2011 à 11:04:42  profilanswer
 
n°2069692
rufo
Pas me confondre avec Lycos!
Posté le 13-04-2011 à 11:31:54  profilanswer
 

L38 : faire une redirection alors que t'as déjà écrit dans la page html, ça peut pas marcher :o


---------------
Astres, outil de help-desk GPL : http://sourceforge.net/projects/astres, ICARE, gestion de conf : http://sourceforge.net/projects/icare, Outil Planeta Calandreta : https://framalibre.org/content/planeta-calandreta

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  PHP

  Warning: Cannot modify header information - headers already sent by..

 

Sujets relatifs
Header d'authentification en PHPProbleme dans le Header de ListView
Petit problème php Warning: session_start..Petit problème php Warning: session_start..
Warning: session_start() [function.session-start]: Cannot send....Header tout seul qui ne fonctionne pas
Fatal error: Cannot instantiate non-existent class: sqlitedatabaseCannot send session cookie
[PHP] Warning: Cannot modify header information - headers already...Warning: Cannot modify header information - headers already sent by
Plus de sujets relatifs à : Warning: Cannot modify header information - headers already sent by..


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR