Précédent   Forum des professionnels en informatique > PHP > Langage > Sessions
Sessions Forum d'entraide sur les sessions avec PHP. Avant de poster -> FAQ sessions, Cours sessions et Sources sécurité
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 06/03/2007, 01h49   #1
Invité de passage
 
Inscription : octobre 2006
Messages : 20
Détails du profil
Informations forums :
Inscription : octobre 2006
Messages : 20
Points : 3
Points : 3
Par défaut session_start erreur c'est quoi quoi le problème ?

Voici mes messages d'erreur que j'obtiens en testant mon site en local (alors que ça marche en général (en ligne).......

Citation:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\www\ESSAI\index.php:4) in D:\www\ESSAI\index.php on line 5

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\www\ESSAI\index.php:4) in D:\www\ESSAI\index.php on line 5
Et voici le début de mon code...

Code :
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
<!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>
<?php require_once('connexion.php');
session_start();
 
   // On d&eacute;finit le tableau contenant les pages autoris&eacute;es
  // ----------------------------------------------------
  $pageOK = array('categorie' => 'lecturePage.php',
                  'inscription' => 'etudiantInscription.php',
				  'inscriptionOk' => 'etudiantInscriptionOk.php',
				  'etudiantCompte' => 'etudiantCompte.php',
				  'tchat' => 'discussion.php',
				  'listerPage' => './boss/listePage.php',
				  'updatePage' => './boss/majPage.php',
				  'updatePageEnfant' => './boss/majPageEnfant.php',
				  'addChildPage' => './boss/addPage.php',
				  'addFatherPage' => './boss/addPagePere.php',
				  'listerUser' => './boss/listeUtilisateur.php',
				  'accueil' => 'accueil.php');
    //On va definir le titre de la page
 if  (isset($_GET['numEnfant']))  {
		$test=$_GET['numEnfant'];
		$info="SELECT * FROM sousMenu where idSousMenu ='$test'";
		$req=mysql_query($info) or die ('Erreur Sql' . $info . '<br>' . mysql_error());
 
		//on récupère les valeurs
		$infoPage = mysql_fetch_assoc($req);
		echo "<title> Magistere Banque Finance Assas - ".$infoPage['titreSousMenu']." </title>";
		//echo "<meta Name='Description' Content='".$titreA.":".$texteB."'>";
 } else if  (isset($_GET['num']))  {
		$test=$_GET['num'];
		$info="SELECT * FROM menu where idMenu ='$test'";
		$req=mysql_query($info) or die ('Erreur Sql' . $info . '<br>' . mysql_error());
 
		//on récupère les valeurs
		$infoPage = mysql_fetch_assoc($req);
		echo "<title> Magistere Banque Finance Assas - ".$infoPage['titreMenu']." </title>";
		//echo "<meta Name='Description' Content='".$titreA.":".$texteB."'>";
 } else {
?>
	<title>Magistere Banque Finance - Assas</title>
    <meta name="description" content="Le site officiel du Magistère Banque-Finance Paris II Assas" />
<?php } ?>
	<meta http-equiv="Content-Language" content="French" />
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
	<meta name="keywords" content="magistere, banque, finance, assas,paris, paris II" />	
	<meta name="Robots" content="index,follow" />
	<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
	<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss/" />
</head>

Si vous pouviez m'aider à comprendre le problème, je vous en serais reconnaissant ! ! !MERCI ! ! !
noobspower est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 06/03/2007, 02h29   #2
Invité de passage
 
Inscription : octobre 2006
Messages : 20
Détails du profil
Informations forums :
Inscription : octobre 2006
Messages : 20
Points : 3
Points : 3
Si dapres ce que j'ai pu lire, il faut placer session start au tout debut de mon code (je n'ai plus les erreurs ci dessus), j'ai un autre bug car mon formulaire d'identification n'apparait plus sur ma page. . .
j'ai fait un <?php include("membreBloc.php") ?>

et mon fichier membrebloc.php est celui ci:

Code :
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
<?php 
	if (isset($_POST["emailForm"])) {
		include "membreVerif.php";
	}
?>
 
