IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

header alredy sent by (output started


Sujet :

Langage PHP

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé Avatar de King_T
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mai 2006
    Messages
    157
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2006
    Messages : 157
    Par défaut header alredy sent by (output started
    salut,
    je travail sur un projet avec php/mysql.
    je voulais utiliser les sessions, mais à chaque fois l'erreur suivante apparait:
    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\wamp\www\Bibliotheque\index.php:8) in C:\wamp\www\Bibliotheque\testLog.php on line 2
    je suis ouvert a toutes les propositions
    merci pour votre aide

  2. #2
    Membre confirmé
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    41
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2007
    Messages : 41
    Par défaut
    Salut,
    il faut que tu mettes ton ouverture de session plus tôt. Ca doit être ta première instruction dans ton code..

  3. #3
    Membre confirmé Avatar de King_T
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mai 2006
    Messages
    157
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2006
    Messages : 157
    Par défaut
    je l'ai mise dans le <head> mais ça na rien donné

  4. #4
    Membre confirmé
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    41
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2007
    Messages : 41
    Par défaut
    Peux tu mettre le code de ta page stp ?

  5. #5
    Membre confirmé Avatar de King_T
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mai 2006
    Messages
    157
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2006
    Messages : 157
    Par défaut
    voici la page html:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    <!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>
    <?php include('testLog.php'); ?>
     
    <TITLE>Bibliothèque En Ligne</TITLE>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
    <link rel="stylesheet" type="text/css" href="style_bib.css" />
     
     
    </HEAD>
    <body>
    <form name="Form" method="post">
     
    					  <input name="cache" id="cache" value="NOK" type="hidden" />
    					<table border="0" align="center" height="100%" width="100%" class="style1" background="images/butbg.jpg">
     
     
    						<?php if ($Bienvenue!="oui"){ ?>
    						<tr height="20%">
    							<td width="46%" class="style311">
    								Login:							</td>
    							<td width="54%">
    								<input align="top" type="text" name="login" size=15 maxlength=20>
    							  <br />							</td>
    						</tr>
    						<tr height="20%">
    							<td width="46%" class="style311">
    								Mot De Passe:							</td>
    							<td >
    								<input align="top" type="password" name="passwd" size=15 maxlength=20></td>
    								</tr>
    						<?php } ?>
     
    						<?php if ($Bienvenue=="oui") { ?>
    						<tr height="20%">
    						<td width="100%" class="style311">Bienvenue <?php echo "$login" ?> </td>
     
    						</tr>
    						<?php } ?>
     
     
    						<tr height="20%">
    							<td colspan="2" align="right" >
    							<input name="image" type="image" onClick="verif(Form)" src="images/OK.gif" align="top">
    							</td>
    						</tr>
    						<!--affichage du message d erreur du form recherche-->
    						<?php 
    						if ($test_rech_L=="oui"){ ?>
    						<tr height="20%">
    							<td colspan="2" align="right" class="style9">
    						login incorrect!!
    							</td>
    						</tr><?php } ?>
    						<?php
    						if ($test_rech_P=="oui"){ ?>
    						<tr height="20%">
    							<td colspan="2" align="right" class="style9" >
    						Mot de passe incorrect!!
    							</td>
    						</tr><?php } ?>
    						<tr height="20%">
    							<td colspan="2" align="right" >
    								<a href="form.php"  class="style231"> 
    									<i>Vous n&acute;&ecirc;tes pas inscrit?</i>								</a>							</td>
    						</tr>
    						<tr height="20%">
    							<td colspan="2" align="right" >
    								<a href="mot_passe_oublie.php">
    									<i>Mot de passe oubli&eacute;?</i></a>							</td>
    					  </tr>
    				  </table>
    				</form>
    				</body>
    				</HTML>


    et la page php incluse:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    <?php
    session_start();
    $Slog=$_SESSION['user'];
    if (!empty ($Slog)) {$Bienvenue="oui";}
    $cache =$_POST['cache'];
    $login =$_POST['login'];
    $mot_de_passe = $_POST['passwd'];
    if ($cache=="OK"){
     
    $sql="SELECT login_client, mot_passe_client FROM client WHERE login_client='$login'";
    $log=mysql_query($sql);
    while($don=mysql_fetch_assoc($log))
    {
    	$bd_login=$don['login_client'];
    	$bd_passwd=$don['mot_passe_client'];
    }
     
    $sql2="SELECT mot_passe_client FROM client WHERE mot_passe_client='$mot_de_passe'";
    $pwd=mysql_query($sql2);
    while($don=mysql_fetch_assoc($pwd))
    {
    	$pss=$don['mot_passe_client'];
    }
    $test_rech_L="non";
    $test_rech_P="non";
     
    if (empty($bd_login)) {$test_rech_L="oui";}
    elseif(empty($pss)){$test_rech_P="oui";}
    elseif ($pss!=$bd_passwd) {$test_rech_P="oui";}
    else {$Bienvenue="oui";
    session_start();
    session_register('user');
    $_SESSION['user']=$bd_login;
    }
    }
     
    ?>
    merci

  6. #6
    Membre confirmé
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    41
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2007
    Messages : 41
    Par défaut
    Sort le session_start de ton fichier include ou alors fqis le include avant même le DOCTYPE..

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    <?php include('testLog.php'); ?>
    <!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">....

  7. #7
    Membre confirmé Avatar de King_T
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mai 2006
    Messages
    157
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2006
    Messages : 157
    Par défaut
    ça ne donne rien , toujours la meme erreur

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 9
    Dernier message: 14/01/2016, 23h20
  2. [FPDF] fpdf : Cannot modify header information - headers already sent by (output started a
    Par antoine.dumaine dans le forum Bibliothèques et frameworks
    Réponses: 3
    Dernier message: 16/04/2010, 14h52
  3. session start et headers already sent
    Par corsamobile dans le forum Langage
    Réponses: 2
    Dernier message: 23/05/2008, 13h22
  4. [Cookies] Warning : headers already sent
    Par arti2004 dans le forum Langage
    Réponses: 8
    Dernier message: 04/04/2006, 16h31
  5. [JpGraph] Header already sent
    Par grunk dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 09/02/2006, 16h54

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo