Probleme avec l'utilisation de $_SESSION
Bonjour,
Je souhaiterai faire un formulaire de connexion avec en plus un $_SESSION pour pouvoir suivre le visiteur.
Je vous montre le 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 52 53 54
| <?php require_once('connexion.php'); ?>
<?php
if (isset($_GET['Connecter']))
{
$Identifiant = $_GET['Identifiant'];
$MotDePasse = $_GET['mdp'];
mysql_select_db($database_siterecette, $siterecette);
$query_Identification = "SELECT Identifiant, MotDePasse FROM Utilisateur WHERE Identifiant = '$Identifiant' AND MotDePasse = '$MotDePasse'";
$Identification = mysql_query($query_Identification, $siterecette) or die(mysql_error());;
$row_Identification= mysql_fetch_assoc($Identification);
if ($row_Identification['Identifiant'] == $Identifiant AND $row_Identification['MotDePasse'] == $MotDePasse)
{
echo "Connexion réussi";
session_start();
$_SESSION['Identifiant'] = $_POST['Identifiant'];
exit();
}
else
{
echo "Erreur de connexion";
}
}
?>
<div id="login">
<div id="Textelogin">
<form id="FormLogin" name="FormLogin" method="get" action="menu.php">
<span>Nom de compte :</span><br />
<input type="text" name="Identifiant" /><br />
<span>Mot de passe :</span><br />
<input type="password" name="mdp" /><br />
<center><input type="submit" name="Connecter" value="Connecter" /></center>
</form>
</div>
</div>
<br />
<div id="menu">
<div id="textemenu">
<a href="index.php">Accueil</a><br /><br />
<a href="inscription.php">Inscription</a><br /><br />
<a href="consultation.php">Consultation</a><br /><br />
<a href="recherche.php">Recherche de recettes</a><br /><br />
<a href="ajoutrecette.php">Ajout de recettes</a><br /><br />
<a href="#">Liens</a><br /><br />
</div>
</div> |
Seulement j'ai ce genre d'erreur :
Citation:
Connexion réussi
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\wamp\www\SiteRecette\menu.php:13) in C:\wamp\www\SiteRecette\menu.php on line 14
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\wamp\www\SiteRecette\menu.php:13) in C:\wamp\www\SiteRecette\menu.php on line 14
Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0
Je comprend pas tres bien, je suis débutant et j'ai un peu de mal.
Dites moi aussi si vous voyez des trucs qui ne vont pas dans le code, je suis la pour progresser.
Merci