J'ai ressorti un vieu bout de code... pour permettre l'authentification par login et mdp au back office de mon intranet. J'essai en vain de le faire fonctionner et un amis me dis qu'il n'est pas compatible avec php 4 et 5
voici le formulaire :
<html>
<head>
<link href="../stylesheet/global.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<title>Authentification - Intranoo - Club 14</title><body>
<table border="1"width="600" align="center">
<tr>
<td><div align="center" class="texte_gras">Club 14- Administration - Identification</div></td>
</tr>
</table>
<form action="authentification.php" method="post">
<table width="80%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan="3"><div align="center"><br>
<br>
<span class="texte">Partie réservée à l’administration du site. <br>
<br>
Entrez votre identifiant et votre mot de passe pour y accéder.</span> </span><br>
<br>
<br>
</div></td>
</tr>
<tr>
<td width="32%"> </td>
<td width="16%" class="texte_gras">Login :</td>
<td width="52%"><input type=text name=login size="20">
</td>
</tr>
<tr>
<td width="32%"> </td>
<td width="16%" class="texte_gras">Mot de passe :</td>
<td width="52%"><INPUT TYPE=PASSWORD NAME=pass size="20">
</td>
</tr>
<tr>
<td colspan="3"><div align="center"> <br>
<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE="Accéder au back office">
</div></td>
</tr>
</table>
<div align="center">
<?php
if ($Message == "Invalide")
{
print ("<B><FONT COLOR=RED>Vous n'etes pas enregistré !</FONT></CENTER></B>\n");
}
else if ($Message == "Invalide2")
{
print ("<B><FONT COLOR=RED>Votre pass n'est pas exact</FONT></CENTER></B>\n");
}
else if ($Message == "Invalide3")
{
print ("<B><FONT COLOR=RED>Votre n'avez pas inscrit de login</FONT></CENTER></B>\n");
}
?>
</div>
</FORM>
</body>
</html>
et le fichier authentification.php<?php
include('connection.inc.php');
$query="SELECT count(*) FROM authentification where login='$login'";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$total = $row[0];
if($login==NULL)
{
header ("Location: index.php?Message=Invalide3");
}
else if($total != 1)
{
header ("Location: index.php?Message=Invalide");
}
else
{
$query="SELECT count(*) FROM authentification where pass='$pass'";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$total = $row[0];
if($total != 1)
{
header ("Location: index.php?Message=Invalide2");
}
else
{
header ("Location: back_office.php");
}
}
?>
merci d'avance si vous pouviez me dire si ce code est obsolète (je ne parle pas de sécurité en tant que tel mais d'efficaité)