Commit 8d481333736626bc54210b4525a6aa34e530983c

Authored by lwadbled
1 parent 564557d2

add(html): Codes sources page web

Showing 3 changed files with 119 additions and 0 deletions   Show diff stats
html/index.html 0 → 100644
@@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
  1 +<!DOCTYPE html>
  2 +<html>
  3 + <head>
  4 + <meta charset="utf-8"/>
  5 + <title>Login</title>
  6 + <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css"
  7 + rel="stylesheet"
  8 + integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x"
  9 + crossorigin="anonymous">
  10 + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js"
  11 + integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//E1J19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4"
  12 + crossorigin="anonymous">
  13 + </script>
  14 + </head>
  15 + <body class="text-center">
  16 + <main class="form-signin">
  17 + <form method="POST" action="login.php">
  18 + <div class="container">
  19 + <div class="row">
  20 + <div style="margin-top: 13rem!important; padding-left: 20rem!important; padding-right: 20rem!important;">
  21 + <div class="login-panel panel panel-default">
  22 + <div class="panel-heading">
  23 + <!--Ajouter photo-->
  24 + </div>
  25 + <div class="panel-body">
  26 + <h1 class="h3 mb-3 fw-normal">Veuillez vous identifier.</h1>
  27 + </div>
  28 + <div class="panel-body">
  29 + <div class="form-floating">
  30 + <input type="text" class="form-control" name="identifiant" id="identifiant" placeholder="Identifiant" required="true">
  31 + <label for="identifiant">Identifiant (8 caractères max)</label>
  32 + </div>
  33 + <div class="form-floating">
  34 + <input type="password" class="form-control" name="mdp" id="mdp" placeholder="Mot de passe" required="true">
  35 + <label for="mdp">Mot de passe</label>
  36 + </div>
  37 + <button class="w-100 btn btn-lg btn-primary" type="submit">Connexion</button>
  38 + </div>
  39 + </div>
  40 + </div>
  41 + </div>
  42 + </form>
  43 + </main>
  44 + </body>
  45 +</html>
  46 +
html/login.php 0 → 100644
@@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
  1 +<?php
  2 +session_start();
  3 +if(isset($_POST['identifiant']) && isset($_POST['mdp'])){
  4 + //Connexion à la base de données
  5 + $db_user = 'lwadbled';
  6 + $db_mdp = 'glopglop';
  7 + $db_nom = 'lwadbled';
  8 + $db_host = 'localhost';
  9 + $db = mysqli_connect($db_host, $db_user, $db_mdp, $db_nom)
  10 + or die('could not connect to database');
  11 +
  12 + $identifiant = mysqli_real_escape_string($db,htmlspecialchars($_POST['identifiant']));
  13 + $mdp = mysqli_real_escape_string($db,htmlspecialchars($_POST['mdp']));
  14 +
  15 + if($identifiant !=="" && $mdp !== ""){
  16 + $requete = "SELECT count(*) FROM utilisateur WHERE
  17 + login = '".$identifiant."' AND mdp = '".$mdp."' ";
  18 + $exec_requete = mysqli_query($db,$requete);
  19 + $reponse = mysqli_fetch_array($exec_requete);
  20 + $count = $reponse['count(*)'];
  21 + if($count!=0){
  22 + $_SESSION['identifiant'] = $identifiant;
  23 + echo "<meta http-equiv=\"refresh\" content=\"0;url=menu.php\">";
  24 + //header('Location : menu.php');
  25 + }else{
  26 + echo "<meta http-equiv=\"refresh\" content=\"0;url=index.html\">";
  27 + //header('Location : index.html');
  28 + }
  29 + }else{
  30 + echo "<meta http-equiv=\"refresh\" content=\"0;url=index.html\">";
  31 + //header('Location : index.html');
  32 + }
  33 + mysqli_close($db); // Fin de la connexion
  34 +}else{
  35 + //header('Location : /index.html');
  36 + echo "<meta http-equiv=\"refresh\" content=\"0;url=index.html\">";
  37 +}
  38 +
  39 +?>
html/menu.php 0 → 100644
@@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
  1 +<!DOCTYPE html>
  2 +<html>
  3 + <head>
  4 + <meta charset="utf-8"/>
  5 + <title>Page principale</title>
  6 + <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css"
  7 + rel="stylesheet"
  8 + integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x"
  9 + crossorigin="anonymous">
  10 + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js"
  11 + integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//E1J19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4"
  12 + crossorigin="anonymous">
  13 + </script>
  14 + </head>
  15 + <body>
  16 + <div>
  17 + <a href='menu.php?deconnexion=true'><span>Deconnexion</span></a>
  18 + <?php
  19 + session_start();
  20 + if(isset($_GET['deconnexion'])){
  21 + if($_GET['deconnexion']==true){
  22 + session_unset();
  23 + echo "<meta http-equiv=\"refresh\" content=\"0;url=index.html\">";
  24 + //header('Location : index.html');
  25 + }
  26 + }
  27 + if(isset($_SESSION['identifiant'])){
  28 + $identifiant = $_SESSION['identifiant'];
  29 + echo "<br>Bonjour $identifiant, vous êtes connecté";
  30 + }
  31 + ?>
  32 + </div>
  33 + </body>
  34 +</html>