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 :

Cannot send session cache limiter


Sujet :

Langage PHP

  1. #1
    Membre régulier Avatar de ChTiRiBi
    Inscrit en
    Mai 2008
    Messages
    131
    Détails du profil
    Informations forums :
    Inscription : Mai 2008
    Messages : 131
    Points : 79
    Points
    79
    Par défaut Cannot send session cache limiter
    salut à tous,
    je travaille avec PHP et j'ai un problème avec les sessions .
    ma page testLog.php contient le code suivant:
    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
    <?php
    $_SESSION['user']=$Slog;
    if (!empty ($Slog)) {$Bienvenue="oui";}
    $cache =$_POST['cache'];
    $login =$_POST['login'];
    $mot_de_passe = $_POST['passwd'];
    if ($cache=="OK"){
     
    $sql="SELECT * 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'];
    	$bd_nom=$don['nom_client'];
    	$bd_prenom=$don['prenom_client'];
    	$bd_mail=$don['mail_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['login']=$bd_login; 
    	}
    }
     
    ?>
    elle est incluse dans toutes les pages du site mais au chargement de ces pages, l'erreur suivante apparait:
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\wamp\www\Bibliotheque\index.php:2) in C:\wamp\www\Bibliotheque\index.php on line 2.
    j'ai bien sur mis session_start(); au début de chaque page y compris la page index.
    Merci d'avance.

  2. #2
    Membre actif Avatar de juliens9
    Profil pro
    Développeur Web
    Inscrit en
    Mars 2007
    Messages
    192
    Détails du profil
    Informations personnelles :
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Mars 2007
    Messages : 192
    Points : 237
    Points
    237
    Par défaut
    Ton probleme vient de tes inclusions de page. Donc meme si les pages séparement marche bien, une fois mise ensemble il y a des redondances, et les codes qui est spécifiques au <head></head>, doit etre modifier dans la page incluse.

    Pour rentrer dans les détails, il faut que tu fournisse le ficher index.php et non teslog.php car c'est dans index.php, que l'erreur est présente

  3. #3
    Membre régulier Avatar de ChTiRiBi
    Inscrit en
    Mai 2008
    Messages
    131
    Détails du profil
    Informations forums :
    Inscription : Mai 2008
    Messages : 131
    Points : 79
    Points
    79
    Par défaut
    vous pouvez indiquer au niveau de quoi il y a des redondances?
    voici le fichier index.php
    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
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    <!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>
    <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" />
    				<script type="text/javascript" language="javascript">
    				<!--verification pour les champ du formulaire de recherche-->
    				function verif(Form) {
    				var varcach = document.getElementById('cache');
     
    				if(Form.login.value=="")
    				{
    				alert('veuillez saisir votre login!');
    				return false;
    				}
    				if(Form.passwd.value=="")
    				{
    				alert('veuillez saisir votre mot de passe!');
    				return false;
    				}
    				else
    				{varcach.value ='OK';
     
    				document.Form.submit();
    				}
    				}
    				</script>
    </HEAD>
    <BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
    <?php
    include ('connexionBD.php');
    include('date.php'); 
    ?>
    <table width="770" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
      <tr >
        <td align="center" valign="top">
    	<table align="center" width="770" height="27" border="0" cellpadding="0" cellspacing="0" background="images/index_49.jpg">
     
          <tr>
     
            <td width="166"></td>
            <td width="106" ><div align="center" class="style31"><a href="index.php">Acceuil</a></div></td>
            <td width="113" ><div align="center"><span class="style31"><a href="votre_compte.php">Votre compte </a></span></div></td>
            <td width="96" ><div align="center"><span class="style31"><a href="contact.php">Contact</a></span></div></td>
            <td width="113" ><div align="center"><span class="style31"><a href="login_admin.php">Espace admin</a></span></div></td>
     
    		<td width="175"></td>
            <td width="1"></td>
          </tr>
        </table>
          <table width="770" border="0" cellspacing="0" cellpadding="0" background="images/bibliotheque2.jpg">
            <tr>
              <td width="10" align="center" >&nbsp;</td>
              <td width="589" valign="top"><table width="299" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td></td>
                </tr>
                <tr>
                  <td></td>
                </tr>
     
                <tr>
                  <td><table width="299" border="0" cellspacing="0" cellpadding="0">
     
                    <tr>
                      <td width="228" ><?php include('recherche.php') ?></td>
                      <td><table width="71" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td></td>
                        </tr>
     
                        <tr>
                          <td></td>
                        </tr>
     
                        <tr>
                          <td></td>
                        </tr>
                      </table></td>
                    </tr>
     
                  </table></td>
                </tr>
              </table></td>
              <td width="40"></td>
     
              <td width="131" class="style14" valign="top"><?php $date= Date_fr(); echo $date;?></td>
            </tr>
          </table>
     
          <table width="759" border="0" cellspacing="0" cellpadding="0" >
     
            <tr>
    			<td width="51" valign="top" align="left">&nbsp;</td>
           	  <td width="376" height="115" valign="top" align="left">
    	  		<font color="#528BE0" face="Edwardian Script ITC" size="+6">
      			<b>Biblioth&egrave;que En Ligne</b>			</font>		  </td>
              <td width="332" align="left" valign="top">
    		  	<?php
    				include('inser_exclusivite.php');
    			?>
    		  </td>
            </tr>
          </table>
          <table width="770" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="250" align="center"valign="top"><table width="226" border="0" cellspacing="0" cellpadding="0">
     
                <tr>
                  <td height="158" valign="bottom" background="images/index_31.jpg">
    			  <table width="226" border="0" cellspacing="0" cellpadding="0">
    			     <tr>
                      <td>
    					  <?php include ('form_login.php'); ?>				  </td>
                    </tr>
    			     <tr>
                       <td>&nbsp;</td>
    			       </tr>
                     <tr>
                       <td>&nbsp;</td>
                     </tr>
     
                    <tr>
                      <td><a href="top10.php"><span class="style16">TOP Livres:</span></a></td>
                    </tr>
                  </table></td>
                </tr>
     
                <tr>
                  <td><table width="226" border="0" cellspacing="0" cellpadding="0">
                    <tr>
     
                      <td height="20" colspan="2"><span class="style16">&nbsp;</span></td>
                      </tr>
                    <tr>
                      <td width="20" valign="top"><IMG SRC="images/1.gif" WIDTH=20 HEIGHT=20 ALT=""></td>
                      <td valign="top" background="images/fond_bleu.gif"><span class="style14">fonte lactis ubertim manante:</span><span class="style15"> atque aundante opis egentissimum et illoa dhuc uno alimento vitam ucentemon sortem non pati. sed blande tole ran tur haec, non quia .</span></td>
     
                    </tr>
                    <tr align="right">
     
                      <td height="20" colspan="2"><input type="image" src="images/savoir.jpg"></td>
                      </tr>
                  </table></td>
                </tr>
                <tr>
                  <td><table width="226" border="0" cellspacing="0" cellpadding="0">
     
                    <tr>
                      <td height="20" colspan="2"></td>
     
                    </tr>
                    <tr>
                      <td width="20" valign="top"><IMG SRC="images/2.gif" WIDTH=20 HEIGHT=20 ALT=""></td>
                      <td valign="top" background="images/fond_bleu.gif"><span class="style14">fonte lactis ubertim manante:</span><span class="style15"> atque aundante opis egentissimum et illoa dhuc uno alimento vitam ucentemon sortem non pati. sed blande tole ran tur haec, non quia .</span></td>
                    </tr>
     
                    <tr align="right">
                      <td height="20" colspan="2"><input type="image" src="images/savoir.jpg"></td>
     
                    </tr>
                  </table></td>
                </tr>
                <tr>
                  <td><table width="226" border="0" cellspacing="0" cellpadding="0">
                    <tr>
     
                      <td height="20" colspan="2"></td>
                    </tr>
     
                    <tr>
                      <td width="20" valign="top"><IMG SRC="images/3.gif" WIDTH=20 HEIGHT=20 ALT=""></td>
                      <td valign="top" background="images/fond_bleu.gif"><span class="style14">fonte lactis ubertim manante:</span><span class="style15"> atque aundante opis egentissimum et illoa dhuc uno alimento vitam ucentemon sortem non pati. sed blande tole ran tur haec, non quia .</span></td>
                    </tr>
                    <tr align="right">
     
                      <td height="20" colspan="2"><input type="image" src="images/savoir.jpg"></td>
     
                    </tr>
                  </table></td>
                </tr>
                <tr align="right">
                  <td><a href="top10.htm"><input name="image2" type="image" src="images/suite.gif" align="right" /></a></td>
                </tr>
              </table></td>
     
              <td width="520" align="center" valign="top"><table width="497" height="557" border="0" cellpadding="0" cellspacing="0">
     
                <tr>
                  <td width="497" height="27"><span class="style7">Bienvenue Dans Notre Biblioth&egrave;que en Ligne ! </span></td>
                </tr>
                <tr>
                  <td class="style20"><p>Notre biblioth&egrave;que a pour mission d'offrir &agrave; tout le monde les ressources documentaires n&eacute;cessaires  toutes cat&eacute;gories de visiteurs.</p>
                    <p><?php include('nbre_total.php');?> ouvrages de th&egrave;mes diff&eacute;rents sont &agrave; votre disposition ! Soyez les bienvenus ! </p></td>
                </tr>
                <tr>
                  <td height="46" align="center" valign="middle"><span class="style22">NOS D&Eacute;PARTEMENTS  </span></td>
                </tr>
                <tr>
                  <td align="center"><table width="463" height="388" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="220" align="center"><a href="enfant.php"><span class="style23">Enfant</span></a></td>
                      <td width="220" align="center"><a href="adulte.php"><span class="style23">Etudiant-Adulte</span></a></td>
                    </tr>
                    <tr>
                      <td height="183" valign="top"><table width="220" height="161" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td height="10" colspan="2"></td>
                          </tr>
                          <tr>
                            <td width="110" height="121" valign="top"><img src="images/livre_enfants.gif" width=110 height=137 alt="" /></td>
                            <td align="center" valign="middle" background="images/wp68a3eacc.jpg">
    							<p class="style24">
    								<?php include('nbre_enfant.php'); ?>
    							</p>
    						</td>
                          </tr>
                          <tr>
                            <td height="10" colspan="2"></td>
                          </tr>
                      </table></td>
                      <td align="right" valign="top"><table width="220" height="161" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td height="10" colspan="2"></td>
                          </tr>
                          <tr>
                            <td width="110" valign="top"><img src="images/self_help_library_home.jpg" width=110 height=137 alt="" /></td>
                            <td align="center" valign="middle" background="images/wp68a3eacc.jpg">
    							<p class="style24">
    								<?php include('nbre_adulte.php'); ?>
    							</p>
    						</td>
                          </tr>
                          <tr>
                            <td height="10" colspan="2"></td>
                          </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td align="center"><a href="art_loisir.php"><span class="style23">Arts &amp; Loisirs </span></a></td>
                      <td align="center"><a href="media.php"><span class="style23">M&eacute;dia</span></a></td>
                    </tr>
                    <tr>
                      <td valign="top"><table width="220" height="161" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td height="10" colspan="2"></td>
                          </tr>
                          <tr>
                            <td width="110" valign="top"><img src="images/magazines.gif" width=110 height=137  /></td>
                            <td align="center" valign="middle" background="images/wp68a3eacc.jpg">
    							<p class="style24">
    								<?php include('nbre_loisir.php'); ?>
    							</p>
    						</td>
                          </tr>
                          <tr>
                            <td height="10" colspan="2"></td>
                          </tr>
                      </table></td>
                      <td align="right" valign="top"><table width="220" height="161" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td height="10" colspan="2"></td>
                          </tr>
                          <tr>
                            <td width="110" valign="top"><img src="images/crates.jpg" width=110 height=137  /></td>
                            <td align="center" valign="middle" background="images/wp68a3eacc.jpg">
    							<p class="style24">
    								<?php include('nbre_media.php'); ?>
    							</p>
    						</td>
                          </tr>
                          <tr>
                            <td height="10" colspan="2"></td>
                          </tr>
                      </table></td>
                    </tr>
                  </table></td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                </tr>
              </table></td>
     
            </tr>
          </table>
          <table width="770" border="0" cellpadding="0" cellspacing="0" background="images/index_49.jpg">
            <tr>
              <td width="17"><IMG SRC="images/index_49.jpg" WIDTH=17 HEIGHT=28 ALT=""></td>
              <td align="center" class="style3 style18"><a href="index.php">Acceuil</a> &nbsp;&nbsp;&nbsp;&nbsp;| &nbsp;&nbsp;&nbsp;&nbsp;<a href="votre_compte.php">Votre compte</a>&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp; <a href="contact.php">Contact</a>&nbsp;&nbsp;&nbsp;&nbsp;| &nbsp;&nbsp;<a href="login_admin.php">Espace admin</a>&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp; <a href="a_propo.php">A propos </a></td>
     
              <td width="17">&nbsp;</td>
            </tr>
          </table>
          <table width="770" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="20" align="right"><em class="style13"><strong>Powered by Mokadem Marwen &amp; Zammouri Imen<br />
    &copy; ALL RIGHTS RESERVED</strong></em></td>
     
            </tr>
     
          </table></td>
      </tr>
    </table>
    </BODY>
    </HTML>
    merci

  4. #4
    Membre émérite

    Profil pro
    Inscrit en
    Mai 2008
    Messages
    1 576
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2008
    Messages : 1 576
    Points : 2 440
    Points
    2 440
    Par défaut
    Est-ce que connexionBD.php ou date.php font appel aux sessions ? Si oui, il faut faire l'inclusion tout au début de index.php, avant même le "<!DOCTYPE html PUBLIC" et avec rien (même pas un espace) avant.

  5. #5
    Membre régulier Avatar de ChTiRiBi
    Inscrit en
    Mai 2008
    Messages
    131
    Détails du profil
    Informations forums :
    Inscription : Mai 2008
    Messages : 131
    Points : 79
    Points
    79
    Par défaut
    connexionBD contient les requêtes de connexion a la base:
    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
    <?php
    /* Paramtres persos*/
    $host = "localhost"; // voir hbergeur
    $user = "root"; // vide ou "root" en local
    $pass = ""; // vide en local
    $bd = "bibliotheque"; // nom de la BD
     
    // connexion au serveur 
    $lien = mysql_connect($host, $user, $pass);
    if ($lien ==0)
    echo("impossible d'etablir la connexion");
    // selection de la base de données
    if(mysql_select_db($bd, $lien) == 0)
    echo("impossible de se connecter a la base");
     
    ?>
    et date.php contient juste un code qui affiche la date en français

  6. #6
    Membre émérite

    Profil pro
    Inscrit en
    Mai 2008
    Messages
    1 576
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2008
    Messages : 1 576
    Points : 2 440
    Points
    2 440
    Par défaut
    Je n'avais pas lu la totalité de index.php. L'un des fichiers php que tu inclus doit forcément faire appel à une session. A moins que tu n'inclus testLog.php depuis index.php, auquel cas session_start() ne marche pas parce que tout le contenu de index.php est affiché avant.
    Il y a une règle très simple pour les sessions : aucun output ne doit les précéder. Output veut dire un envoi de texte au navigateur, que ce soit un texte lisible, une balise html (y compris le début, avec les doctype, <head>,...) ou même un espace blanc. Si tu t'assures que cette condition est remplie, il n'y aura aucun problème.

  7. #7
    Membre régulier Avatar de ChTiRiBi
    Inscrit en
    Mai 2008
    Messages
    131
    Détails du profil
    Informations forums :
    Inscription : Mai 2008
    Messages : 131
    Points : 79
    Points
    79
    Par défaut
    Apparemment le problème vient de ma machine ou pour être plus précis du serveur wamp que j'utilise, en changeant de PC sa marche

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

Discussions similaires

  1. Réponses: 9
    Dernier message: 14/10/2012, 14h35
  2. [PHP 5.0] Message "Cannot send session cache limiter"
    Par mims1664 dans le forum Langage
    Réponses: 11
    Dernier message: 13/07/2009, 12h08
  3. Réponses: 10
    Dernier message: 19/06/2008, 14h27
  4. Réponses: 2
    Dernier message: 18/12/2007, 21h59
  5. Réponses: 1
    Dernier message: 24/06/2007, 20h16

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