Toutr d'abord j'ai besoin de récupérer le numéro de l'utilisateur lorsqu'il se connecte seulement je ne vois pas comment et à quel moment le faire.
voila mes codes pour l'identification de l'utilisateur :
<form action="connexion.php" method="post">
<table width="300" border="0">
<tr>
<td width="300" align="center"><span class="intitule">Login</span></td>
</tr>
<tr>
<td width="300" height="28" align="center"><input name="login" type="text" /></td>
</tr>
<tr>
<td width="300" height="28" align="center"></td>
</tr>
<tr>
<td width="300" align="center"><span class="intitule">Password</span></td>
</tr>
<tr>
<td width="300" align="center"><input name="pass" type="password" /></td>
</tr>
</table>
<br />
<table width="300" border="0">
<tr>
<td width="300" align="center"><input name="entrer" type="submit" value="Connexion" /></td>
</form> là s'est pour entrer ses identifiantset voila la page qui vérifie les id :
<?php
include('connexion.inc');
if (isset($_POST['login']) && isset($_POST['pass'])) { // test des l'existances des variables
$sqlQuery = "Select COUNT(*)
FROM users
WHERE login_user = '".mysql_real_escape_string($_POST['login'])."'
AND pass_user = '".mysql_real_escape_string($_POST['pass'])."'";
$result = mysql_query($sqlQuery) or die('erreur '.$sqlQuery.' : '.mysql_error());
$array = mysql_fetch_row($result);
if($array[0] == 1) {
session_start();
$_SESSION['login'] = $login;
header("Location: accueil.php");
} else {
header("Location: index.php");
}
}
?>
Un bon maître a ce souci constant : enseigner à se passer de lui.