messages d'erreurs avec session_start() ;

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : messages d'erreurs avec session_start() ;

par Invité » 01 déc. 2006, 20:46

salut,

Jai suivi ton conseil, cela fonctionne mais, bien sûr d'autres messages d'erreurs identiques sont apparus avec d'autres noms de fichier.
J'ai donc continué la même procédure aux fichiers indiqués dans les messages d'erreurs.

J'arrive maintenant à l'index et si je suis la même procédure alors là c'est la cata.. .

Voici le nouveau message d'erreur
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home4/s/sitweb-chr/www/index3.php:16) in /home4/s/sitweb-chr/www/pagep/qcm.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home4/s/sitweb-chr/www/index3.php:16) in /home4/s/sitweb-chr/www/pagep/qcm.php on line 2
Le fichier index3.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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>QCMRESTO.COM</title>
</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="10"><?php include('entete3.php'); ?></td>
    </tr>
   <tr>
    <td width="15%" rowspan="6" valign="top"><?php include('menug.php'); ?></td>
    <td width="70%" colspan="8" rowspan="5" valign="top">
  <?php //ligne 16//
  $pageOK = array('pagep/qcm.php' => 'pagep/qcm.php', 
				  'pagep/ressource.php' => 'pagep/ressource.php',
				  'inscription/inscription.php' => 'inscription/inscription.php',
				  'pagep/challenge.php' => 'pagep/challenge.php',
				  'pagep/profil.php' => 'pagep/profil.php',
				  'accueil.php' => 'accueil.php',
				  'journal.php' => 'journal.php',
				  'news.php' => 'news.php',
				  'contact.php' => 'contact.php');

  // On teste que le paramètre d'url existe et qu'il est bien autorisé
  // -----------------------------------------------------------------
  if ( (isset($_GET['page'])) && (isset($pageOK[$_GET['page']])) ) {
    include($pageOK[$_GET['page']]);   // Nous appelons le contenu central de la page
  } else {
    include('accueil.php');   // Page par défaut 
  }

?>
</td>
    <td width="15%" rowspan="6" valign="top"><?php include('menud.php'); ?></td>
  </tr>
  <tr>
  
  </tr>
  <tr>
    
  </tr>
  <tr>
    
  </tr>
  <tr>
    
  </tr>
  <tr>
    <td colspan="8"><?php include('piedpage.html'); ?></td>
    
  </tr>
</table>

</body>
</html>
Je ne suis pas un pro mais là je ne vois pas.

Si quelqu'un plus doué peut me sortir de ce mauvais pas...

par Maxinfos » 16 juin 2006, 14:28

Si ton fichier entete3.php est identique à celui sur le forum, et que tu ne l'as pas modifié, c'est à dire enlevé tout les html, head, body, ben il vu que tu fais <?php include('entete3.php'); ?> après le html,head,body de ta page en cours .... vérifie ce fichier entete3.php

par alaingpl » 16 juin 2006, 14:28

Problème résolu, j'ai aussi enlevé les balises <head> dans l'index.

Merci à tous de votre patience.

A bientôt car je sais que j'ai un autre souci pour l'identification...

par alaingpl » 16 juin 2006, 14:23

salut,

Jai suivi ton conseil, cela fonctionne mais, bien sûr d'autres messages d'erreurs identiques sont apparus avec d'autres noms de fichier.
J'ai donc continué la même procédure aux fichiers indiqués dans les messages d'erreurs.

J'arrive maintenant à l'index et si je suis la même procédure alors là c'est la cata.. .

Voici le nouveau message d'erreur
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home4/s/sitweb-chr/www/index3.php:16) in /home4/s/sitweb-chr/www/pagep/qcm.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home4/s/sitweb-chr/www/index3.php:16) in /home4/s/sitweb-chr/www/pagep/qcm.php on line 2
Le fichier index3.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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>QCMRESTO.COM</title>
</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="10"><?php include('entete3.php'); ?></td>
    </tr>
   <tr>
    <td width="15%" rowspan="6" valign="top"><?php include('menug.php'); ?></td>
    <td width="70%" colspan="8" rowspan="5" valign="top">
  <?php //ligne 16//
  $pageOK = array('pagep/qcm.php' => 'pagep/qcm.php', 
				  'pagep/ressource.php' => 'pagep/ressource.php',
				  'inscription/inscription.php' => 'inscription/inscription.php',
				  'pagep/challenge.php' => 'pagep/challenge.php',
				  'pagep/profil.php' => 'pagep/profil.php',
				  'accueil.php' => 'accueil.php',
				  'journal.php' => 'journal.php',
				  'news.php' => 'news.php',
				  'contact.php' => 'contact.php');

  // On teste que le paramètre d'url existe et qu'il est bien autorisé
  // -----------------------------------------------------------------
  if ( (isset($_GET['page'])) && (isset($pageOK[$_GET['page']])) ) {
    include($pageOK[$_GET['page']]);   // Nous appelons le contenu central de la page
  } else {
    include('accueil.php');   // Page par défaut 
  }

