Browse Source

Multicompte

Alexandre MOTTIER 1 year ago
parent
commit
b04dd9a022
19 changed files with 912 additions and 101 deletions
  1. 32 2
      ajoutcontact.php
  2. 31 2
      ajoutentreprise.php
  3. 8 0
      config.php
  4. 32 5
      creationentretienphy.php
  5. 57 30
      creationentretientel.php
  6. 25 12
      custom.css
  7. 77 20
      index.php
  8. 9 0
      infocontact.php
  9. 62 20
      infoentretien.php
  10. 36 0
      login.php
  11. 5 0
      logout.php
  12. 12 1
      modifcontact.php
  13. 100 0
      modifentreprise.php
  14. 44 5
      modifentretienphy.php
  15. 43 4
      modifentretientel.php
  16. 101 0
      modifprofil.php
  17. 110 0
      rechercheemploi.sql
  18. 92 0
      register.php
  19. 36 0
      verify.php

+ 32 - 2
ajoutcontact.php

@@ -7,16 +7,44 @@
 <body>
     <h1>Ajouter un contact</h1>
 <?php
+session_start();
+
+if (!isset($_SESSION['loggedin'])) {
+  header("Location: login.php");
+  exit;
+} else {
+$prenom = $_SESSION['first_name'];
+$nom = $_SESSION['last_name'];
+$profession = $_SESSION['profession'];
+$idsession = $_SESSION['ID'];
+}
+include_once 'class/sqlconnect.php';
+try {
+    $conn = new PDO("mysql:host=$host;dbname=$dbname", $dbusername, $dbpassword);
+    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+    $stmt = $conn->prepare("SELECT ID FROM users WHERE username = :username");
+    $stmt->bindParam(':username', $_SESSION['username']);
+    $stmt->execute();
+
+    $result = $stmt->fetch(PDO::FETCH_ASSOC);
+    $idsession = $result['ID'];
+
+} catch (PDOException $e) {
+    echo "Error: " . $e->getMessage();
+}
+$conn = null;
     include 'class/sqlconnect.php';
 
     if(isset($_POST['submit'])){
         $prenom = $_POST['Prenom'];
         $nom = $_POST['Nom'];
         $poste = $_POST['Poste'];
+        $poste = htmlentities($poste);
+        $poste = str_replace("'", "\'", $poste);
         $mobile = $_POST['Mobile'];
         $entreprise = $_POST['IDEntreprise'];
 
-        $sql = "INSERT INTO Contact (Prenom, Nom, Poste, Mobile, IDEntreprise) VALUES ('$prenom', '$nom', '$poste', '$mobile', '$entreprise')";
+        $sql = "INSERT INTO Contact (Prenom, Nom, Poste, Mobile, IDEntreprise, IDUser) VALUES ('$prenom', '$nom', '$poste', '$mobile', '$entreprise', '$idsession')";
         mysqli_query($conn, $sql);
     }
 ?>
@@ -62,7 +90,7 @@
       <td>
         <select name="IDEntreprise">
             <?php
