tp3
This commit is contained in:
parent
56a0519cee
commit
8f6f0d826a
BIN
TP/TP3.docx
Normal file
BIN
TP/TP3.docx
Normal file
Binary file not shown.
30
TP/TP3_codes/index.php
Normal file
30
TP/TP3_codes/index.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<html><body>
|
||||||
|
<h1>Récupération MDP</h1>
|
||||||
|
<p>Page de connexion à ma base de données</p>
|
||||||
|
|
||||||
|
<form method="get" action="tp3.php">
|
||||||
|
<fieldset>
|
||||||
|
<legend>Login : </legend>
|
||||||
|
<input type="text" name="login"/>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Mot de passe : </legend>
|
||||||
|
<input type="password" name="motdepasse"/>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Sujet a déposer : </legend>
|
||||||
|
<input type="text" name="sujetdepose"/>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<legend> Message: </legend>
|
||||||
|
<textarea name="message" rows="6" cols="40"></textarea>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Sujet recherché : </legend>
|
||||||
|
<input type="text" name="sujetrecherche"/>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
|
||||||
|
<input type="submit" name="submit" value="Se connecter"/>
|
||||||
|
</form>
|
||||||
|
</body></html>
|
46
TP/TP3_codes/tp3.php
Normal file
46
TP/TP3_codes/tp3.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
// ------------------------------------------------------------------------- //
|
||||||
|
// Test de connection à MySQL //
|
||||||
|
// ------------------------------------------------------------------------- //
|
||||||
|
|
||||||
|
echo "Bonjour \n";
|
||||||
|
|
||||||
|
$sql_host = "localhost";
|
||||||
|
$sql_user = "iut";
|
||||||
|
$sql_pwd = "iut";
|
||||||
|
$sql_db = "BD_TP2";
|
||||||
|
|
||||||
|
|
||||||
|
// Create connection
|
||||||
|
$conn = new mysqli($sql_host, $sql_user, $sql_pwd, $sql_db);
|
||||||
|
// Check connection
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
die("Connection failed: " . $conn->connect_error);
|
||||||
|
}
|
||||||
|
echo "<br/>"."Connexion reussie :)..."."<br/>";
|
||||||
|
|
||||||
|
|
||||||
|
$nom = $_GET['login'];
|
||||||
|
$motdepasse = $_GET['motdepasse'];
|
||||||
|
//$nom = mysqli_real_escape_string($conn, $_POST['login']);
|
||||||
|
//$motdepasse = mysql_real_escape_string(($conn, $_POST['motdepasse']);
|
||||||
|
|
||||||
|
print ("nom = $nom, mdp = $motdepasse");
|
||||||
|
echo "<br/>Card number request";
|
||||||
|
|
||||||
|
|
||||||
|
//select des cartes
|
||||||
|
// on envoie la requête
|
||||||
|
//$sql ="SELECT numerocarte FROM comptes WHERE (nom = '$nom' AND motdepasse = '$motdepasse')";
|
||||||
|
$sql ="SELECT numerocarte FROM comptes WHERE (nom = '' OR 1=1)";
|
||||||
|
$req = $conn->query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
|
||||||
|
$row = $req->fetch_assoc();
|
||||||
|
echo "<br>";
|
||||||
|
echo "numero de carte = ";
|
||||||
|
echo $row['numerocarte'];
|
||||||
|
|
||||||
|
//Fermeture de la connexion
|
||||||
|
$conn->close();
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
6
TP/TP3_codes/xss.php
Normal file
6
TP/TP3_codes/xss.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<html>
|
||||||
|
<body><h1>Test PHP </h1>
|
||||||
|
<p>Test page PHP pour XSS.</p>
|
||||||
|
<?php $param=$_GET['param']; print("param = $param");?>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user