script d'authentification bizarre
Bonjour,
j'avais fait un script d'authentification qui fonctionnait parfaitement ?
Mais maintenant quand j'envoie une requete dans pseudo j'ai systématiquement le pseudo root alors que je n'ai rien rentré ?
c'est très curieux.
http://developpus.com/admin/auth.php
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 55 56 57 58 59 60 61 62 63 64 65 66 67
| <?php
session_start();
if(isset($_POST['pseudo']) && isset($_POST['mot_de_passe']))
{
$nom=$_POST['pseudo'];
echo $nom;
$mot_de_passe=$_POST['mot_de_passe'];
if(verification($mot_de_passe, $nom) === true)
{
//echo 'eeeeeeeeeeeeeeeee';
$_SESSION['nom']= $nom;
header ('location:./admin_interface.php');
}
else
$message="Mauvais mot de passe";
}
////////////////////////////////////////////////////////////////////////
function verification($mot_de_passe, $nom)
{
include ("../inc/connexion.php");
$nom_sql=$nom;
//$passe_sql=md5($mot_de_passe);
$passe_sql=$mot_de_passe;
$query = "select * from admin where pseudo='$nom_sql' AND passe='$passe_sql'";
echo '<pre>'.$query.'</pre>';
$result = mysql_query($query, $lien) or mysql_error();
if(mysql_num_rows($result)>0)
return true;
else
return false;
}
?>
<html>
<head>
<style>
body {font-size:1em;}
#boite{ width:30em;}
#centrer {position:absolute; left:50%; width:30em; margin-left:-15em; }
fieldset>legend {background:#FDE2B0;padding: 0 5px 0 5px; font-family:Georgia, "Times New Roman", Times, serif; font-style:italic; color:red;}
legend {background:#FDE2B0;padding: 0 5px 0 5px; font-family:Georgia, "Times New Roman", Times, serif; font-style:italic; color:red; }
input{font-family:Georgia, "Times New Roman", Times, serif; font-style:italic; color:red;}
form>fieldset { margin:10px 0 0 -12px; padding:10px;color:#003333; border: 1px dashed #FF9900;text-align:right;}
fieldset { padding:30px;color:#003333; border: 1px dashed #FF9900;text-align:right; margin:0px 0 0 0;}
#cle{ float:left; margin:30px 0 0 0px; padding:0 0px 0 0; }
</style>
</head>
<body>
<div id="centrer">
<p id="identifiez"><h3>Identifiez-vous</h3>
Bonjour, merci de saisir votre code utilisateur et votre mot de passe.</p><br />
<span style="color:red;font-weight:bold;"><?php echo $message;?></span>
<form id="boite" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
<fieldset>
<em id="cle"><img src="../img/key.jpg" alt="cle"></em>
<legend id="pour_ie">interface d'administration</legend><br>
<label for="Login"><em class="texte">Login</em></label>
<input class="input" type="text" size="20" name="pseudo" id="input0"
onKeyUp="if(this.value!='') this.size=this.value.length" />
<br><br><label for="mot_de_passe"><em class="texte">Mot de passe</em></label>
<input class="input" type="password" size='20' name="mot_de_passe" id="input1"
onKeyUp="if(this.value!='') this.size=this.value.length" />
<p><input type="submit" value="Connexion" /></p>
</fieldset>
</form>
</div>
</body>
</html> |
Ma table
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
| -- phpMyAdmin SQL Dump
-- version 2.10.1
-- http://www.phpmyadmin.net
--
-- Serveur: localhost
-- Généré le : Jeu 13 Mars 2008 à 00:57
-- Version du serveur: 5.0.45
-- Version de PHP: 5.2.5
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
-- --------------------------------------------------------
--
-- Structure de la table `admin`
--
CREATE TABLE `admin` (
`pseudo` varchar(100) collate latin1_general_ci NOT NULL default '',
`passe` varchar(200) collate latin1_general_ci NOT NULL,
`niveau` tinyint(2) NOT NULL,
`prenom` varchar(50) collate latin1_general_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
--
-- Contenu de la table `admin`
--
INSERT INTO `admin` (`pseudo`, `passe`, `niveau`, `prenom`) VALUES
('cv', 'cv', 0, 'cv'),
('xav', '7b5fbb2361fb6d1465c8df5757e1f53c', 0, 'xav'); |
Merci