-                $sql = "SELECT ID, NomSociete FROM Entreprise";
+                $sql = "SELECT ID, NomSociete FROM Entreprise WHERE UserID =" . $idsession . ";";
                 $result = mysqli_query($conn, $sql);
                 while($row = mysqli_fetch_assoc($result)){
                     echo "<option value='" . $row['ID'] . "'>" . $row['NomSociete'] . "</option>";
@@ -75,3 +103,5 @@
   <br>
   <input type="submit" name="submit" value="Ajouter">
 </form>
+</body>
+</html>

+ 31 - 2
ajoutentreprise.php

@@ -5,6 +5,33 @@
     <meta name="viewport" content="width=device-width">
 </head>
 <?php
+session_start();
+
+if (!isset($_SESSION['loggedin'])) {
+header("Location: login.php");
+exit;
+}
+if (isset($_SESSION['username'])) {
+$prenom = $_SESSION['first_name'];
+$nom = $_SESSION['last_name'];
+$profession = $_SESSION['profession'];
+$idsession = $_SESSION['ID'];
+include_once 'class/sqlconnect.php';
+try {
+    $conn = new PDO("mysql:host=$host;dbname=$dbname", $dbusername, $dbpassword);
+    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+    $stmt = $conn->prepare("SELECT ID FROM users WHERE username = :username");
+    $stmt->bindParam(':username', $_SESSION['username']);
+    $stmt->execute();
+
+    $result = $stmt->fetch(PDO::FETCH_ASSOC);
+    $idsession = $result['ID'];
+
+} catch (PDOException $e) {
+    echo "Error: " . $e->getMessage();
+}
+$conn = null;
+}
 include("class/sqlconnect.php");
 ?>
 <body>
@@ -44,11 +71,13 @@ include("class/sqlconnect.php");
       if(isset($_POST["submit"])) {
           $NomSociete = $_POST["NomSociete"];
           $Adresse = $_POST["Adresse"];
+          $Adresse = htmlentities($Adresse);
+          $Adresse = str_replace("'", "\'", $Adresse);
           $NumeroTel = $_POST["NumeroTel"];
           $StatutEntretien = "2";
 
-          $sql = "INSERT INTO Entreprise (NomSociete, Adresse, NumeroTel, StatutEntretien)
-          VALUES ('$NomSociete', '$Adresse', '$NumeroTel', '$StatutEntretien')";
+          $sql = "INSERT INTO Entreprise (NomSociete, Adresse, NumeroTel, StatutEntretien, UserID)
+          VALUES ('$NomSociete', '$Adresse', '$NumeroTel', '$StatutEntretien', '$idsession')";
           $result = mysqli_query($conn, $sql);
 
           if($result) {

+ 8 - 0
config.php

@@ -0,0 +1,8 @@
+<?php
+// Saisissez les informations vous concernant (prénom, nom et poste recherché)
+// ATTENTION : BIEN ÉCRIRE CES INFORMATIONS ENTRE LES GUILLEMETS !
+$prenom = "Alexandre";
+$nom = "MOTTIER";
+$poste = "Administrateur Systèmes et Réseaux";
+
+?>

+ 32 - 5
creationentretienphy.php

@@ -1,13 +1,36 @@
 <?php
+session_start();
+
+if (!isset($_SESSION['loggedin'])) {
+  header("Location: login.php");
+  exit;
+}
+?>
+<?php
+include_once 'class/sqlconnect.php';
+try {
+    $conn = new PDO("mysql:host=$host;dbname=$dbname", $dbusername, $dbpassword);
+    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+    $stmt = $conn->prepare("SELECT ID FROM users WHERE username = :username");
+    $stmt->bindParam(':username', $_SESSION['username']);
+    $stmt->execute();
+
+    $result = $stmt->fetch(PDO::FETCH_ASSOC);
+    $idsession = $result['ID'];
+
+} catch (PDOException $e) {
+    echo "Error: " . $e->getMessage();
+}
+$conn = null;
     include 'class/sqlconnect.php';
-    $query = "SELECT ID, NomSociete, Adresse FROM Entreprise";
+    $query = "SELECT ID, NomSociete, Adresse FROM Entreprise WHERE UserID =" . $idsession . ";";
     $result = mysqli_query($conn, $query);
     $options = "";
     while ($row = mysqli_fetch_assoc($result)) {
         $options .= "<option value={$row['ID']}>{$row['NomSociete']} - {$row['Adresse']}</option>";
     }
 
-    $query = "SELECT ID, Prenom, Nom, Mobile, IDEntreprise FROM Contact";
+    $query = "SELECT ID, Prenom, Nom, Mobile, IDEntreprise FROM Contact WHERE IDUser =" . $idsession . ";";
     $result = mysqli_query($conn, $query);
     $options2 = "";
     while ($row = mysqli_fetch_assoc($result)) {
@@ -70,7 +93,7 @@
             <label for="ponctualiteEntreprise">Ponctualité de l'entreprise :</label>
           </td>
           <td style='border:1px solid #000;'>
-            <input type="checkbox" id="ponctualiteEntreprise" name="ponctualiteEntreprise">
+            <input type="checkbox" id="ponctualiteEntreprise" value="1" name="ponctualiteEntreprise">
           </td>
         </tr>
         <tr style='border:1px solid #000;'>
@@ -94,7 +117,7 @@
             <label for="suivi">Déroulement et suivi Entretien:</label>
           </td>
           <td style='border:1px solid #000;'>
-            <textarea id="suivi" name="suivi" value="<?php echo $suivi; ?>" rows="4" cols="50"></textarea>
+            <textarea id="suivi" name="suivi" value="<?php echo $suivi; ?>" rows="20" cols="150"></textarea>
           </td>
         </tr>
         </table>
@@ -110,13 +133,17 @@
       $ponctualiteEntreprise = $_POST['ponctualiteEntreprise'];
       $remuneration = $_POST['remuneration'];
       $poste = $_POST['poste'];
+      $poste = str_replace("'", "\'", $poste);
       $suivi = $_POST['suivi'];
+      $suivi = htmlentities($suivi);
+      $suivi = str_replace("'", "\'", $suivi);
 
       $sql = "INSERT INTO EntretienPresentiel (IDEntreprise, IDContact, DateHeurePrevueEntretien, DateHeureEffectiveEntretien, PonctualiteEntreprise, Remuneration, PosteAborde, SuiviEntretien)
       VALUES ('$idEntreprise', '$idContact', '$dateHeurePrevueEntretien', '$dateHeureEffectiveEntretien', '$ponctualiteEntreprise', '$remuneration', '$poste', '$suivi')";
-      
+
       if ($conn->query($sql) === TRUE) {
           echo "L'entretien présentiel a été enregistré avec succès.";
+          header("refresh:1; url=index.php");
       } else {
           echo "Erreur lors de l'enregistrement de l'entretien présentiel: " . $conn->error;
       }

+ 57 - 30
creationentretientel.php

@@ -1,13 +1,36 @@
 <?php
+session_start();
+
+if (!isset($_SESSION['loggedin'])) {
+  header("Location: login.php");
+  exit;
+}
+?>
+<?php
+include_once 'class/sqlconnect.php';
+try {
+    $conn = new PDO("mysql:host=$host;dbname=$dbname", $dbusername, $dbpassword);
+    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+    $stmt = $conn->prepare("SELECT ID FROM users WHERE username = :username");
+    $stmt->bindParam(':username', $_SESSION['username']);
+    $stmt->execute();
+
+    $result = $stmt->fetch(PDO::FETCH_ASSOC);
+    $idsession = $result['ID'];
+
+} catch (PDOException $e) {
+    echo "Error: " . $e->getMessage();
+}
+$conn = null;
     include 'class/sqlconnect.php';
-    $query = "SELECT ID, NomSociete FROM Entreprise";
+    $query = "SELECT ID, NomSociete FROM Entreprise WHERE UserID =" . $idsession . ";";
     $result = mysqli_query($conn, $query);
     $options = "";
     while ($row = mysqli_fetch_assoc($result)) {
         $options .= "<option value={$row['ID']}>{$row['NomSociete']}</option>";
     }
 
-    $query = "SELECT ID, Prenom, Nom, Mobile, IDEntreprise FROM Contact";
+    $query = "SELECT ID, Prenom, Nom, Mobile, IDEntreprise FROM Contact WHERE IDUser =" . $idsession . ";";
     $result = mysqli_query($conn, $query);
     $options2 = "";
     while ($row = mysqli_fetch_assoc($result)) {
@@ -28,73 +51,73 @@
   <a href="index.php">Revenir à l'accueil</a><br><br>
   <h1>Création d'un entretien téléphonique</h1>
     <form action="creationentretientel.php" method="post">
-      <table style='border:1px solid #000;'>
-        <tr style='border:1px solid #000;'>
-          <td style='border:1px solid #000;'>
+      <table>
+        <tr>
+          <td>
             <label for="idEntreprise">Nom de l'entreprise :</label>
           </td>
-          <td style='border:1px solid #000;'>
+          <td>
             <select id="idEntreprise" name="idEntreprise">
             <?php echo $options; ?>
             </select>
           </td>
         </tr>
-        <tr style='border:1px solid #000;'>
-          <td style='border:1px solid #000;'>
+        <tr>
+          <td>
             <label for="idContact">Contact de l'entreprise :</label>
           </td>
-          <td style='border:1px solid #000;'>
+          <td>
             <select id="idContact" name="idContact">
             <?php echo $options2; ?>
             </select>
           </td>
         </tr>
-        <tr style='border:1px solid #000;'>
-          <td style='border:1px solid #000;'>
+        <tr>
+          <td>
             <label for="dateHeurePrevueEntretien">Date/heure prévue de l'entretien :</label>
           </td>
-          <td style='border:1px solid #000;'>
+          <td>
             <input type="datetime-local" id="dateHeurePrevueEntretien" name="dateHeurePrevueEntretien">
           </td>
         </tr>
-        <tr style='border:1px solid #000;'>
-          <td style='border:1px solid #000;'>
+        <tr>
+          <td>
             <label for="dateHeureEffectiveEntretien">Date/heure effective de l'entretien :</label>
           </td>
-          <td style='border:1px solid #000;'>
+          <td>
             <input type="datetime-local" id="dateHeureEffectiveEntretien" name="dateHeureEffectiveEntretien">
           </td>
         </tr>
-        <tr style='border:1px solid #000;'>
-          <td style='border:1px solid #000;'>
+        <tr>
+          <td>
             <label for="ponctualiteEntreprise">Ponctualité de l'entreprise :</label>
           </td>
-          <td style='border:1px solid #000;'>
-            <input type="checkbox" id="ponctualiteEntreprise" name="ponctualiteEntreprise">
+          <td>
+            <input type="checkbox" value="1" id="ponctualiteEntreprise" name="ponctualiteEntreprise">
           </td>
         </tr>
-        <tr style='border:1px solid #000;'>
-          <td style='border:1px solid #000;'>
+        <tr>
+          <td>
             <label for="remuneration">Rémunération proposée:</label>
           </td>
-          <td style='border:1px solid #000;'>
+          <td>
             <input type="text" id="remuneration" name="remuneration" value="<?php echo $remuneration; ?>" >
           </td>
         </tr>
-        <tr style='border:1px solid #000;'>
-          <td style='border:1px solid #000;'>
+        <tr>
+          <td>
             <label for="poste">Poste proposé:</label>
           </td>
-          <td style='border:1px solid #000;'>
+          <td>
             <input type="text" id="poste" name="poste" value="<?php echo $poste; ?>" >
           </td>
         </tr>
-        <tr style='border:1px solid #000;'>
-          <td style='border:1px solid #000;'>
+        <tr>
+          <td>
             <label for="suivi">Déroulement et suivi Entretien :</label>
           </td>
-          <td style='border:1px solid #000;'>
-            <textarea id="suivi" name="suivi" value="<?php echo $suivi; ?>" rows="4" cols="50"></textarea>
+          <td>
+            <textarea id="suivi" name="suivi" value="<?php echo $suivi; ?>" rows="20" cols="150"></textarea>
           </td>
         </tr>
         </table>
@@ -110,13 +133,17 @@
       $ponctualiteEntreprise = $_POST['ponctualiteEntreprise'];
       $remuneration = $_POST['remuneration'];
       $poste = $_POST['poste'];
+      $poste = str_replace("'", "\'", $poste);
       $suivi = $_POST['suivi'];
+      $suivi = htmlentities($suivi);
+      $suivi = str_replace("'", "\'", $suivi);
 
       $sql = "INSERT INTO EntretienTelephonique (IDEntreprise, IDContact, DateHeurePrevueEntretien, DateHeureEffectiveEntretien, PonctualiteEntreprise, Remuneration, PosteAborde, SuiviEntretien)
       VALUES ('$idEntreprise', '$idContact', '$dateHeurePrevueEntretien', '$dateHeureEffectiveEntretien', '$ponctualiteEntreprise', '$remuneration', '$poste', '$suivi')";
-      
+
       if ($conn->query($sql) === TRUE) {
           echo "L'entretien téléphonique a été enregistré avec succès.";
+          header("refresh:1; url=index.php");
       } else {
           echo "Erreur lors de l'enregistrement de l'entretien téléphonique: " . $conn->error;
       }

+ 25 - 12
custom.css

@@ -3,12 +3,25 @@
 @import url('https://fonts.googleapis.com/css2?family=Ubuntu&display=swap');
 
 /* Définition de la couleur bleue pour les tableaux et le fond */
-.table {
-    background-color: #87CEEB;
+table {
+    border-collapse: collapse;
+    background-color: #003153;
     color: #FFFFFF;
-    border: 1px solid #000;
+    border: 1px solid #FFF;
     font-family: 'Poppins', sans-serif;
 }
+td {
+  border: 1px solid;
+  border-color: rgb(255, 255, 255);
+}
+tr {
+  border: 1px solid;
+  border-color: rgb(255, 255, 255);
+}
+th {
+  border: 1px solid;
+  border-color: rgb(255, 255, 255);
+}
 body {
   background-color: #003153; /* Couleur fond */
   font-family: 'Poppins', sans-serif; /* Police Poppins */
@@ -37,23 +50,23 @@ a:hover {
 
 
 /* Définition de la couleur jaune pour le texte */
-.table th, .table td {
+/* .table th, .table td {
     color: #FFFF00;
     text-align: left;
     padding: 8px;
-}
+} */
 
-/* Ajout d'un peu d'espacement entre les cellules */
-.table td, .table th, .table tr {
+/* Ajout d'un peu d'espacement entre les cellules
+ .table td, .table th, .table tr {
     border: 1px solid #000;
     padding: 8px;
-}
+} */
 
-/* Ajout d'un peu de relief aux cellules survolées */
-.table tr:hover {background-color: #f5f5f5;}
+/* Ajout d'un peu de relief aux cellules survolées
+.table tr:hover {background-color: #f5f5f5;} */
 
-/* Alignement du texte dans les cellules */
+/* Alignement du texte dans les cellules
 .table th, .table td {
     text-align: left;
     padding: 8px;
-}
+} */

+ 77 - 20
index.php

@@ -3,10 +3,63 @@
   <title>Utilitaire de recherche d'emploi - Liste des entreprises</title>
   <link href="custom.css" rel="stylesheet">
   <meta name="viewport" content="width=device-width">
+  <?php
+session_start();
+
+if (!isset($_SESSION['loggedin'])) {
+  header("Location: login.php");
+  exit;
+} else {
+$prenom = $_SESSION['first_name'];
+$nom = $_SESSION['last_name'];
+$profession = $_SESSION['profession'];
+$idsession = $_SESSION['ID'];
+}
+include_once 'class/sqlconnect.php';
+
+try {
+    $conn = new PDO("mysql:host=$host;dbname=$dbname", $dbusername, $dbpassword);
+    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+    $stmt = $conn->prepare("SELECT first_name, last_name, profession, ID FROM users WHERE username = :username");
+    $stmt->bindParam(':username', $_SESSION['username']);
+    $stmt->execute();
+
+    $result = $stmt->fetch(PDO::FETCH_ASSOC);
+    $prenom = $result['first_name'];
+    $nom = $result['last_name'];
+    $profession = $result['profession'];
+    $idsession = $result['ID'];
+
+} catch (PDOException $e) {
+    echo "Error: " . $e->getMessage();
+}
+$conn = null;
+?>
+
 </head>
 <body>
-    <h1>Utilitaire PHP de Recherche d'Emploi</h1>
-    <h2>Liste des entreprises</h2>
+  <?php
+  // Récupérer l'heure actuelle
+  $time = date("H");
+  // Créer un message à afficher en fonction de l'heure
+  if ($time < "18") {
+      $greet = "Bonjour";
+  } else {
+      $greet = "Bonsoir";
+  }
+  ?>
+  <fieldset>
+    <legend><font size="6"><?php echo $greet . ", " . $result['first_name'] . " !" ?></font></legend>
+    <font size="5">Poste recherché : <?php echo $profession ?></font><br>
+    <br><font size="2"><a href="logout.php">Se déconnecter</a> - <a href="modifprofil.php">Modifier votre profil</a> - <a href="https://github.com/alexandremottier/PHP-RechercheEmploi" target="_blank">Développé avec amour par Aiden ♥️</a></font>
+  </fieldset><br>
+    <font size="5">Votre recherche d'emploi - Liste de vos entreprises</font>
+  <p>Ci-dessous se trouve la liste de vos entreprises ainsi que le suivi de vos échanges (contacts, entretiens, statuts de vos candidatures).
+  <br>Vous pouvez ajouter un nombre illimité d'entreprises, mais vous ne pourrez pas en supprimer (en raison des dépendances avec les entretiens et les contacts).
+  <br>En cas de problème, vous pouvez contacter l'<a href="mailto:contact@am-networks.fr">équipe support</a>.
+  <br>En cas de bug applicatif, vous pouvez créer une <a href="https://github.com/alexandremottier/PHP-RechercheEmploi/issues/new" target="_blank">issue sur GitHub</a>.
+</p>
+<br>
 <?php
 ini_set('display_errors', 1);
 ini_set('display_startup_errors', 1);
@@ -15,39 +68,43 @@ error_reporting(E_ALL);
 include("class/sqlconnect.php");
 
 // Récupère les données de la table Entreprise
-$sql = "SELECT Entreprise.ID, Entreprise.NomSociete, Contact.ID, Contact.Prenom, Contact.Nom, Entreprise.Adresse, StatutEntretien.Statut
+$sql = "SELECT Entreprise.ID AS EntrepriseID, Entreprise.NomSociete, Contact.ID, Contact.Prenom, Contact.Nom, Contact.Mobile, Entreprise.Adresse, StatutEntretien.Statut
 FROM Entreprise
 LEFT JOIN Contact ON Entreprise.ID = Contact.IDEntreprise
-LEFT JOIN StatutEntretien ON Entreprise.StatutEntretien = StatutEntretien.ID";
+LEFT JOIN StatutEntretien ON Entreprise.StatutEntretien = StatutEntretien.ID
+WHERE Entreprise.UserID = '" . $idsession . "'";
 $result = mysqli_query($conn, $sql);
 if (!$result) {
     die("Impossible de récupérer les données: " . mysqli_error($conn));
 }
 
-echo "<table style='border:1px solid #000;'>";
-echo "<tr><th style='border:1px solid #000;'>Nom de la société</th><th style='border:1px solid #000;'>Contact</th><th style='border:1px solid #000;'>Adresse</th><th style='border:1px solid #000;'>Statut</th><th style='border:1px solid #000;'>Entretiens</th></tr>";
+echo "<table>";
+echo "<tr><th>Société</th><th>Contact</th><th>Adresse</th><th>Statut</th><th>Entretiens</th></tr>";
 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
+    if (!empty($row['Mobile'])) {
+        $mobile = '(' . $row['Mobile'] . ')';
+    } else {
+        $mobile = '';
+    }
     echo "<tr>";
-    echo "<td style='border:1px solid #000;'>" . $row['NomSociete'] . "</td>";
-    echo "<td style='border:1px solid #000;'>" . "<a href='infocontact.php?ID=" . $row['ID'] . "'>" . $row['Prenom'] . ' ' . $row['Nom'] . "</a>" . "</td>";
-    echo "<td style='border:1px solid #000;'>" . $row['Adresse'] . "</td>";
-    echo "<td style='border:1px solid #000;'>" . $row['Statut'] . "</td>";
-    echo "<td style='border:1px solid #000;'>" . "<a href='infoentretien.php?ID=" . $row['ID'] . "'>Afficher les entretiens</a>" . "</td>";
+    echo "<td>&nbsp; " . "<a href='modifentreprise.php?ID=" . $row['EntrepriseID'] . "'> " . $row['NomSociete'] . " </a>&nbsp;</td>";
+    echo "<td>&nbsp; " . "<a href='infocontact.php?ID=" . $row['ID'] . "'> " . $row['Prenom'] . ' ' . $row['Nom'] . ' ' . $mobile . "</a> " . " &nbsp;</td>";
+    echo "<td>&nbsp; " . $row['Adresse'] . " &nbsp;</td>";
+    echo "<td>&nbsp; " . $row['Statut'] . " &nbsp;</td>";
+    echo "<td> " . "<a href='infoentretien.php?ID=" . $row['ID'] . "'>&nbsp; Afficher les entretiens &nbsp;</a>" . " &nbsp;</td>";
     echo '</tr>';
 }
+
 echo "</table>";
 mysqli_close($conn);
 ?>
 <br>
-<button onclick="window.location.href='ajoutentreprise.php'" class="button">Créer une entreprise</button>
-<button onclick="window.location.href='ajoutcontact.php'" class="button">Créer un contact</button>
-<button onclick="window.location.href='modificationstatut.php'" class="button">Modifier le statut pour une entreprise</button>
+<font size="3">
+<a href="ajoutentreprise.php">Créer une entreprise</a>&nbsp;-&nbsp;
+<a href="ajoutcontact.php">Créer un contact</a>&nbsp;-&nbsp;
+<a href="creationentretientel.php">Créer un entretien téléphonique</a>&nbsp;-&nbsp;
+<a href="creationentretienphy.php">Créer un entretien présentiel ou visio</a>
+</font>
 <br><br>
-<a href="creationentretientel.php">Saisir un entretien téléphonique</a><br>
-<a href="creationentretienphy.php">Saisir un entretien présentiel/visio</a>
-
-<footer>
-<a href="https://github.com/alexandremottier/PHP-RechercheEmploi" target="_blank">Made with love by Aiden ♥️</a>
-</footer>
 </body>
 </html>

+ 9 - 0
infocontact.php

@@ -3,6 +3,15 @@
     <title>Afficher un contact</title>
     <link href="custom.css" rel="stylesheet">
     <meta name="viewport" content="width=device-width">
+    <?php
+session_start();
+
+if (!isset($_SESSION['loggedin'])) {
+  header("Location: login.php");
+  exit;
+}
+?>
+
 </head>
 <body>
     <a href="index.php">Revenir à l'accueil</a><br><br>

+ 62 - 20
infoentretien.php

@@ -3,6 +3,15 @@
     <title>Afficher les entretiens</title>
     <link href="custom.css" rel="stylesheet">
     <meta name="viewport" content="width=device-width">
+    <?php
+session_start();
+
+if (!isset($_SESSION['loggedin'])) {
+  header("Location: login.php");
+  exit;
+}
+?>
+
 </head>
 <?php
 include('class/sqlconnect.php');
@@ -13,10 +22,21 @@ if ($result) {
     $row = mysqli_fetch_assoc($result);
 }
 $conn->close();
+include('class/sqlconnect.php');
+$sql2 = "SELECT Prenom, Nom FROM Contact WHERE Contact.ID =$id";
+$result2 = mysqli_query($conn, $sql2);
+if ($result2) {
+    $row2 = mysqli_fetch_assoc($result2);
+$conn->close();
+}
 ?>
 <body>
     <a href="index.php">Revenir à l'accueil</a><br><br>
-    <h1>Afficher les entretiens<br>Société <?php echo $row['NomSociete'] ?></h1>
+    <fieldset>
+      <legend><font size="6">Afficher les entretiens</font></legend>
+        <font size="5">Société <?php echo $row['NomSociete'] ?></font><br>
+        <font size="5">Votre interlocuteur(trice) : <?php echo $row2['Prenom'] . " " . $row2['Nom'] ?></font>
+    </fieldset>
 <?php
 include('class/sqlconnect.php');
 $id = $_GET['ID'];
@@ -26,44 +46,66 @@ $id = $_GET['ID'];
 
 $sql = "SELECT EntretienTelephonique.DateHeurePrevueEntretien, EntretienTelephonique.DateHeureEffectiveEntretien, EntretienTelephonique.PonctualiteEntreprise, EntretienTelephonique.Remuneration, EntretienTelephonique.PosteAborde, EntretienTelephonique.SuiviEntretien FROM EntretienTelephonique JOIN Contact ON EntretienTelephonique.IDContact = Contact.ID WHERE Contact.ID =$id";
 $result = mysqli_query($conn, $sql);
-echo "<table style='border:1px solid #000;'>";
+echo "<table>";
 if ($result->num_rows > 0) {
 while($row = $result->fetch_assoc()) {
-        echo "<tr><td style='border:1px solid #000;'>Date/heure prévue entretien :</td><td style='border:1px solid #000;'>" . $row["DateHeurePrevueEntretien"] . "</td></tr>";
-        echo "<tr><td style='border:1px solid #000;'>Date/heure effective entretien :</td><td style='border:1px solid #000;'>" . $row["DateHeureEffectiveEntretien"] . "</td></tr>";
-        echo "<tr><td style='border:1px solid #000;'>Entreprise ponctuelle :</td><td style='border:1px solid #000;'>" . $row["PonctualiteEntreprise"] . "</td></tr>";
-        echo "<tr><td style='border:1px solid #000;'>Rémunération abordée :</td><td style='border:1px solid #000;'>" . $row["Remuneration"] . "</td></tr>";
-        echo "<tr><td style='border:1px solid #000;'>Poste abordé :</td><td style='border:1px solid #000;'>" . $row["PosteAborde"] . "</td></tr>";
-        echo "<tr><td style='border:1px solid #000;'>Suivi entretien :</td><td style='border:1px solid #000;'>" . $row["SuiviEntretien"] . "</td></tr>";
-        echo "<br><button onclick='window.location.href=`modifentretientel.php?ID=" . $id . "`' class='button'>Modifier l'entretien</button>";
+        $suivi = $row['SuiviEntretien'];
+        $suivi = html_entity_decode($suivi);
+        $suivi = nl2br($suivi);
+        $newdatepre = date("d/m/Y H:i", strtotime($row["DateHeurePrevueEntretien"]));
+        $newdateeff = date("d/m/Y H:i", strtotime($row["DateHeureEffectiveEntretien"]));
+        if ($row["PonctualiteEntreprise"] == 1) {
+          $ponctualite = "OUI";
+        } else {
+          $ponctualite = "NON";
+        };
+        echo "<tr><td>&nbsp; Date/heure prévue entretien &nbsp;</td><td>&nbsp; " . $newdatepre . " &nbsp;</td></tr>";
+        echo "<tr><td>&nbsp; Date/heure effective entretien &nbsp;</td><td> &nbsp;" . $newdateeff . " &nbsp;</td></tr>";
+        echo "<tr><td>&nbsp; Entreprise ponctuelle &nbsp;</td><td>&nbsp; " . $ponctualite . " &nbsp;</td></tr>";
+        echo "<tr><td>&nbsp; Rémunération abordée &nbsp;</td><td>&nbsp; " . $row["Remuneration"] . " &nbsp;</td></tr>";
+        echo "<tr><td>&nbsp; Poste abordé &nbsp;</td><td>&nbsp; " . $row["PosteAborde"] . " &nbsp;</td></tr>";
+        echo "<tr><td>&nbsp; Déroulement et suivi entretien &nbsp;</td><td>" . $suivi . "</td></tr>";
+        echo "<br><a href='modifentretientel.php?ID=" . $id . "'>Modifier l'entretien</a>";
     };
   } else {
-    echo "<tr colspan='4'><td>Pas de résultat</td></tr>";
+    echo "<tr colspan='4'><td>&nbsp; Pas de résultat &nbsp;</td></tr>";
   }
 $conn->close();
 ?>
 </table>
 <br>
-<h2>Entretien physique/visio</h2>
+<h2>Entretien présentiel/visio</h2>
 <?php
 include('class/sqlconnect.php');
 $id = $_GET['ID'];
 $sql = "SELECT EntretienPresentiel.DateHeurePrevueEntretien, EntretienPresentiel.DateHeureEffectiveEntretien, EntretienPresentiel.PonctualiteEntreprise, EntretienPresentiel.Remuneration, EntretienPresentiel.PosteAborde, EntretienPresentiel.SuiviEntretien FROM EntretienPresentiel JOIN Contact ON EntretienPresentiel.IDContact = Contact.ID WHERE Contact.ID =$id";
 $result = mysqli_query($conn, $sql);
-echo "<table style='border:1px solid #000;'>";
+echo "<table>";
 if ($result->num_rows > 0) {
 while($row = $result->fetch_assoc()) {
-        echo "<tr><td style='border:1px solid #000;'>Date/heure prévue entretien :</td><td style='border:1px solid #000;'>" . $row["DateHeurePrevueEntretien"] . "</td></tr>";
-        echo "<tr><td style='border:1px solid #000;'>Date/heure effective entretien :</td><td style='border:1px solid #000;'>" . $row["DateHeureEffectiveEntretien"] . "</td></tr>";
-        echo "<tr><td style='border:1px solid #000;'>Entreprise ponctuelle :</td><td style='border:1px solid #000;'>" . $row["PonctualiteEntreprise"] . "</td></tr>";
-        echo "<tr><td style='border:1px solid #000;'>Rémunération abordée :</td><td style='border:1px solid #000;'>" . $row["Remuneration"] . "</td></tr>";
-        echo "<tr><td style='border:1px solid #000;'>Poste abordé :</td><td style='border:1px solid #000;'>" . $row["PosteAborde"] . "</td></tr>";
-        echo "<tr><td style='border:1px solid #000;'>Suivi entretien :</td><td style='border:1px solid #000;'>" . $row["SuiviEntretien"] . "</td></tr>";
-        echo "<br><button onclick='window.location.href=`modifentretienphy.php?ID=" . $id . "`' class='button'>Modifier l'entretien</button>";
+        $suivi = $row['SuiviEntretien'];
+        $suivi = html_entity_decode($suivi);
+        $suivi = nl2br($suivi);
+        $newdatepre = date("d/m/Y H:i", strtotime($row["DateHeurePrevueEntretien"]));
+        $newdateeff = date("d/m/Y H:i", strtotime($row["DateHeureEffectiveEntretien"]));
+        if ($row["PonctualiteEntreprise"] == 1) {
+          $ponctualite = "OUI";
+        } else {
+          $ponctualite = "NON";
+        };
+        echo "<tr><td>&nbsp; Date/heure prévue entretien &nbsp;</td><td>&nbsp; " . $newdatepre . " &nbsp;</td></tr>";
+        echo "<tr><td>&nbsp; Date/heure effective entretien &nbsp;</td><td>&nbsp; " . $newdateeff . " &nbsp;</td></tr>";
+        echo "<tr><td>&nbsp; Entreprise ponctuelle &nbsp;</td><td>&nbsp; " . $ponctualite . " &nbsp;</td></tr>";
+        echo "<tr><td>&nbsp; Rémunération abordée &nbsp;</td><td>&nbsp; " . $row["Remuneration"] . " &nbsp;</td></tr>";
+        echo "<tr><td>&nbsp; Poste abordé &nbsp;</td><td>&nbsp; " . $row["PosteAborde"] . " &nbsp;</td></tr>";
+        echo "<tr><td>&nbsp; Déroulement et suivi entretien &nbsp;</td><td>" . $suivi . "</td></tr>";
+        echo "<br><a href='modifentretienphy.php?ID=" . $id . "'>Modifier l'entretien</a>";
     };
   } else {
-    echo "<tr colspan='4'><td>Pas de résultat</td></tr>";
+    echo "<tr colspan='4'><td>&nbsp; Pas de résultat &nbsp;</td></tr>";
   }
 $conn->close();
 ?>
 </table>
+</body>
+</html>

+ 36 - 0
login.php

@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Gestionnaire de recherche d'emploi - Connexion</title>
+    <link href="custom.css" rel="stylesheet">
+    <meta name="viewport" content="width=device-width">
+  </head>
+  <body>
+    <h1>Gestionnaire de recherche d'emploi - Connexion</h1>
+    <h2>Contrôle d'identité ! Vous devez vous connecter pour accéder à cette page !</h2>
+    <form action="verify.php" method="post">
+      <table>
+        <tr style='border:0px;'>
+          <td style='border:0px;'>
+            <label for="username">&nbsp;Nom d'utilisateur :</label>
+          </td>
+          <td style='border:0px;'>
+            <input type="text" name="username" required>
+          </td>
+        </tr>
+        <tr style='border:0px;'>
+          <td style='border:0px;'>
+            <label for="password">&nbsp;Mot de passe :</label>
+          </td>
+          <td style='border:0px;'>
+            <input type="password" name="password" required>
+          </td>
+        </tr>
+      </table>
+          <br>
+          <input type="submit" value="Se connecter">
+    </form><br><br>
+    Si vous n'avez pas encore de compte, vous pouvez <a href="register.php">en créer un gratuitement</a> !<br>
+    Si vous avez perdu vos identifiants, vous pouvez <a href="mailto:support@am-networks.fr">envoyer un mail à l'équipe support</a> en indiquant votre identifiant ainsi que vos noms et prénoms !
+  </body>
+</html>

+ 5 - 0
logout.php

@@ -0,0 +1,5 @@
+<?php
+session_start();
+session_destroy();
+header("Location: login.php");
+?>

+ 12 - 1
modifcontact.php

@@ -3,6 +3,15 @@
     <title>Modifier un contact</title>
     <link href="custom.css" rel="stylesheet">
     <meta name="viewport" content="width=device-width">
+    <?php
+session_start();
+
+if (!isset($_SESSION['loggedin'])) {
+  header("Location: login.php");
+  exit;
+}
+?>
+
 </head>
 <body>
     <h1>Modifier un contact</h1>
@@ -13,7 +22,7 @@
     $result = $conn->query($sql);
     $row = $result->fetch_assoc();
 ?>
-
+<a href="index.php">Revenir à l'accueil</a><br><br>
 <form action="modifcontact.php" method="post">
   <table>
     <tr>
@@ -79,6 +88,8 @@ $id = $_POST['ID'];
 $prenom = $_POST['Prenom'];
 $nom = $_POST['Nom'];
 $poste = $_POST['Poste'];
+$poste = htmlentities($poste);
+$poste = str_replace("'", "\'", $poste);
 $entreprise = $_POST['IDEntreprise'];
 $mobile = $_POST['Mobile'];
 

+ 100 - 0
modifentreprise.php

@@ -0,0 +1,100 @@
+<html>
+<head>
+    <title>Modifier une entreprise</title>
+    <link href="custom.css" rel="stylesheet">
+    <meta name="viewport" content="width=device-width">
+    <?php
+session_start();
+
+if (!isset($_SESSION['loggedin'])) {
+  header("Location: login.php");
+  exit;
+}
+?>
+
+</head>
+<body>
+  <fieldset>
+    <legend><font size="6">Modifier une entreprise</font></legend>
+    <?php
+        include('class/sqlconnect.php');
+        $id = $_GET['ID'];
+        $sql = "SELECT * FROM Entreprise WHERE ID = '$id'";
+        $result = $conn->query($sql);
+        $row = $result->fetch_assoc();
+        $entreprise_id = $row['StatutEntretien'];
+    ?>
+    <font size="5">Société <?php echo $row['NomSociete'] ?></font>
+  </fieldset><br>
+<a href="index.php">Revenir à l'accueil</a><br><br>
+<form action="modifentreprise.php" method="post">
+  <table>
+    <tr>
+      <td>
+        <input type="hidden" name="ID" value="<?php echo $id; ?>">
+        <label>Nom de la société :</label>
+      </td>
+      <td>
+        <input type="text" name="NomSociete" value="<?php echo $row['NomSociete']; ?>">
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <label>Adresse :</label>
+      </td>
+      <td>
+        <input type="text" name="Adresse" value="<?php echo $row['Adresse']; ?>">
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <label>Numéro de téléphone :</label>
+      </td>
+      <td>
+        <input type="text" name="NumeroTel" value="<?php echo $row['NumeroTel']; ?>">
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <label>Statut :</label>
+      </td>
+      <td>
+        <select name="statut" id="statut">
+            <?php
+                include('class/sqlconnect.php');
+                $sql = "SELECT StatutEntretien.ID, StatutEntretien.Statut FROM StatutEntretien";
+                $result = mysqli_query($conn, $sql);
+                while($row = mysqli_fetch_assoc($result)){
+                  if ($row['ID'] == $entreprise_id) {
+                     echo "<option value='" . $row['ID'] . "' selected>" . $row['Statut'] . "</option>";
+                    } else {
+                     echo "<option value='" . $row['ID'] . "'>" . $row['Statut'] . "</option>";
+                    }
+                }
+            ?>
+        </select>
+    </table>
+    <br>
+    <input type="submit" name="submit" value="Enregistrer les modifications">
+</form>
+
+<?php
+if(isset($_POST['submit'])) {
+$id = $_POST['ID'];
+$nomsociete = $_POST['NomSociete'];
+$adresse = $_POST['Adresse'];
+$adresse = htmlentities($adresse);
+$adresse = str_replace("'", "\'", $adresse);
+$numerotel = $_POST['NumeroTel'];
+$statut = $_POST['statut'];
+
+$sql = "UPDATE Entreprise SET NomSociete='$nomsociete', Adresse='$adresse', NumeroTel='$numerotel', StatutEntretien='$statut' WHERE ID='$id'";
+
+if ($conn->query($sql) === TRUE) {
+    echo "La société a été modifiée avec succès";
+    header("Location: index.php");
+} else {
+    echo "Erreur lors de la modification : " . $conn->error;
+}
+}
+?>

+ 44 - 5
modifentretienphy.php

@@ -3,8 +3,32 @@
     <title>Modifier un entretien présentiel/visio</title>
     <link href="custom.css" rel="stylesheet">
     <meta name="viewport" content="width=device-width">
+    <?php
+session_start();
+
+if (!isset($_SESSION['loggedin'])) {
+  header("Location: login.php");
+  exit;
+}
+?>
+
 </head>
 <?php
+include_once 'class/sqlconnect.php';
+try {
+    $conn = new PDO("mysql:host=$host;dbname=$dbname", $dbusername, $dbpassword);
+    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+    $stmt = $conn->prepare("SELECT ID FROM users WHERE username = :username");
+    $stmt->bindParam(':username', $_SESSION['username']);
+    $stmt->execute();
+
+    $result = $stmt->fetch(PDO::FETCH_ASSOC);
+    $idsession = $result['ID'];
+
+} catch (PDOException $e) {
+    echo "Error: " . $e->getMessage();
+}
+$conn = null;
 include('class/sqlconnect.php');
 $id = $_GET['ID'];
 $sql = "SELECT NomSociete FROM Entreprise JOIN Contact ON Entreprise.ID = Contact.IDEntreprise WHERE Contact.ID =$id";
@@ -13,9 +37,21 @@ if ($result) {
     $row = mysqli_fetch_assoc($result);
 }
 $conn->close();
+include('class/sqlconnect.php');
+$sql2 = "SELECT Prenom, Nom FROM Contact WHERE Contact.ID =$id";
+$result2 = mysqli_query($conn, $sql2);
+if ($result2) {
+    $row2 = mysqli_fetch_assoc($result2);
+$conn->close();
+}
 ?>
 <body>
-    <h1>Modifier un entretien présentiel/visio<br>Société <?php echo $row['NomSociete'] ?></h1>
+  <a href="index.php">Revenir à l'accueil</a><br><br>
+  <fieldset>
+    <legend><font size="6">Modifier un entretien présentiel/visio</font></legend>
+      <font size="5">Société <?php echo $row['NomSociete'] ?></font><br>
+      <font size="5">Votre interlocuteur(trice) : <?php echo $row2['Prenom'] . " " . $row2['Nom'] ?></font>
+  </fieldset><br>
 <?php
     include('class/sqlconnect.php');
     $id = $_GET['ID'];
@@ -23,7 +59,6 @@ $conn->close();
     $result = $conn->query($sql);
     $row = $result->fetch_assoc();
 ?>
-<a href="index.php">Revenir à l'accueil</a><br><br>
 <form action="modifentretienphy.php" method="post">
   <table style='border:1px solid #000;'>
       <tr style='border:1px solid #000;'>
@@ -64,7 +99,7 @@ $conn->close();
           <label for="Poste">Poste proposé:</label>
         </td>
         <td style='border:1px solid #000;'>
-          <input type="text" id="Poste" name="Poste" value="<?php echo $row['Poste']; ?>">
+          <input type="text" id="Poste" name="Poste" value="<?php echo $row['PosteAborde']; ?>">
         </td>
       </tr>
       <tr style='border:1px solid #000;'>
@@ -72,7 +107,8 @@ $conn->close();
           <label for="Suivi">Déroulement et suivi Entretien :</label>
         </td>
         <td style='border:1px solid #000;'>
-          <textarea id="Suivi" name="Suivi"><?php echo $row['SuiviEntretien']; ?></textarea>
+          <?php $row['SuiviEntretien'] = str_replace("\'", "'", $row['SuiviEntretien']); ?>
+          <textarea id="Suivi" name="Suivi" rows="20" cols="150"><?php echo $row['SuiviEntretien']; ?></textarea>
         </td>
       </tr>
     </table>
@@ -88,13 +124,16 @@ if (isset($_POST['submit'])) {
     $ponctualiteEntreprise = $_POST['PonctualiteEntreprise'];
     $remuneration = $_POST['Remuneration'];
     $poste = $_POST['Poste'];
+    $poste = str_replace("'", "\'", $poste);
     $suivi = $_POST['Suivi'];
+    $suivi = htmlentities($suivi);
+    $suivi = str_replace("'", "\'", $suivi);
 
 $sql = "UPDATE EntretienPresentiel SET DateHeurePrevueEntretien='$dateHeurePrevueEntretien', DateHeureEffectiveEntretien='$dateHeureEffectiveEntretien', PonctualiteEntreprise='$ponctualiteEntreprise', Remuneration='$remuneration', PosteAborde='$poste', SuiviEntretien='$suivi' WHERE IDContact='$id'";
 
 if ($conn->query($sql) === TRUE) {
     echo "L'entretien a été modifié avec succès";
-    header("refresh:1; url=index.php");
+    header("Location: infoentretien.php?ID=" . $id);
 } else {
     echo "Erreur lors de la modification : " . $conn->error;
 }

+ 43 - 4
modifentretientel.php

@@ -3,8 +3,32 @@
     <title>Modifier un entretien téléphonique</title>
     <link href="custom.css" rel="stylesheet">
     <meta name="viewport" content="width=device-width">
+    <?php
+session_start();
+
+if (!isset($_SESSION['loggedin'])) {
+  header("Location: login.php");
+  exit;
+}
+?>
+
 </head>
 <?php
+include_once 'class/sqlconnect.php';
+try {
+    $conn = new PDO("mysql:host=$host;dbname=$dbname", $dbusername, $dbpassword);
+    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+    $stmt = $conn->prepare("SELECT ID FROM users WHERE username = :username");
+    $stmt->bindParam(':username', $_SESSION['username']);
+    $stmt->execute();
+
+    $result = $stmt->fetch(PDO::FETCH_ASSOC);
+    $idsession = $result['ID'];
+
+} catch (PDOException $e) {
+    echo "Error: " . $e->getMessage();
+}
+$conn = null;
 include('class/sqlconnect.php');
 $id = $_GET['ID'];
 $sql = "SELECT NomSociete FROM Entreprise JOIN Contact ON Entreprise.ID = Contact.IDEntreprise WHERE Contact.ID =$id";
@@ -13,9 +37,21 @@ if ($result) {
     $row = mysqli_fetch_assoc($result);
 }
 $conn->close();
+include('class/sqlconnect.php');
+$sql2 = "SELECT Prenom, Nom FROM Contact WHERE Contact.ID =$id";
+$result2 = mysqli_query($conn, $sql2);
+if ($result2) {
+    $row2 = mysqli_fetch_assoc($result2);
+$conn->close();
+}
 ?>
 <body>
-    <h1>Modifier un entretien téléphonique<br>Société <?php echo $row['NomSociete'] ?></h1>
+  <a href="index.php">Revenir à l'accueil</a><br><br>
+  <fieldset>
+    <legend><font size="6">Modifier un entretien téléphonique</font></legend>
+      <font size="5">Société <?php echo $row['NomSociete'] ?></font><br>
+      <font size="5">Votre interlocuteur(trice) : <?php echo $row2['Prenom'] . " " . $row2['Nom'] ?></font>
+  </fieldset><br>
 <?php
     include('class/sqlconnect.php');
     $id = $_GET['ID'];
@@ -23,7 +59,6 @@ $conn->close();
     $result = $conn->query($sql);
     $row = $result->fetch_assoc();
 ?>
-<a href="index.php">Revenir à l'accueil</a><br><br>
 <form action="modifentretientel.php" method="post">
   <table style='border:1px solid #000;'>
       <tr style='border:1px solid #000;'>
@@ -72,7 +107,8 @@ $conn->close();
           <label for="Suivi">Déroulement et suivi Entretien :</label>
         </td>
         <td style='border:1px solid #000;'>
-          <textarea id="Suivi" name="Suivi"><?php echo $row['SuiviEntretien']; ?></textarea>
+          <?php $row['SuiviEntretien'] = str_replace("\'", "'", $row['SuiviEntretien']); ?>
+          <textarea id="Suivi" name="Suivi" rows="20" cols="150"><?php echo $row['SuiviEntretien']; ?></textarea>
         </td>
       </tr>
     </table>
@@ -88,13 +124,16 @@ if (isset($_POST['submit'])) {
     $ponctualiteEntreprise = $_POST['PonctualiteEntreprise'];
     $remuneration = $_POST['Remuneration'];
     $poste = $_POST['Poste'];
+    $poste = str_replace("'", "\'", $poste);
     $suivi = $_POST['Suivi'];
+    $suivi = htmlentities($suivi);
+    $suivi = str_replace("'", "\'", $suivi);
 
 $sql = "UPDATE EntretienTelephonique SET DateHeurePrevueEntretien='$dateHeurePrevueEntretien', DateHeureEffectiveEntretien='$dateHeureEffectiveEntretien', PonctualiteEntreprise='$ponctualiteEntreprise', Remuneration='$remuneration', PosteAborde='$poste', SuiviEntretien='$suivi' WHERE IDContact='$id'";
 
 if ($conn->query($sql) === TRUE) {
     echo "L'entretien a été modifié avec succès";
-    header("refresh:1; url=index.php");
+    header("Location: infoentretien.php?ID=" . $id);
 } else {
     echo "Erreur lors de la modification : " . $conn->error;
 }

+ 101 - 0
modifprofil.php

@@ -0,0 +1,101 @@
+<html>
+<head>
+    <title>Modifier votre profil</title>
+    <link href="custom.css" rel="stylesheet">
+    <meta name="viewport" content="width=device-width">
+    <?php
+session_start();
+
+if (!isset($_SESSION['loggedin'])) {
+  header("Location: login.php");
+  exit;
+}
+?>
+</head>
+<body>
+    <h1>Modifier votre profil</h1>
+<?php
+include_once 'class/sqlconnect.php';
+
+try {
+    $conn = new PDO("mysql:host=$host;dbname=$dbname", $dbusername, $dbpassword);
+    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+    $stmt = $conn->prepare("SELECT first_name, last_name, profession, ID, password FROM users WHERE username = :username");
+    $stmt->bindParam(':username', $_SESSION['username']);
+    $stmt->execute();
+
+    $result = $stmt->fetch(PDO::FETCH_ASSOC);
+    $prenom = $result['first_name'];
+    $nom = $result['last_name'];
+    $profession = $result['profession'];
+    $idsession = $result['ID'];
+
+} catch (PDOException $e) {
+    echo "Error: " . $e->getMessage();
+}
+?>
+<a href="index.php">Revenir à l'accueil</a><br><br>
+<form action="modifprofil.php" method="post">
+  <table>
+    <tr>
+      <td>
+        <input type="hidden" name="ID" size="50" value="<?php echo $result['ID']; ?>">
+        <label>Prénom :</label>
+      </td>
+      <td>
+        <input type="text" name="first_name" size="50" value="<?php echo $result['first_name']; ?>">
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <label>Nom :</label>
+      </td>
+      <td>
+        <input type="text" name="last_name" size="50" value="<?php echo $result['last_name']; ?>">
+      </td>
+    <tr>
+      <td>
+        <label>Profession (renseigner un seul poste) :</label>
+      </td>
+      <td>
+        <input type="text" name="profession" size="50" value="<?php echo $result['profession']; ?>">
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <label for="password">Mot de passe<br>(seulement si vous souhaitez le modifier) :</label>
+      </td>
+      <td>
+        <input type="password" name="password" size="50" value="<?php echo $result['password']; ?>">
+      </td>
+    </tr>
+    </table>
+    <br>
+    <input type="submit" name="submit" value="Enregistrer les modifications">
+</form>
+
+<?php
+include_once 'class/sqlconnect.php';
+
+if ($conn->connect_error) {
+    die("La connexion à la base de données a échoué : " . $conn->connect_error);
+}
+
+if(isset($_POST['submit'])) {
+  $id = $_POST['ID'];
+  $prenom = $_POST['first_name'];
+  $nom = $_POST['last_name'];
+  $profession = $_POST['profession'];
+  $password = $_POST['password'];
+
+  $sql = "UPDATE users SET first_name='$prenom', last_name='$nom', profession='$profession', password='$password' WHERE ID='$id'";
+
+  if ($conn->query($sql) === TRUE) {
+      echo "Votre profil a été modifié avec succès";
+      header("refresh:1; url=index.php");
+  } else {
+      echo "Votre profil a été modifié avec succès";
+      header("refresh:1; url=index.php");
+  }
+}
+?>

+ 110 - 0
rechercheemploi.sql

@@ -0,0 +1,110 @@
+-- Adminer 4.7.7 MySQL dump
+
+SET NAMES utf8;
+SET time_zone = '+00:00';
+SET foreign_key_checks = 0;
+
+SET NAMES utf8mb4;
+
+DROP DATABASE IF EXISTS `prod_rechercheemploi`;
+CREATE DATABASE `prod_rechercheemploi` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */;
+USE `prod_rechercheemploi`;
+
+DROP TABLE IF EXISTS `Contact`;
+CREATE TABLE `Contact` (
+  `ID` int(3) NOT NULL AUTO_INCREMENT,
+  `IDEntreprise` int(5) DEFAULT NULL,
+  `Prenom` varchar(255) NOT NULL,
+  `Nom` varchar(255) NOT NULL,
+  `Poste` varchar(255) DEFAULT NULL,
+  `Mobile` varchar(255) DEFAULT NULL,
+  PRIMARY KEY (`ID`),
+  KEY `IDEntreprise` (`IDEntreprise`),
+  CONSTRAINT `Contact_ibfk_1` FOREIGN KEY (`IDEntreprise`) REFERENCES `Entreprise` (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+
+
+DROP TABLE IF EXISTS `Entreprise`;
+CREATE TABLE `Entreprise` (
+  `ID` int(5) NOT NULL AUTO_INCREMENT,
+  `NomSociete` varchar(255) NOT NULL,
+  `Contact` int(3) DEFAULT NULL,
+  `Adresse` varchar(255) DEFAULT NULL,
+  `NumeroTel` varchar(255) DEFAULT NULL,
+  `StatutEntretien` int(2) DEFAULT NULL,
+  PRIMARY KEY (`ID`),
+  KEY `Contact` (`Contact`),
+  CONSTRAINT `Entreprise_ibfk_1` FOREIGN KEY (`Contact`) REFERENCES `Contact` (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+
+DROP TABLE IF EXISTS `EntretienPresentiel`;
+CREATE TABLE `EntretienPresentiel` (
+  `IDEntretienP` int(3) NOT NULL AUTO_INCREMENT,
+  `IDEntreprise` int(5) NOT NULL,
+  `IDContact` int(3) NOT NULL,
+  `DateHeurePrevueEntretien` varchar(30) DEFAULT NULL,
+  `DateHeureEffectiveEntretien` varchar(30) DEFAULT NULL,
+  `PonctualiteEntreprise` binary(1) DEFAULT NULL,
+  `Remuneration` varchar(255) DEFAULT NULL,
+  `PosteAborde` varchar(255) DEFAULT NULL,
+  `SuiviEntretien` longtext DEFAULT NULL,
+  PRIMARY KEY (`IDEntretienP`),
+  UNIQUE KEY `IDEntreprise` (`IDEntreprise`),
+  UNIQUE KEY `IDContact` (`IDContact`),
+  CONSTRAINT `EntretienPresentiel_ibfk_1` FOREIGN KEY (`IDEntreprise`) REFERENCES `Entreprise` (`ID`),
+  CONSTRAINT `EntretienPresentiel_ibfk_2` FOREIGN KEY (`IDContact`) REFERENCES `Contact` (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+
+
+DROP TABLE IF EXISTS `EntretienTelephonique`;
+CREATE TABLE `EntretienTelephonique` (
+  `IDEntretienT` int(3) NOT NULL AUTO_INCREMENT,
+  `IDEntreprise` int(5) NOT NULL,
+  `IDContact` int(3) NOT NULL,
+  `DateHeurePrevueEntretien` varchar(30) DEFAULT NULL,
+  `DateHeureEffectiveEntretien` varchar(30) DEFAULT NULL,
+  `PonctualiteEntreprise` binary(1) DEFAULT NULL,
+  `Remuneration` varchar(255) DEFAULT NULL,
+  `PosteAborde` varchar(255) DEFAULT NULL,
+  `SuiviEntretien` longtext DEFAULT NULL,
+  PRIMARY KEY (`IDEntretienT`),
+  UNIQUE KEY `IDEntreprise` (`IDEntreprise`),
+  UNIQUE KEY `IDContact` (`IDContact`),
+  CONSTRAINT `EntretienTelephonique_ibfk_1` FOREIGN KEY (`IDEntreprise`) REFERENCES `Entreprise` (`ID`),
+  CONSTRAINT `EntretienTelephonique_ibfk_2` FOREIGN KEY (`IDContact`) REFERENCES `Contact` (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+
+
+DROP TABLE IF EXISTS `StatutEntretien`;
+CREATE TABLE `StatutEntretien` (
+  `ID` int(2) NOT NULL AUTO_INCREMENT,
+  `Statut` varchar(255) NOT NULL,
+  PRIMARY KEY (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+INSERT INTO `StatutEntretien` (`ID`, `Statut`) VALUES
+(1,	'OFFRE REFUSÉE'),
+(2,	'EN ATTENTE CRÉNEAU ENTRETIEN TÉLÉPHONIQUE'),
+(3,	'ENTRETIEN TÉLÉPHONIQUE PLANIFIÉ'),
+(4,	'ENTRETIEN TÉLÉPHONIQUE OK - ATTENTE ENTRETIEN PHYSIQUE'),
+(5,	'ENTRETIEN PHYSIQUE PLANIFIÉ'),
+(6,	'ENTRETIENS OK - EN ATTENTE RETOUR ENTREPRISE'),
+(7,	'EMBAUCHE VALIDÉE PAR ENTREPRISE'),
+(8,	'ENTRETIEN TÉLÉPHONIQUE NON CONVAINCANT'),
+(9,	'ENTRETIEN PHYSIQUE NON CONVAINCANT'),
+(10,	'REFUS ENTREPRISE');
+
+DROP TABLE IF EXISTS `users`;
+CREATE TABLE `users` (
+  `ID` int(4) NOT NULL AUTO_INCREMENT,
+  `first_name` varchar(255) NOT NULL,
+  `last_name` varchar(255) NOT NULL,
+  `username` varchar(255) NOT NULL,
+  `password` varchar(255) NOT NULL,
+  `profession` varchar(255) NOT NULL,
+  PRIMARY KEY (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+
+-- 2023-01-28 18:36:11

+ 92 - 0
register.php

@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Gestionnaire de recherche d'emploi - Inscription</title>
+    <link href="custom.css" rel="stylesheet">
+    <meta name="viewport" content="width=device-width">
+  </head>
+  <body>
+    <h1>Gestionnaire de recherche d'emploi - Inscription</h1>
+    <h2>C'est le moment où vous parlez de vous ! 🙂</h2>
+    <form action="register.php" method="post">
+    <table>
+      <tr style='border:0px;'>
+        <td style='border:0px;'>
+          <label for="first_name">&nbsp;Prénom :</label>
+        </td>
+        <td style='border:0px;'>
+          <input type="text" name="first_name" size="50" required>
+        </td>
+      </tr>
+      <tr style='border:0px;'>
+        <td style='border:0px;'>
+          <label for="last_name">&nbsp;Nom :</label>
+        </td>
+        <td style='border:0px;'>
+          <input type="text" name="last_name" size="50" required>
+        </td>
+      </tr>
+      <tr style='border:0px;'>
+        <td style='border:0px;'>
+          <label for="username">&nbsp;Nom d'utilisateur :</label>
+        </td>
+        <td style='border:0px;'>
+          <input type="text" name="username" size="50" required>
+        </td>
+      </tr>
+      <tr style='border:0px;'>
+        <td style='border:0px;'>
+          <label for="password">&nbsp;Mot de passe :</label>
+        </td>
+        <td style='border:0px;'>
+          <input type="password" name="password" size="50" required>
+        </td>
+      </tr>
+      <tr style='border:0px;'>
+        <td style='border:0px;'>
+          <label for="profession">&nbsp;Profession (un seul poste) :</label>
+        </td>
+        <td style='border:0px;'>
+          <input type="text" name="profession" size="50" required>
+        </td>
+      </tr>
+    </table><br>
+      <input type="submit" name="submit" value="S'inscrire">
+    </form>
+  </body>
+</html>
+<?php
+// Connexion à la base de données
+$host = "localhost";
+$dbusername = "prodrechercheemploi";
+$dbpassword = "j6uSgr49bpXC1PwRZKV8";
+$dbname = "prod_rechercheemploi";
+
+$conn = mysqli_connect($host, $dbusername, $dbpassword, $dbname);
+if (!$conn) {
+  die("Erreur de connexion à la base de données : " . mysqli_connect_error());
+}
+
+// Récupération des informations soumises par l'utilisateur
+if(isset($_POST['submit'])) {
+$first_name = $_POST['first_name'];
+$last_name = $_POST['last_name'];
+$username = $_POST['username'];
+$password = $_POST['password'];
+$profession = $_POST['profession'];
+$profession = htmlentities($profession);
+$profession = str_replace("/", "\/", $profession);
+
+// Requête d'insertion des informations dans la base de données
+$sql = "INSERT INTO users (first_name, last_name, username, password, profession)
+VALUES ('$first_name', '$last_name', '$username', '$password', '$profession')";
+
+if (mysqli_query($conn, $sql)) {
+  echo "Inscription réussie !";
+  header("refresh:1; url=index.php");
+} else {
+  echo "Erreur : " . $sql . "<br>" . mysqli_error($conn);
+}
+}
+mysqli_close($conn);
+?>

+ 36 - 0
verify.php

@@ -0,0 +1,36 @@
+<title>Inscription</title>
+<link href="custom.css" rel="stylesheet">
+<meta name="viewport" content="width=device-width">
+<?php
+session_start();
+
+// Connexion à la base de données
+$host = "localhost";
+$dbusername = "prodrechercheemploi";
+$dbpassword = "j6uSgr49bpXC1PwRZKV8";
+$dbname = "prod_rechercheemploi";
+
+$conn = mysqli_connect($host, $dbusername, $dbpassword, $dbname);
+if (!$conn) {
+  die("Erreur de connexion à la base de données : " . mysqli_connect_error());
+}
+
+// Récupération des identifiants soumis par l'utilisateur
+$username = $_POST['username'];
+$password = $_POST['password'];
+
+// Requête pour vérifier si les identifiants existent dans la base de données
+$sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";
+$result = mysqli_query($conn, $sql);
+
+// Si les identifiants sont valides, création d'une session utilisateur
+if (mysqli_num_rows($result) == 1) {
+  $_SESSION['loggedin'] = true;
+  $_SESSION['username'] = $username;
+  header("Location: index.php");
+} else {
+  echo "Nom d'utilisateur ou mot de passe incorrect. Veuillez réessayer.";
+}
+
+mysqli_close($conn);
+?>