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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
<?php
function getPasswd($login)
{
if($fid=fopen('passwd.txt','r'))
{
while(!feof($fid))
{
$ligne_courante=fgets($fid,80);
$tab=explode(':',$ligne_courante);
if($tab[0]==$login)
{
fclose($fid);
return $tab[1];
}
}
fclose($fid);
return "";
}
else
{
die('Le fichier passwd.txt est introuvable');
}
}
function addLog($login,$reussie)
{
if($fid=fopen('log.txt','a+'))
{
$message='Connexion';
if($reussie)
{
$message=$message.'réussie de';
}
else
{
$message=$message.'échouée de';
}
$message=$message.$login.'le'.date('Y-m-d H:i:s')."\r\n";
fputs($fid,$message);
fclose($fid);
}
else
{
die('Le fichier log.txt est introuvable');
}
}
echo '<?xml version="1.0" encoding="iso-8859-1"?>'."\r\n";
?>
<!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" lang="fr-FR" xml:lang="fr-FR">
<head>
<meta http-equiv="Context-type" content="application/xhtml+xml; charset=iso-8859-1" />
<title> Bienvenue</title>
</head>
<body>
<?php
if($_POST['pass']==getPasswd($_POST['login']))
{
//echo '<h1>Bienvenue'.$_POST['login'].'</h1>';
//echo'<br>Commentaire = '.$_POST['comm'];
echo '<br>Valeur = " '.$_POST['FCKeditor1'];
//addLog($_POST['login'],true);
}
else
{
echo '<h1>Erreur,mot de passe invalide</h1><p><br/><a href="login.htm"> Recommencer</a></p>';
//addLog($_POST['login'],false);
}
?>
</body>
</html> |