Bonjour,
je débute en php et je suis entr1 de faire mon premier site web
mon probleme c que lorsque qu'un utilisateur veut s'identifier c'est le fichier index.php qui se telecharge c bizar voila mon fichier accueil.htmlet mon code indexx.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <html> <head> <div align="center"><h1>TP1 Page d'authentification</h1></div> <title>Faille de type SQL Injection</title> </head> <body> <div align="center"> <form action="./index.php" method="POST"> <table> <tr> <td>Login</td> <td><input type="text" name="login" maxlength="100"></td> </tr> <tr> <td>Pass</td> <td><input type="password" name="pass" maxlength="100"></td> </tr> <tr><td colspan=2 align="center"><input type="submit" name="login" value="Login"></td></tr> </table> </form> </div> </body> </html>
vraiment j'arrive pas à connaitre le probléme si quelqu'un peut m'aider?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 <?php //auth.php mysql_connect("localhost", "root@localhost", "") or die("Impossible de se connecter à la base de données"); mysql_select_db("recherche") or die("base inexistante"); $login = $_POST["login"]; $mdp = $_POST["pass"]; if ($login != "" && $mdp != "") { $sql="SELECT * from utilisateur WHERE login='$login' AND pass='$mdp';"; $resultat = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($resultat)<1) echo "Authentification non réussie."; else echo "<script>window.location='./recherche.html'</script>"; } else header("Location: ./"); mysql_close();
merci d'avance
Partager