?>
</td>
    <td width="15%" rowspan="6" valign="top"><?php include('menud.php'); ?></td>
  </tr>
  <tr>
  
  </tr>
  <tr>
    
  </tr>
  <tr>
    
  </tr>
  <tr>
    
  </tr>
  <tr>
    <td colspan="8"><?php include('piedpage.html'); ?></td>
    
  </tr>
</table>

</body>
</html>
Je ne suis pas un pro mais là je ne vois pas.

Si quelqu'un plus doué peut me sortir de ce mauvais pas...

par Maxinfos » 16 juin 2006, 13:21

Dans ton fichier là, enlève tout et ne garde que ça :


<table width="100%" >
<tr valign="middle"><form action="veriflog.php" method="post" enctype="application/x-www-form-urlencoded">
<td width="37%"><div align="right"><span class="Style2">PSEUDO</span></div></td>
<td width="63%"><span class="Style2">
<input name="pseudo" type="text" size="15" maxlength="30" />
</span></td>
</tr>
<tr>
<td><div align="right"><span class="Style2">PASSWORD</span></div></td>
<td><span class="Style2">
<input name="password" type="password" size="15" maxlength="30" />
</span></td>
</tr>
<tr>
<td colspan="2"><div align="center"><span class="Style2">
<input name="OK" type="submit" value="Je m'identifie" />
</span></div></form></td>
</tr>
</table>

Essaye voir ce que ça donne !!!!

par alaingpl » 16 juin 2006, 13:12

salut,

non, je n'ai pas de session_start() dans login.php. En réalité, c'est juste le formulaire

Ci - dessous login.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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
<style type="text/css">
<!--
.Style1 {
	color: #0000FF;
	font-weight: bold;
}
.Style2 {
	color: #0000FF;
	font-weight: bold;
	font-size:9px
}
-->
</style>
</head>

<body>

        
<table width="100%" >
  <tr valign="middle"><form action="veriflog.php" method="post" enctype="application/x-www-form-urlencoded">
    <td width="37%"><div align="right"><span class="Style2">PSEUDO</span></div></td>
    <td width="63%"><span class="Style2">
      <input name="pseudo" type="text" size="15" maxlength="30" />
    </span></td>
  </tr>
  <tr>
    <td><div align="right"><span class="Style2">PASSWORD</span></div></td>
    <td><span class="Style2">
      <input name="password" type="password" size="15" maxlength="30" />
    </span></td>
  </tr>
  <tr>
    <td colspan="2"><div align="center"><span class="Style2">
      <input name="OK" type="submit" value="Je m'identifie" />
    </span></div></form></td>
    </tr>
</table>

</body>
</html>
Après quelques bidouilles je n'ai plus qu'un seul message d'erreur
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home4/s/sitweb-chr/www/entete3.php:69) in /home4/s/sitweb-chr/www/pagep/qcm.php on line 2
Login.php est lui inclus dans une page car le site est architecturé en pseudo frame?
Je ne vois pas d'où peut venir le pbl car dans entete3.php la ligne 69 correspond à une colone vide

Là je séche...

par Maxinfos » 16 juin 2006, 12:47

En fait, je crois que c'est : include('login.php'); qui te pose problème.
Car dès que tu l'inclus, et ça semble être au début de ta page, ben t'as l'entête qui est générée automatiquement ... le session_start() ne dois rien avoir avant, pas de head déclaré ... je me demande si tu fais pas un session_start() au début de ton fichier login.php ... ????

par alaingpl » 16 juin 2006, 10:37

Quand le session est crée, pas de soucis. L'erreur ce passe quand quelqu'un souhaite accéder au contenu d'une page alors qu'il n'est pas identifié.

Il n'y a pas de header dans mes pages.

Big pbl ???

par alaingpl » 16 juin 2006, 10:33

salut,

Dans le fichier entete3.php je ne veux pas ici déclarer de session car c'est l'espace ouvert aux non inscrits.

Je précise que je fonctionne en pseudo - frame. Est ce que cela peut avoir une importance ?

par Mouet » 16 juin 2006, 10:21

Quand est ce que tu déclanche la fonction pour la session?

par Maxinfos » 16 juin 2006, 10:21

"headers already sent by" c'est que tu as déclaré plusieur fois le <head> dans tes balises html ou que tu utilises un header(); dans les parages ... quand tu inclus un fichier, dans lequel du re-déclares tes head etc ... je crois que ça te met ça ... car cette erreur, je l'ai vue je ne sais pas combien de fois et ça a toujours été un truc du genre !!!!

Après, avant de faire un session_start(); vérifie si la session est déjà créée :

Code : Tout sélectionner

if(!isset($_SESSION)) { session_start(); }
Normalement, ça te remet tout à 0 si elle est déjà créée, mais bon, c'est mieux de vérifier soit même !!!!

