j'ai des erreurs que je ne comprends pas
Posté : 05 avr. 2012, 13:12
<?php
session_start();
include('../espoir/entete.php');?>
<table width="556" border="0" cellspacing="2" cellpadding="10">
<tr>
<td height="300" valign="top" bgcolor="#FFFFCC">
<?php
$_SESSION['categorie']=$_POST['categorie'];
$_SESSION['login']=$_POST['login'];
$_SESSION['pw']=$_POST['pw'];
echo"<h6>Système de gestion des stages</h6>";
$c=$_SESSION['categorie'];
if ($c==1){$t='eleve';}
elseif($c==2){$t='maitre';}
else{$t='lieu';}
$link=mysql_connect('localhost','root','');
if (!$link){
die('<p>Impossible de se connecter:'.mysql_error().'</p>');
}
$db=mysql_select_db('gestionstages',$link);
if(!$db){
die('<p>Impossible d\'utiliser la base:'.mysql_error().'</p>');
}
$login=$_POST['login'];
$sqlquery="select nom,prenom,login,pw $t where login='$login'";
$queryresult=mysql_query($sqlquery);
if(mysql_num_rows(queryresult)==0){
echo "<p>Identifiant inconnu!</p>";
echo "<p><a href='login.php'>Retour</a></p>";}
else{
$row=mysql_fetch_array($queryresult,MYSQL_ASSOC);
if ($row['pw']!=$_POST['pw']){
echo "Mot de passe incorrect!";
echo "<p><a href='login.php'>Retour</a></p>";}
else{echo"<p>Bienvenue<strong>".$row['prenom']."".$row['nom']."</strong>". "</p>";
echo "<p><a href='menu.php?".SID.".>Coninuer</a></p>";
include('../espoir/deconnexion.php');
}
}
?>
</tr>
</table>
<?php
include('../espoir/pieddepage.php');?>
Voici les erreurs affichés:
Notice: Undefined index: categorie in C:\wamp\www\espoir\connexion.php on line 8
Notice: Undefined index: login in C:\wamp\www\espoir\connexion.php on line 9
Notice: Undefined index: pw in C:\wamp\www\espoir\connexion.php on line 10
Notice: Undefined index: login in C:\wamp\www\espoir\connexion.php on line 24
Notice: Use of undefined constant queryresult - assumed 'queryresult' in C:\wamp\www\espoir\connexion.php on line 27
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\espoir\connexion.php on line 27
Identifiant inconnu!
session_start();
include('../espoir/entete.php');?>
<table width="556" border="0" cellspacing="2" cellpadding="10">
<tr>
<td height="300" valign="top" bgcolor="#FFFFCC">
<?php
$_SESSION['categorie']=$_POST['categorie'];
$_SESSION['login']=$_POST['login'];
$_SESSION['pw']=$_POST['pw'];
echo"<h6>Système de gestion des stages</h6>";
$c=$_SESSION['categorie'];
if ($c==1){$t='eleve';}
elseif($c==2){$t='maitre';}
else{$t='lieu';}
$link=mysql_connect('localhost','root','');
if (!$link){
die('<p>Impossible de se connecter:'.mysql_error().'</p>');
}
$db=mysql_select_db('gestionstages',$link);
if(!$db){
die('<p>Impossible d\'utiliser la base:'.mysql_error().'</p>');
}
$login=$_POST['login'];
$sqlquery="select nom,prenom,login,pw $t where login='$login'";
$queryresult=mysql_query($sqlquery);
if(mysql_num_rows(queryresult)==0){
echo "<p>Identifiant inconnu!</p>";
echo "<p><a href='login.php'>Retour</a></p>";}
else{
$row=mysql_fetch_array($queryresult,MYSQL_ASSOC);
if ($row['pw']!=$_POST['pw']){
echo "Mot de passe incorrect!";
echo "<p><a href='login.php'>Retour</a></p>";}
else{echo"<p>Bienvenue<strong>".$row['prenom']."".$row['nom']."</strong>". "</p>";
echo "<p><a href='menu.php?".SID.".>Coninuer</a></p>";
include('../espoir/deconnexion.php');
}
}
?>
</tr>
</table>
<?php
include('../espoir/pieddepage.php');?>
Voici les erreurs affichés:
Notice: Undefined index: categorie in C:\wamp\www\espoir\connexion.php on line 8
Notice: Undefined index: login in C:\wamp\www\espoir\connexion.php on line 9
Notice: Undefined index: pw in C:\wamp\www\espoir\connexion.php on line 10
Notice: Undefined index: login in C:\wamp\www\espoir\connexion.php on line 24
Notice: Use of undefined constant queryresult - assumed 'queryresult' in C:\wamp\www\espoir\connexion.php on line 27
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\espoir\connexion.php on line 27
Identifiant inconnu!