<?php if (isset($_SESSION['nom'])) { ?>
	Bienvenue <?php echo $_SESSION["prenom"]." ".$_SESSION["nom"]; ?>
	<br />
	- <a href="./index.php?page=etudiantCompte">Mon compte</a><br />
	- <a href="./etudiantDeconnexion.php">Se déconnecter</a>
<? }else { ?>
	<form name="form1" method="post" action="">
	  <label>Email : 
	  <input type="text" name="emailForm">
	  </label>
	  <br>
	  <label>Mot de passe : 
	  <input type="password" name="mdpForm">
	  </label>
	  <br>
	  <input name="submit" type="submit" id="submit" value="connexion">
	</form>
	<br />
	<a href="./index.php?page=inscription">[ Inscription Etudiant ]</a>
<?php } ?>

Alors que se passe t-il ? ? ?
noobspower est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 06/03/2007, 13h39   #3
Rédacteur
 
Avatar de RideKick
 
Homme
Directeur technique
Inscription : septembre 2006
Messages : 5 959
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Directeur technique
Secteur : High Tech - Produits et services télécom et Internet

Informations forums :
Inscription : septembre 2006
Messages : 5 959
Points : 10 889
Points : 10 889
oui session-start doit etre avant tout affichage :
Code :
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
 
<?php session_start();?>
<!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>
<?php require_once('connexion.php');
 
 
   // On d&eacute;finit le tableau contenant les pages autoris&eacute;es
  // ----------------------------------------------------
  $pageOK = array('categorie' => 'lecturePage.php',
                  'inscription' => 'etudiantInscription.php',
				  'inscriptionOk' => 'etudiantInscriptionOk.php',
				  'etudiantCompte' => 'etudiantCompte.php',
				  'tchat' => 'discussion.php',
				  'listerPage' => './boss/listePage.php',
				  'updatePage' => './boss/majPage.php',
				  'updatePageEnfant' => './boss/majPageEnfant.php',
				  'addChildPage' => './boss/addPage.php',
				  'addFatherPage' => './boss/addPagePere.php',
				  'listerUser' => './boss/listeUtilisateur.php',
				  'accueil' => 'accueil.php');
    //On va definir le titre de la page
 if  (isset($_GET['numEnfant']))  {
		$test=$_GET['numEnfant'];
		$info="SELECT * FROM sousMenu where idSousMenu ='$test'";
		$req=mysql_query($info) or die ('Erreur Sql' . $info . '<br>' . mysql_error());
 
		//on récupère les valeurs
		$infoPage = mysql_fetch_assoc($req);
		echo "<title> Magistere Banque Finance Assas - ".$infoPage['titreSousMenu']." </title>";
		//echo "<meta Name='Description' Content='".$titreA.":".$texteB."'>";
 } else if  (isset($_GET['num']))  {
		$test=$_GET['num'];
		$info="SELECT * FROM menu where idMenu ='$test'";
		$req=mysql_query($info) or die ('Erreur Sql' . $info . '<br>' . mysql_error());
 
		//on récupère les valeurs
		$infoPage = mysql_fetch_assoc($req);
		echo "<title> Magistere Banque Finance Assas - ".$infoPage['titreMenu']." </title>";
		//echo "<meta Name='Description' Content='".$titreA.":".$texteB."'>";
 } else {
?>
	<title>Magistere Banque Finance - Assas</title>
    <meta name="description" content="Le site officiel du Magistère Banque-Finance Paris II Assas" />
<?php } ?>
	<meta http-equiv="Content-Language" content="French" />
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
	<meta name="keywords" content="magistere, banque, finance, assas,paris, paris II" />	
	<meta name="Robots" content="index,follow" />
	<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
	<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss/" />
</head>
__________________
Pas de questions techniques en MP please

Mon site perso
RideKick est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 06/03/2007, 13h43   #4
lvr
Membre éclairé
 
Avatar de lvr
 
Inscription : avril 2006
Messages : 503
Détails du profil
Informations forums :
Inscription : avril 2006
Messages : 503
Points : 376
Points : 376
Je ne vois pas l'include de ton fichier membreBloc.php. C'est normal ?
lvr est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 14h54.


 
 
 
 
Partenaires

Hébergement Web