par alaingpl » 16 juin 2006, 10:11

Bonjour,

Merci car maintenant j'ai saisi le message d'erreur (output started...) mais à la vue de la ligne le problème m'échappe complètement.
Avez - vous une idée du problème ? Merci d'avance de m'aider.

La ligne 69 du fichier " entete3.php est la suivante
<td></td>
elle se trouve en bas de page
<td></td>
</tr>
</table>

</body>
</html>
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
<style type="text/css">
<!--
#Layer1 {
	position:absolute;
	left:156px;
	top:114px;
	width:591px;
	height:25px;
	background-color:#FFFFFF;
	layer-background-color:#FFFFFF;
	border:1px none #000000;
	z-index:1;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>

<body>
<table width="100%" border="0" cellspacing="0"><!--DWLayoutTable-->
  <tr>
    <td width="15%" rowspan="3" align="center" valign="top"><div align="center"><img src="image/logo.png" alt="" width="104" height="71"/></div></td>
    <td width="70%" height="49"><div align="center">
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="607" height="29" align="absmiddle">
        <param name="BGCOLOR" value="" />
        <param name="BGCOLOR" value="" />
        <param name="BGCOLOR" value="" />
        <param name="BGCOLOR" value="" />
        <param name="movie" value="text1.swf" />
        <param name="quality" value="high" />
        <embed src="text1.swf" width="607" height="29" align="absmiddle" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" ></embed>
      </object>
    </div></td>
    <td width="14%" rowspan="2" valign="middle" align="center" nowrap="nowrap"><center><?php include('jour.php'); ?></td>
    <td width="1"></td>
  </tr>
  
  <tr>
    <td width="70%" rowspan="2" align="center" nowrap="nowrap" bgcolor="#FFFFFF"><img src="bouton.png" width="703" height="25" border="0" align="absbottom" usemap="#Map" />
      <map name="Map" id="Map">
        <area shape="rect" coords="630,4,696,22" href="index3.php?page=contact.php" alt="" />
        <area shape="rect" coords="551,4,620,21" href="index3.php?page=news.php" alt="" />
        <area shape="rect" coords="475,3,542,21" href="index3.php?page=journal.php" alt="" />
        <area shape="rect" coords="395,4,464,20" href="index3.php?page=inscription/inscription.php" alt="" />
        <area shape="rect" coords="316,5,388,21" href="index3.php?page=pagep/qcm.php" alt="" />
        <area shape="rect" coords="238,4,305,21" href="index3.php?page=pagep/profil.php" alt="" />
        <area shape="rect" coords="160,4,229,21" href="index3.php?page=pagep/ressource.php" alt="" />
        <area shape="rect" coords="88,4,150,20" href="index3.php?page=pagep/challenge.php" alt="" />
        <area shape="rect" coords="8,4,70,21" href="index3.php?page=accueil.php" alt="" />
      </map></td>
    <td height="22"></td>
  </tr>
  <tr>
    <td height="5"></td>
    <td></td> [color=red]//c'est la ligne 69//[/color]
  </tr>
</table>

</body>
</html>

par jeff » 16 juin 2006, 09:37

salut
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home4/s/sitweb-chr/www/entete3.php:69) in /home4/s/sitweb-chr/www/pagep/qcm.php on line 2
ton erreur eet ecrite en claire
output started at /home4/s/sitweb-chr/www/entete3.php:69
regarde la ligne 69 de ce fichier du doit avoir une sortie Html ou un espace

messages d'erreurs avec session_start() ;

par alaingpl » 16 juin 2006, 09:29

Bonjour à tous,

Lorsqu'un visiteur n'est pas identifié et qu'il souhaite accéder à une page de l'espace membre, voici le message d'erreur que m'affiche la page. Le formulaire d'incription s'affiche aussi.

Vous pouvez faire le test à l'adresse suivante :
http://www.sitweb-chr.com "page QCM"

messages d'erreurs :
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home4/s/sitweb-chr/www/entete3.php:69) in /home4/s/sitweb-chr/www/pagep/qcm.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home4/s/sitweb-chr/www/entete3.php:69) in /home4/s/sitweb-chr/www/pagep/qcm.php on line 2
le code de session_start() ;
<?
session_start() ;

if(!isset($_SESSION['login'])) {
  echo '<center><font color="#FF0000" size="2" face="Arial, Helvetica, sans-serif">Saisissez votre pseudo et votre mot de passe pour vous identifier. <br />
Si vous nêtes pas inscrit, nous vous invitons à le faire dès maintenant.</font></center>'; 
  include('login.php');
  exit;
}
?>
Je n'ai pas de cookie dans le site et je ne comprends pas pourquoi s'affichent ces messages d'erreurs.
Quelqu'un pourrait - il me renseigner ?

Merci d'avance de l'aide apportée.