diff --git a/TP/TP2.docx b/TP/TP2.docx new file mode 100644 index 0000000..5395876 Binary files /dev/null and b/TP/TP2.docx differ diff --git a/TP/TP2_codes/connect.php b/TP/TP2_codes/connect.php new file mode 100644 index 0000000..a9e097d --- /dev/null +++ b/TP/TP2_codes/connect.php @@ -0,0 +1,23 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); + } + echo "
"."Connexion reussie :)..."."
"; + +// Close connexion + $conn->close(); + +?> \ No newline at end of file diff --git a/TP/TP2_codes/index.php b/TP/TP2_codes/index.php new file mode 100644 index 0000000..4ef2706 --- /dev/null +++ b/TP/TP2_codes/index.php @@ -0,0 +1,22 @@ + +

MyCorp server connexion a BD

+

Page de cotainnexion à ma base de données

+ +
+
+ Login : + +
+
+ Password : + +
+
+ DataBase Name : + +
+ + + +
+ diff --git a/TP/TP2_codes/parTP/index.php b/TP/TP2_codes/parTP/index.php new file mode 100644 index 0000000..94c2a1e --- /dev/null +++ b/TP/TP2_codes/parTP/index.php @@ -0,0 +1,17 @@ + +

Récupération MDP

+

Page de connexion à ma base de données

+ +
+
+ Login : + +
+
+ Mot de passe : + +
+ + +
+ diff --git a/TP/TP2_codes/parTP/tp2.php b/TP/TP2_codes/parTP/tp2.php new file mode 100644 index 0000000..c3bc74d --- /dev/null +++ b/TP/TP2_codes/parTP/tp2.php @@ -0,0 +1,64 @@ +"); +}else{ + // On va vérifier les variables + print("Verification du login et pass
"); + if(!preg_match('/^[[:alnum:]]+$/', $_GET['login']) or + !preg_match('/^[[:alnum:]]+$/', $_GET['motdepasse'])) + { + echo 'Vous devez entrer uniquement des lettres ou des chiffres
'; + echo 'Ressayer'; + exit(); + } +} +*/ + + + +$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 "
"."Connexion reussie :)..."."
"; + + +$nom = $_GET['login']; +$motdepasse = $_GET['motdepasse']; +print ("nom = $nom, mdp = $motdepasse"); +echo "
New record created successfully"; + +/* + +//select des cartes +// on envoie la requête +$sql ="SELECT numerocarte FROM comptes WHERE (nom = '$nom' AND motdepasse = '$m$ +$req = $conn->query($sql) or die('Erreur SQL !
'.$sql.'
'.mysql_error()); +$row = $req->fetch_assoc(); +echo "
"; +echo "numero de carte = "; +echo $row['numerocarte']; +//Fermeture de la connexion + $conn->close(); + +*/ + +?> + + diff --git a/TP/TP2_codes/test.php b/TP/TP2_codes/test.php new file mode 100644 index 0000000..bf988e4 --- /dev/null +++ b/TP/TP2_codes/test.php @@ -0,0 +1,10 @@ + +

Test PHP

+

This is the PHP web page for this server.

+ + +