mirror of
https://github.com/BreizhHardware/ProjetS4COMWEB.git
synced 2026-01-18 16:47:35 +01:00
first commit
This commit is contained in:
23
errorAuth.php
Normal file
23
errorAuth.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title> Oui....Stiti </title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"><link href="https://getbootstrap.com/docs/5.3/assets/css/docs.css" rel="stylesheet">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Just+Me+Again+Down+Here&family=Open+Sans&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="src/css/styles.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||
<link rel="icon" href="src/img/favicon.png" type="image/x-icon"/>
|
||||
</head>
|
||||
<body style="background-color: #EEF2F7">
|
||||
<div id="topbar">
|
||||
<p id="DoctISEN" class="w-100" style="position: fixed; top: 0px; left: 0px; font-size: 36px">
|
||||
Doct'ISEN
|
||||
</p>
|
||||
</div>
|
||||
<div class="text-center align-content-center">
|
||||
<h1>ERROR </h1>
|
||||
<h2>Veuillez vous connecter</h2>
|
||||
</div>
|
||||
1
figma.txt
Normal file
1
figma.txt
Normal file
@@ -0,0 +1 @@
|
||||
https://www.figma.com/file/MOlWocRUCAOJnN9WMvIMeC/Projet-PHP-S3?type=design&mode=design&t=6HFvmksSB7bUTQdA-1
|
||||
102
fill_db_project.py
Normal file
102
fill_db_project.py
Normal file
@@ -0,0 +1,102 @@
|
||||
from argon2 import PasswordHasher
|
||||
from datetime import date
|
||||
from random import randint
|
||||
from faker import Faker
|
||||
|
||||
def hash_password(password):
|
||||
ph = PasswordHasher()
|
||||
return ph.hash(password)
|
||||
|
||||
def all(file):
|
||||
with open(file, "w", encoding="utf-8") as projet:
|
||||
print("Starting")
|
||||
for i in range(1, 100):
|
||||
faker3 = Faker('fr_FR')
|
||||
adress3 = faker3.street_address()
|
||||
ville3 = faker3.city()
|
||||
postal3 = faker3.postcode()
|
||||
projet.write(f"INSERT INTO lieu (l_adress, l_city, l_postal) VALUES (")
|
||||
projet.write(f"'{adress3}', '{ville3}', '{postal3}');\n")
|
||||
print("Lieu generated")
|
||||
k = 1
|
||||
for l in range(1, 99):
|
||||
current_date = date.today().strftime("%Y-%m-%d")
|
||||
time = "08:00:00 +00:00"
|
||||
for i in range(1, 100):
|
||||
for j in range(1, 11):
|
||||
projet.write(f"INSERT INTO rendez_vous (rdv_date, rdv_time, l_id) VALUES (")
|
||||
projet.write(f"'{current_date}', '{time}',")
|
||||
projet.write(f"'{randint(1, 99)}');\n")
|
||||
time_parts = time.split(':')
|
||||
hours = int(time_parts[0])
|
||||
hours = (hours + 1) % 24
|
||||
time = f"{hours:02d}:{time_parts[1]}:{time_parts[2]}"
|
||||
k += 1
|
||||
current_date_parts = current_date.split('-')
|
||||
year = int(current_date_parts[0])
|
||||
month = int(current_date_parts[1])
|
||||
day = int(current_date_parts[2])
|
||||
if day == 28 and month == 2 and (year % 4 != 0 or (year % 100 == 0 and year % 400 != 0)):
|
||||
day = 1
|
||||
month += 1
|
||||
elif day == 29 and month == 2:
|
||||
day = 1
|
||||
month += 1
|
||||
elif day == 30 and (month == 4 or month == 6 or month == 9 or month == 11):
|
||||
day = 1
|
||||
month += 1
|
||||
elif day == 31:
|
||||
day = 1
|
||||
if month == 12:
|
||||
month = 1
|
||||
year += 1
|
||||
else:
|
||||
month += 1
|
||||
else:
|
||||
day += 1
|
||||
current_date = f"{year:04d}-{month:02d}-{day:02d}"
|
||||
time = "08:00:00 +00:00"
|
||||
spe = ["Généraliste", "Cardiologue", "Dermatologue", "Gynécologue", "Ophtalmologue", "ORL", "Pédiatre", "Pneumologue", "Psychiatre", "Rhumatologue", "Urologue", "Kinésitherpeute"]
|
||||
print("Rdv generated")
|
||||
for i in range(1, 1000):
|
||||
faker3 = Faker('fr_FR')
|
||||
name3 = faker3.first_name()
|
||||
surname3 = faker3.last_name()
|
||||
mail3 = faker3.email()
|
||||
phone3 = faker3.phone_number()
|
||||
phone3 = phone3.replace(" ", "")
|
||||
phone3 = phone3.replace(".", "")
|
||||
phone3 = phone3.replace("+33", "0")
|
||||
phone3 = phone3.replace("0(0)", "0")
|
||||
phone3 = phone3.replace("(0)", "0")
|
||||
postal3 = faker3.postcode()
|
||||
projet.write(f"INSERT INTO medecin (m_mail, m_name, m_surname, m_phone, m_password, m_postal, m_specialty) VALUES (")
|
||||
projet.write(f"'{mail3}', '{name3}', '{surname3}', '{phone3}', '{hash_password('a')}")
|
||||
projet.write(f"', '{postal3}'")
|
||||
projet.write(f", '{spe[randint(0, len(spe) - 1)]}');\n")
|
||||
print("Medecin generated")
|
||||
for i in range(1, 100):
|
||||
faker2 = Faker('fr_FR')
|
||||
name2 = faker2.first_name()
|
||||
surname2 = faker2.last_name()
|
||||
mail2 = faker2.email()
|
||||
phone2 = faker2.phone_number()
|
||||
phone2 = phone2.replace(" ", "")
|
||||
phone2 = phone2.replace(".", "")
|
||||
phone2 = phone2.replace("+33", "0")
|
||||
phone2 = phone2.replace("0(0)", "0")
|
||||
phone2 = phone2.replace("(0)", "0")
|
||||
projet.write(f"INSERT INTO patient (p_mail, p_name, p_surname, p_phone, p_password) VALUES (")
|
||||
projet.write(f"'{mail2}', '{name2}', '{surname2}', '{phone2}', '{hash_password('a')}');\n")
|
||||
print("Patient generated")
|
||||
for i in range(1, 97021):
|
||||
projet.write(f"INSERT INTO propose (rdv_id ,m_id) VALUES (")
|
||||
projet.write(f"{i}, {randint(1, 999)});\n")
|
||||
print("Propose generated")
|
||||
projet.close()
|
||||
print("Done")
|
||||
|
||||
print("Starting generation")
|
||||
all("projet.sql")
|
||||
print("Project generated")
|
||||
print("Passwords for all users are 'a'")
|
||||
77
forgotPassword-praticien.php
Normal file
77
forgotPassword-praticien.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title> Forgot Password </title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"><link href="https://getbootstrap.com/docs/5.3/assets/css/docs.css" rel="stylesheet">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Just+Me+Again+Down+Here&family=Open+Sans&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="src/css/styles.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||
<link rel="icon" href="src/img/favicon.png" type="image/x-icon"/>
|
||||
</head>
|
||||
<?php
|
||||
require('src/php/db/dbconnect.php');
|
||||
require('src/php/constants.php');
|
||||
require('src/php/db/ResetPassword.php');
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
$pdo = dbConnect();
|
||||
?>
|
||||
<body style="background-color: #EEF2F7">
|
||||
<div id="topbar">
|
||||
<a href="index.php">
|
||||
<p id="DoctISEN" class="top-0">
|
||||
Doct'ISEN
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="h-100 d-flex flex-column gap-0 justify-content-center text-center w-50 mx-6">
|
||||
<div class="p-3 m-0 border-0 bd-example m-0 border-0">
|
||||
<div class="loginInsideCard dropdown-menu">
|
||||
<h5 class="text-center fw-bold">J'ai oublié mon mot de passe praticien</h5>
|
||||
<form class="px-4 py-3" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
|
||||
<div>
|
||||
<div class="mb-3">
|
||||
<label for="exampleDropdownFormEmail1" class="form-label">Email address</label>
|
||||
<input type="email" class="form-control" id="exampleDropdownFormEmail1" placeholder="email@example.com" name="mail">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Nouveau mot de passe</label>
|
||||
<input type="password" class="form-control" id="password" placeholder="Password" name="password">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="passwordConfirmation" class="form-label">Confirmation du nouveau mot de passe</label>
|
||||
<input type="password" class="form-control" id="passwordConfirmation" placeholder="Password" name="passwordConfirmation">
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center justify-content-center">
|
||||
<button type="submit" class="btn btn-danger logButton">Réinitialiser le mot de passe</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
if(!empty($_POST['mail']) && !empty($_POST['password']) && !empty($_POST['passwordConfirmation'])){
|
||||
$mail = ($_POST["mail"]);
|
||||
$password = ($_POST["password"]);
|
||||
$passwordConfirmation = ($_POST["passwordConfirmation"]);
|
||||
if($password == $passwordConfirmation){
|
||||
if(ResetPraticien::Reset($pdo,$mail,$password)){
|
||||
error_log("Reset success");
|
||||
echo '<meta http-equiv="refresh" content="0;url=login-praticien.php">';
|
||||
} else {
|
||||
error_log("Reset failed");
|
||||
echo "<p class='text-center justify-content-center text-danger'>Erreur lors de la réinitialisation du mot de passe</p>";
|
||||
}
|
||||
} else {
|
||||
error_log("Reset failed");
|
||||
echo "<p class='text-center justify-content-center text-danger'>Les mots de passe ne correspondent pas</p>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
77
forgotPassword.php
Normal file
77
forgotPassword.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title> Forgot Password </title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"><link href="https://getbootstrap.com/docs/5.3/assets/css/docs.css" rel="stylesheet">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Just+Me+Again+Down+Here&family=Open+Sans&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="src/css/styles.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||
<link rel="icon" href="src/img/favicon.png" type="image/x-icon"/>
|
||||
</head>
|
||||
<?php
|
||||
require('src/php/db/dbconnect.php');
|
||||
require('src/php/constants.php');
|
||||
require('src/php/db/ResetPassword.php');
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
$pdo = dbConnect();
|
||||
?>
|
||||
<body style="background-color: #EEF2F7">
|
||||
<div id="topbar">
|
||||
<a href="index.php">
|
||||
<p id="DoctISEN" class="top-0">
|
||||
Doct'ISEN
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="h-100 d-flex flex-column gap-0 justify-content-center text-center w-50 mx-6">
|
||||
<div class="p-3 m-0 border-0 bd-example m-0 border-0">
|
||||
<div class="loginInsideCard dropdown-menu">
|
||||
<h5 class="text-center fw-bold">J'ai oublié mon mot de passe</h5>
|
||||
<form class="px-4 py-3" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
|
||||
<div>
|
||||
<div class="mb-3">
|
||||
<label for="exampleDropdownFormEmail1" class="form-label">Email address</label>
|
||||
<input type="email" class="form-control" id="exampleDropdownFormEmail1" placeholder="email@example.com" name="mail">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Nouveau mot de passe</label>
|
||||
<input type="password" class="form-control" id="password" placeholder="Password" name="password">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="passwordConfirmation" class="form-label">Confirmation du nouveau mot de passe</label>
|
||||
<input type="password" class="form-control" id="passwordConfirmation" placeholder="Password" name="passwordConfirmation">
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center justify-content-center">
|
||||
<button type="submit" class="btn btn-danger logButton" id="resetBtn">Réinitialiser le mot de passe</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
if(!empty($_POST['mail']) && !empty($_POST['password']) && !empty($_POST['passwordConfirmation'])){
|
||||
$mail = ($_POST["mail"]);
|
||||
$password = ($_POST["password"]);
|
||||
$passwordConfirmation = ($_POST["passwordConfirmation"]);
|
||||
if($password == $passwordConfirmation){
|
||||
if(ResetPatient::Reset($pdo,$mail,$password)){
|
||||
error_log("Reset success");
|
||||
echo '<meta http-equiv="refresh" content="0;url=login.php">';
|
||||
} else {
|
||||
error_log("Reset failed");
|
||||
echo "<p class='text-center justify-content-center text-danger'>Erreur lors de la réinitialisation du mot de passe</p>";
|
||||
}
|
||||
} else {
|
||||
error_log("Reset failed");
|
||||
echo "<p class='text-center justify-content-center text-danger'>Les mots de passe ne correspondent pas</p>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
81
index.php
Normal file
81
index.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title> Acceuil </title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Just+Me+Again+Down+Here&family=Open+Sans&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="src/css/styles.css">
|
||||
<script src="src/js/AJAX/utils.js" defer></script>
|
||||
<link rel="icon" href="src/img/favicon.png" type="image/x-icon"/>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
require('src/php/db/dbconnect.php');
|
||||
require('src/php/db/Patient.php');
|
||||
require('src/php/db/Medecin.php');
|
||||
require('src/php/constants.php');
|
||||
require('src/php/components/check.php');
|
||||
require('src/php/components/token.php');
|
||||
require('src/php/components/user-login.php');
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
session_start();
|
||||
$pdo = dbConnect();
|
||||
?>
|
||||
<div>
|
||||
<a href="index.php">
|
||||
<p id="DoctISEN" class="top-0">
|
||||
Doct'ISEN
|
||||
</p>
|
||||
</a>
|
||||
<div class="d-flex position-fixed end-0 flex-row align-items-center gap-3 mt-2 top-0">
|
||||
<?php
|
||||
loginUI($pdo);
|
||||
?>
|
||||
</div>
|
||||
<div id="rdv">
|
||||
<p class="text-white fw-bold fs-3">Trouvez un rendez vous avec un medecin</p>
|
||||
<form action="search.php" class="input-group" method="post">
|
||||
<input type="text" aria-label="First name" class="form-control" id="nom" name="nom" placeholder="Nom, spécialité">
|
||||
<input type="text" aria-label="Last name" class="form-control" id="postal" name="postal" placeholder="Où ?">
|
||||
<button class="btn btn-success" type="submit" id="button-addon2">Rechercher</button>
|
||||
</form>
|
||||
</div>
|
||||
<img src="src/img/img_index.png" alt="img_index" id="img_index">
|
||||
<div class="d-flex justify-content-center gap-5 w-100" id="cardPos">
|
||||
<div class="card" style="width: 18rem;">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Information</h5>
|
||||
<h6 class="card-subtitle mb-2 text-body-secondary">Ligue contre le cancer</h6>
|
||||
<p class="card-text">Mois sans tabac: c’est le moment d’arrêter !</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card" style="width: 18rem;">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Information</h5>
|
||||
<h6 class="card-subtitle mb-2 text-body-secondary">Pharmacie Sanchez</h6>
|
||||
<p class="card-text">Le rôle du phramacien évolue: Venez nous voir.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card" style="width: 18rem;">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Information</h5>
|
||||
<h6 class="card-subtitle mb-2 text-body-secondary">Doct’ISEN</h6>
|
||||
<p class="card-text">Un empechement: Prevenez votre soignant.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="fixed-bottom m-2 mx-4">
|
||||
<p>Recherche de praticiens</p>
|
||||
<p>Doct’ISEN, 33 QUATER Av. du Champ de Manœuvre, 44470 Carquefou</p>
|
||||
<p class="text-secondary">Conditions générales d'utilisation • Conditions d'utilisation du site Doct'ISEN • Politique relative à la protection des données personnelles • Politique en matière de cookies • Gestion des cookies et consentement • Règles de référencement • Mentions légales</p>
|
||||
<p class="text-secondary">Annuaire des médecins du CNOM • Annuaire des chirurgiens-dentistes de l'ONCD • Ordre National des Médecins • Ordre National des Chirurgiens-Dentistes</p>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||
</body>
|
||||
</html>
|
||||
81
login-praticien.php
Normal file
81
login-praticien.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title> Login </title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"><link href="https://getbootstrap.com/docs/5.3/assets/css/docs.css" rel="stylesheet">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Just+Me+Again+Down+Here&family=Open+Sans&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="src/css/styles.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||
<link rel="icon" href="src/img/favicon.png" type="image/x-icon"/>
|
||||
</head>
|
||||
<?php
|
||||
require('src/php/db/dbconnect.php');
|
||||
require('src/php/constants.php');
|
||||
require('src/php/db/Login.php');
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
$pdo = dbConnect();
|
||||
session_start();
|
||||
?>
|
||||
<body style="background-color: #EEF2F7">
|
||||
<div id="topbar">
|
||||
<a href="index.php">
|
||||
<p id="DoctISEN" class="top-0">
|
||||
Doct'ISEN
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="h-100 d-flex flex-column gap-0 justify-content-center text-center w-50 mx-6">
|
||||
<div class="p-3 m-0 border-0 bd-example m-0 border-0">
|
||||
<div class="loginInsideCard dropdown-menu">
|
||||
<h5 class="text-center fw-bold">J'ai déjà un compte praticen Doct'ISEN</h5>
|
||||
<form class="px-4 py-3" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
|
||||
<div>
|
||||
<div class="mb-3">
|
||||
<label for="exampleDropdownFormEmail1" class="form-label">Email address</label>
|
||||
<input type="email" class="form-control" id="exampleDropdownFormEmail1" placeholder="email@example.com" name="mail">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="exampleDropdownFormPassword1" class="form-label">Password</label>
|
||||
<input type="password" class="form-control" id="exampleDropdownFormPassword1" placeholder="Password" name="password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center justify-content-center">
|
||||
<button type="submit" class="btn btn-danger logButton">Se connecter</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="text-center justify-content-center">
|
||||
<a href="forgotPassword-praticien.php" class="text-center justify-content-center">
|
||||
<p class="text-center justify-content-center text-danger">Mot de passe oublié ?</p>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
if(!empty($_POST['mail']) && !empty($_POST['password'])){
|
||||
$login = LoginMedecin::Login($pdo,$_POST["mail"],$_POST["password"]);
|
||||
if($login != false){
|
||||
error_log("Login success");
|
||||
$_SESSION['token'] = base64_encode("medecin:".strval($login));
|
||||
echo '<meta http-equiv="refresh" content="0;url=rdv-praticien.php">';
|
||||
} else {
|
||||
error_log('Erreur de connexion');
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-3 m-0 border-0 bd-example m-0 border-0 text-center justify-content-center mt-5">
|
||||
<div class="dropdown-menu text-center align-content-center">
|
||||
<h5 class="fw-bold">Nouveau sur praticien Doct'ISEN?</h5>
|
||||
<a href="signup-praticien.php" class="">
|
||||
<button class="btn btn-danger logButton">S'inscrire</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
80
login.php
Normal file
80
login.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title> Login </title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"><link href="https://getbootstrap.com/docs/5.3/assets/css/docs.css" rel="stylesheet">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Just+Me+Again+Down+Here&family=Open+Sans&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="src/css/styles.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||
<link rel="icon" href="src/img/favicon.png" type="image/x-icon"/>
|
||||
</head>
|
||||
<?php
|
||||
require('src/php/db/dbconnect.php');
|
||||
require('src/php/constants.php');
|
||||
require('src/php/db/Login.php');
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
session_start();
|
||||
$pdo = dbConnect();
|
||||
?>
|
||||
<body style="background-color: #EEF2F7">
|
||||
<div id="topbar">
|
||||
<a href="index.php">
|
||||
<p id="DoctISEN" class="top-0">
|
||||
Doct'ISEN
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="h-100 d-flex flex-column gap-0 justify-content-center text-center w-50 mx-6">
|
||||
<div class="p-3 m-0 border-0 bd-example m-0 border-0">
|
||||
<div class="loginInsideCard dropdown-menu">
|
||||
<h5 class="text-center fw-bold">J'ai déjà un compte Doct'ISEN</h5>
|
||||
<form class="px-4 py-3" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
|
||||
<div>
|
||||
<div class="mb-3">
|
||||
<label for="exampleDropdownFormEmail1" class="form-label">Email address</label>
|
||||
<input type="email" class="form-control" id="exampleDropdownFormEmail1" placeholder="email@example.com" name="mail">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="exampleDropdownFormPassword1" class="form-label">Password</label>
|
||||
<input type="password" class="form-control" id="exampleDropdownFormPassword1" placeholder="Password" name="password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center justify-content-center">
|
||||
<button type="submit" class="btn btn-danger logButton">Se connecter</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="text-center justify-content-center">
|
||||
<a href="forgotPassword.php" class="text-center justify-content-center">
|
||||
<p class="text-center justify-content-center">Mot de passe oublié ?</p>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
if(!empty($_POST['mail']) && !empty($_POST['password'])){
|
||||
$login = LoginPatient::Login($pdo,$_POST["mail"],$_POST["password"]);
|
||||
if($login != false){
|
||||
error_log("Login success");
|
||||
$_SESSION['token'] = base64_encode("patient:".strval($login));
|
||||
echo '<meta http-equiv="refresh" content="0;url=index.php">';
|
||||
} else {
|
||||
error_log('Erreur de connexion');
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-3 m-0 border-0 bd-example m-0 border-0 text-center justify-content-center mt-5">
|
||||
<div class="dropdown-menu text-center align-content-center">
|
||||
<h5 class="fw-bold">Nouveau sur Doct'ISEN?</h5>
|
||||
<a href="signup.php" class="">
|
||||
<button class="btn btn-danger logButton">S'inscrire</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
presentation.pptx
Normal file
BIN
presentation.pptx
Normal file
Binary file not shown.
133
rdv-praticien.php
Normal file
133
rdv-praticien.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title> RDV </title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Just+Me+Again+Down+Here&family=Open+Sans&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="src/css/styles.css">
|
||||
<link rel="icon" href="src/img/favicon.png" type="image/x-icon"/>
|
||||
<?php
|
||||
require('src/php/db/dbconnect.php');
|
||||
require('src/php/constants.php');
|
||||
require('src/php/db/Login.php');
|
||||
require('src/php/components/check.php');
|
||||
require('src/php/components/token.php');
|
||||
require('src/php/components/user-login.php');
|
||||
require('src/php/db/Medecin.php');
|
||||
require('src/php/db/Patient.php');
|
||||
require('src/php/db/Rdv-praticien.php');
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
$pdo = dbConnect();
|
||||
session_start();
|
||||
checkMedecin();
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="topbar" class="d-flex justify-content-between flex-row">
|
||||
<div>
|
||||
<a href="index.php">
|
||||
<p id="DoctISEN" class="top-0">
|
||||
Doct'ISEN
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
<div class="d-flex flex-row align-items-center gap-3 me-2">
|
||||
<div class="d-flex flex-row align-items-center gap-3 me-2">
|
||||
<?php
|
||||
loginUI($pdo);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="h-100">
|
||||
<div class="d-flex flex-row flex-wrap my-5 mx-5 gap-5 justify-content-center text-center">
|
||||
|
||||
<?php try {
|
||||
$token = tokenDecode();
|
||||
$rdv = getAllNiche($pdo, $token[1]);
|
||||
if ($rdv != null && count($rdv) > 0){
|
||||
foreach ($rdv as $row) {
|
||||
$dateStr = $row["rdv_date"];
|
||||
$dateString = new DateTime($dateStr);
|
||||
$date = $dateString->format('d F Y');
|
||||
$uglyTime = $row["rdv_time"];
|
||||
$dateTime = new DateTime($uglyTime);
|
||||
$time = $dateTime->format('H:i');
|
||||
$patient = $row["patient"];
|
||||
$mail = $row["p_mail"];
|
||||
$phone = $row["p_phone"];
|
||||
if ($mail != null){
|
||||
echo '<div class="card rounded-4 mx-2 pointer">';
|
||||
echo '<div class="card-header bg-danger">';
|
||||
echo '<div class="d-flex flex-row justify-content-between text-white">';
|
||||
echo "<p>$date</p>";
|
||||
echo "<p>$time</p>";
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '<div class="card-body">';
|
||||
echo "<h5 class='card-title'>$patient</h5>";
|
||||
echo "<a href='mailto:" . $mail . "' class='card-subtitle mb-2 text-body-secondary'>$mail</a>";
|
||||
echo '<br>';
|
||||
echo "<a href='tel:" . "0" . $phone . "' class='card-subtitle mb-2 text-body-secondary'>$phone</a>";
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
} else {
|
||||
echo '<div class="card rounded-4 mx-2 pointer">';
|
||||
echo '<div class="card-header bg-danger">';
|
||||
echo '<div class="d-flex flex-row justify-content-between text-white">';
|
||||
echo "<p>$date</p>";
|
||||
echo "<p>$time</p>";
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '<div class="card-body">';
|
||||
echo "<h5 class='card-title'>Vous n'avez pas de" . "<br>" . "patient pour ce créneau</h5>";
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo 'error';
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
error_log('Database query error: ' . $e->getMessage());
|
||||
echo "Error fetching data from the database";
|
||||
} ?>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-row flex-wrap my-5 mx-5 gap-5 justify-content-center text-center">
|
||||
<?php
|
||||
$token = tokenDecode();
|
||||
$medID = $token[1];
|
||||
$lieux = getAllLieux($pdo);
|
||||
echo "<form action='src/php/db/scripts/createRDVToDB.php' method='post'>";
|
||||
echo "<input type='hidden' name='medID' value='$medID'>";
|
||||
echo "<input class='form-control' type='date' name='date'>";
|
||||
echo "<input class='form-control' type='time' name='time'>";
|
||||
echo "<select class='form-select' name='lieu' id='lieu'>";
|
||||
echo "<option value=''>Choisissez un lieu</option>";
|
||||
if ($lieux != null && count($lieux) > 0){
|
||||
foreach ($lieux as $row){
|
||||
$adress = $row["l_adress"];
|
||||
$postal = $row["l_postal"];
|
||||
$city = $row["l_city"];
|
||||
$lieu = $adress . ', ' . $postal . ', ' . $city;
|
||||
echo "<option value='$lieu'>$adress, $postal, $city</option>";
|
||||
}
|
||||
}
|
||||
echo "</select>";
|
||||
echo "<br><br>";
|
||||
echo "<button type='submit' name='createRDV' class='btn btn-danger'>Créer un rendez-vous</button>";
|
||||
echo "</form>";
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||
</body>
|
||||
</html>
|
||||
115
signup-praticien.php
Normal file
115
signup-praticien.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title> Connexion </title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"><link href="https://getbootstrap.com/docs/5.3/assets/css/docs.css" rel="stylesheet">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Just+Me+Again+Down+Here&family=Open+Sans&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="src/css/styles.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||
<script src="src/js/signup.js" defer></script>
|
||||
<link rel="icon" href="src/img/favicon.png" type="image/x-icon"/>
|
||||
</head>
|
||||
<?php
|
||||
require('src/php/db/dbconnect.php');
|
||||
require('src/php/constants.php');
|
||||
require('src/php/db/Signup.php');
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
$pdo = dbConnect();
|
||||
session_start();
|
||||
?>
|
||||
<body style="background-color: #EEF2F7">
|
||||
<div id="topbar">
|
||||
<a href="index.php">
|
||||
<p id="DoctISEN" class="top-0">
|
||||
Doct'ISEN
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="signInSecondaryCard p-3 border-0 bd-example text-center justify-content-center">
|
||||
<div class="dropdown-menu text-center align-content-center">
|
||||
<h5 class="fw-bold">J'ai déjà un compte praticien Doct'ISEN?</h5>
|
||||
<a href="login-praticien.php" class="">
|
||||
<button class="btn btn-danger logButton">Se connecter</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="SignInPrimaryCard p-3 border-0 bd-example border-0 text-center justify-content-center">
|
||||
<div class="loginInsideCard dropdown-menu">
|
||||
<h5 class="text-center fw-bold">Nouveau praticien sur Doct'ISEN ?</h5>
|
||||
<form class="px-4 py-3" method="post">
|
||||
<div class="align-content-center">
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label align-baseline">Nom</label>
|
||||
<input type="text" class="form-control" id="name" name="name" placeholder="Veuillez mettre votre nom">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="surname" class="form-label">Prénom</label>
|
||||
<input type="text" class="form-control" id="surname" name="surname" placeholder="Veuillez mettre votre prénom">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="phone" class="form-label">Numéro de téléphone</label>
|
||||
<input type="tel" pattern="[0-9]{10}" class="form-control" id="phone" name="phone" placeholder="Numéro de téléphone">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="mail" class="form-label">Email address</label>
|
||||
<input type="email" class="form-control" id="mail" name="mail" placeholder="email@example.com">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="mailConfirmation" class="form-label">Email address confirmation</label>
|
||||
<input type="email" class="form-control" id="mailConfirmation" name="mailConfirmation" placeholder="email@example.com">
|
||||
<p class="text-danger fw-bold" id="mail-error"></p>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Password</label>
|
||||
<input type="password" class="form-control" id="password" name="password" placeholder="Password">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="passwordConfirmation" class="form-label">Password Confirmation</label>
|
||||
<input type="password" class="form-control" id="passwordConfirmation" name="passwordConfirmation" placeholder="Password">
|
||||
<p class="text-danger fw-bold" id="password-error"></p>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="codePostal" class="form-label">Code Postal</label>
|
||||
<input type="text" pattern="[0-9]{5}" class="form-control" id="codePostal" name="codePostal" placeholder="Code Postal">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="specialite" class="form-label">Spécialité</label>
|
||||
<input type="text" class="form-control" id="specialite" name="specialite" placeholder="Spécialité">
|
||||
</div>
|
||||
<div class="align-content-center text-center ">
|
||||
<button type="submit" class="btn btn-danger logButton disabled" id="signupButton">Se connecter</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
if(!empty($_POST['mail']) && !empty($_POST['password']) && !empty($_POST['name']) && !empty($_POST['surname']) && !empty($_POST['phone']) && !empty($_POST['password']) && !empty($_POST['passwordConfirmation']) && !empty($_POST['mailConfirmation']) && !empty($_POST['codePostal']) && !empty($_POST['specialite'])){
|
||||
$mail = ($_POST["mail"]);
|
||||
$password = ($_POST["password"]);
|
||||
$name = ($_POST["name"]);
|
||||
$surname = ($_POST["surname"]);
|
||||
$phone = ($_POST["phone"]);
|
||||
$codePostal = ($_POST["codePostal"]);
|
||||
$specialite = ($_POST["specialite"]);
|
||||
if(SignupMedecin::insertMedecin($pdo,$name,$surname,$mail, $password,$specialite,$phone,$codePostal)){
|
||||
error_log("Signup success");
|
||||
$_SESSION['id'] = $mail;
|
||||
echo '<meta http-equiv="refresh" content="0;url=index.php">';
|
||||
} else {
|
||||
error_log("Erreur d'inscription");
|
||||
}
|
||||
}
|
||||
else{
|
||||
error_log("Un champ n'est pas rempli");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
105
signup.php
Normal file
105
signup.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title> Connexion </title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"><link href="https://getbootstrap.com/docs/5.3/assets/css/docs.css" rel="stylesheet">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Just+Me+Again+Down+Here&family=Open+Sans&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="src/css/styles.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||
<script src="src/js/signup.js" defer></script>
|
||||
<link rel="icon" href="src/img/favicon.png" type="image/x-icon"/>
|
||||
</head>
|
||||
<?php
|
||||
require('src/php/db/dbconnect.php');
|
||||
require('src/php/constants.php');
|
||||
require('src/php/db/Signup.php');
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
$pdo = dbConnect();
|
||||
session_start();
|
||||
?>
|
||||
<body style="background-color: #EEF2F7">
|
||||
<div id="topbar">
|
||||
<a href="index.php">
|
||||
<p id="DoctISEN" class="top-0">
|
||||
Doct'ISEN
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="signInSecondaryCard p-3 m-0 border-0 bd-example m-0 border-0 text-center justify-content-center mt-5">
|
||||
<div class="dropdown-menu text-center align-content-center">
|
||||
<h5 class="fw-bold">J'ai déjà un compte Doct'ISEN?</h5>
|
||||
<a href="login.php" class="">
|
||||
<button class="btn btn-danger logButton">Se connecter</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="SignInPrimaryCard p-3 m-0 border-0 bd-example m-0 border-0 text-center justify-content-center">
|
||||
<div class="loginInsideCard dropdown-menu">
|
||||
<h5 class="text-center fw-bold">Nouveau sur Doct'ISEN ?</h5>
|
||||
<form class="px-4 py-3" method="post">
|
||||
<div class="align-content-center">
|
||||
<div class="mb-3">
|
||||
<label for="Name" class="form-label align-baseline">Nom</label>
|
||||
<input type="text" class="form-control" id="Name" name="name" placeholder="Veuillez mettre votre nom">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="FirstName" class="form-label">Prénom</label>
|
||||
<input type="text" class="form-control" id="FirstName" name="surname" placeholder="Veuillez mettre votre prénom">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="Num" class="form-label">Numéro de téléphone</label>
|
||||
<input type="tel" pattern="[0-9]{10}" class="form-control" id="Num" name="phone" placeholder="Numéro de téléphone">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="mail" class="form-label">Email address</label>
|
||||
<input type="email" class="form-control" id="mail" name="mail" placeholder="email@example.com">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="mailConfirmation" class="form-label">Email address confirmation</label>
|
||||
<input type="email" class="form-control" id="mailConfirmation" name="mailConfirmation" placeholder="email@example.com">
|
||||
<p class="text-danger fw-bold" id="mail-error"></p>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Password</label>
|
||||
<input type="password" class="form-control" id="password" name="password" placeholder="Password">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="passwordConfirmation" class="form-label">Password Confirmation</label>
|
||||
<input type="password" class="form-control" id="passwordConfirmation" name="passwordConfirmation" placeholder="Password">
|
||||
<p class="text-danger fw-bold" id="password-error"></p>
|
||||
</div>
|
||||
<div class="align-content-center text-center ">
|
||||
<button type="submit" class="btn btn-danger logButton disabled" id="signupButton">Se connecter</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
if(!empty($_POST['mail']) && !empty($_POST['password']) && !empty($_POST['name']) && !empty($_POST['surname']) && !empty($_POST['phone']) && !empty($_POST['password']) && !empty($_POST['passwordConfirmation']) && !empty($_POST['mailConfirmation'])){
|
||||
$mail = ($_POST["mail"]);
|
||||
$password = ($_POST["password"]);
|
||||
$name = ($_POST["name"]);
|
||||
$surname = ($_POST["surname"]);
|
||||
$phone = ($_POST["phone"]);
|
||||
if(SignupPatient::Insert($pdo,$name,$surname,$mail,$password,$phone)){
|
||||
error_log("Signup success");
|
||||
$_SESSION['id'] = $mail;
|
||||
echo '<meta http-equiv="refresh" content="0;url=index.php">';
|
||||
} else {
|
||||
error_log('Erreur de connexion');
|
||||
}
|
||||
}
|
||||
else{
|
||||
error_log('Erreur de connexion');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
117
src/css/styles.css
Normal file
117
src/css/styles.css
Normal file
@@ -0,0 +1,117 @@
|
||||
#DoctISEN{
|
||||
font-family: 'Just Me Again Down Here', cursive;
|
||||
color: white;
|
||||
font-size: 36px
|
||||
}
|
||||
|
||||
#topbar{
|
||||
background-color: #ff0000;
|
||||
height: 6vh;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#acceuil{
|
||||
background-color: #ff0000;
|
||||
height: 50vh;
|
||||
}
|
||||
|
||||
.text-red-700{
|
||||
color: #842029;
|
||||
}
|
||||
|
||||
#rdv{
|
||||
position: fixed;
|
||||
top: 15%;
|
||||
left: 15%;
|
||||
}
|
||||
|
||||
#img_index{
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 6vh;
|
||||
}
|
||||
|
||||
#cardPos{
|
||||
position: fixed;
|
||||
top: 48vh;
|
||||
}
|
||||
|
||||
.loginPrimaryCard{
|
||||
position: fixed;
|
||||
top: 15%;
|
||||
left: 30%;
|
||||
width: 40%;
|
||||
height: 70%;
|
||||
}
|
||||
|
||||
.loginSecondaryCard{
|
||||
position: fixed;
|
||||
top: 45%;
|
||||
left: 30%;
|
||||
width: 40%;
|
||||
height: 70%;
|
||||
}
|
||||
|
||||
.loginInsideCard{
|
||||
padding-left: 15%;
|
||||
padding-right: 15%;
|
||||
padding-top: 5%;
|
||||
}
|
||||
|
||||
.logButton{
|
||||
width: 30%;
|
||||
height: 100%;
|
||||
background-color: #ff0000;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.pointer{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.signInSecondaryCard{
|
||||
left: 30%;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
.SignInPrimaryCard{
|
||||
left: 30%;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
#searchbar{
|
||||
background-color: #ff0000;
|
||||
}
|
||||
|
||||
.gap-6 {
|
||||
gap: 22rem !important;
|
||||
}
|
||||
|
||||
.ms-6{
|
||||
margin-left: 6rem !important;
|
||||
}
|
||||
|
||||
.mx-6{
|
||||
margin-left: 24rem !important;
|
||||
margin-right: 24rem !important;
|
||||
}
|
||||
|
||||
.thumbnail{
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.cardImg{
|
||||
width: 17%;
|
||||
}
|
||||
|
||||
a{
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover{
|
||||
text-decoration: underline;
|
||||
}
|
||||
BIN
src/img/favicon.png
Normal file
BIN
src/img/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
BIN
src/img/img_index.png
Normal file
BIN
src/img/img_index.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 124 KiB |
5
src/js/AJAX/rdv-praticien.js
Normal file
5
src/js/AJAX/rdv-praticien.js
Normal file
@@ -0,0 +1,5 @@
|
||||
getRDV();
|
||||
|
||||
function getRDV() {
|
||||
ajaxRequest("GET", "/rdv", null, function(response) {
|
||||
}
|
||||
25
src/js/AJAX/utils.js
Normal file
25
src/js/AJAX/utils.js
Normal file
@@ -0,0 +1,25 @@
|
||||
console.log("utils.js loaded");
|
||||
|
||||
function ajaxRequest(type, url, data, callback){
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open(type, url, true);
|
||||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
xhr.setRequestHeader("Content-Type", "application/json");
|
||||
xhr.onload = function() {
|
||||
switch (xhr.status) {
|
||||
case 200:
|
||||
callback(JSON.parse(xhr.responseText));
|
||||
break;
|
||||
case 404:
|
||||
alert("404");
|
||||
break;
|
||||
case 403:
|
||||
alert("403");
|
||||
break;
|
||||
case 500:
|
||||
console.log("server error");
|
||||
break;
|
||||
}
|
||||
};
|
||||
xhr.send(data);
|
||||
}
|
||||
43
src/js/signup.js
Normal file
43
src/js/signup.js
Normal file
@@ -0,0 +1,43 @@
|
||||
function checkMailMatch(mailContainer, mailConfirmContainer, signupButton) {
|
||||
if (mailContainer.value !== mailConfirmContainer.value) {
|
||||
signupButton.classList.add("disabled");
|
||||
document.getElementById("mail-error").innerHTML = "Emails don't match";
|
||||
} else {
|
||||
signupButton.classList.remove("disabled");
|
||||
document.getElementById("mail-error").innerHTML = "";
|
||||
}
|
||||
}
|
||||
|
||||
function checkPasswordMatch(passwordContainer, passwordConfirmContainer, signupButton) {
|
||||
if (passwordContainer.value !== passwordConfirmContainer.value) {
|
||||
signupButton.classList.add("disabled");
|
||||
document.getElementById("password-error").innerHTML = "Passwords don't match";
|
||||
} else {
|
||||
signupButton.classList.remove("disabled");
|
||||
document.getElementById("password-error").innerHTML = "";
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const mailContainer = document.getElementById("mail");
|
||||
const mailConfirmContainer = document.getElementById("mailConfirmation");
|
||||
const passwordContainer = document.getElementById("password");
|
||||
const passwordConfirmContainer = document.getElementById("passwordConfirmation");
|
||||
const signupButton = document.getElementById("signupButton");
|
||||
|
||||
mailContainer.addEventListener("keyup", function() {
|
||||
checkMailMatch(mailContainer, mailConfirmContainer, signupButton);
|
||||
});
|
||||
|
||||
mailConfirmContainer.addEventListener("keyup", function() {
|
||||
checkMailMatch(mailContainer, mailConfirmContainer, signupButton);
|
||||
});
|
||||
|
||||
passwordContainer.addEventListener("keyup", function() {
|
||||
checkPasswordMatch(passwordContainer, passwordConfirmContainer, signupButton);
|
||||
});
|
||||
|
||||
passwordConfirmContainer.addEventListener("keyup", function() {
|
||||
checkPasswordMatch(passwordContainer, passwordConfirmContainer, signupButton);
|
||||
});
|
||||
});
|
||||
50
src/php/components/check.php
Normal file
50
src/php/components/check.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
function checklogin(){
|
||||
if(isset($_SESSION['token'])){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function checkMedecin(){
|
||||
if(isset($_SESSION['token'])){
|
||||
$token = tokenDecode();
|
||||
if($token[0] == "medecin"){
|
||||
return true;
|
||||
} else {
|
||||
if($token[0] == "patient"){
|
||||
echo '<meta http-equiv="refresh" content="0;url=index.php">';
|
||||
return false;
|
||||
} else {
|
||||
echo '<meta http-equiv="refresh" content="0;url=login-praticien.php">';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo '<meta http-equiv="refresh" content="0;url=index.php">';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function checkPatient(){
|
||||
if(isset($_SESSION['token'])){
|
||||
$token = tokenDecode();
|
||||
if($token[0] == "patient"){
|
||||
return true;
|
||||
} else {
|
||||
if($token[0] == "medecin"){
|
||||
echo '<meta http-equiv="refresh" content="0;url=index.php">';
|
||||
return false;
|
||||
} else {
|
||||
echo '<meta http-equiv="refresh" content="0;url=login.php">';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo '<meta http-equiv="refresh" content="0;url=index.php">';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
7
src/php/components/token.php
Normal file
7
src/php/components/token.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
function tokenDecode(){
|
||||
$token = base64_decode($_SESSION['token']);
|
||||
$token = explode(":",$token);
|
||||
return $token;
|
||||
};
|
||||
?>
|
||||
30
src/php/components/user-login.php
Normal file
30
src/php/components/user-login.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
function loginUI($pdo){
|
||||
if (checklogin()){
|
||||
$token = tokenDecode();
|
||||
if ($token[0] == "patient" ){
|
||||
$user = Patient::getPatientFromId($pdo, $token[1]);
|
||||
$mail = $user['p_mail'];
|
||||
$surname = $user['p_surname'];
|
||||
$name = $user['p_name'];
|
||||
} else {
|
||||
$user = Medecin::getMedecinFromId($pdo, $token[1]);
|
||||
$mail = $user['m_mail'];
|
||||
$surname = $user['m_surname'];
|
||||
$name = $user['m_name'];
|
||||
}
|
||||
echo '<div class="d-flex flex-row align-items-center gap-3 me-2">
|
||||
<img src="https://www.gravatar.com/avatar/' . md5($mail) . '?s=64" alt="avatar" id="avatar" style="width: 14.3%; height: auto; border-radius: 50%">
|
||||
<div>
|
||||
<a href="src/php/db/scripts/deconnexion.php" class="text-white fw-bold mt-3 link-underline-opacity-75-hover link-underline link-underline-opacity-0 link-offset-3-hover link-underline-light">'.$surname." ".$name.'</a>
|
||||
</div>';
|
||||
if($token[0] == "patient"){
|
||||
echo '<a href="rdv.php" class="text-white fw-bold link-underline-opacity-75-hover link-underline link-underline-opacity-0 link-offset-3-hover link-underline-light">Mes rendez-vous</a></div>';
|
||||
} else {
|
||||
echo '<a href="rdv-praticien.php" class="text-white fw-bold link-underline-opacity-75-hover link-underline link-underline-opacity-0 link-offset-3-hover link-underline-light">Mon calendrier</a></div>';
|
||||
}
|
||||
} else {
|
||||
echo '<a href="login-praticien.php"> <button type="button" class="btn btn-danger" style="top: 0.4375em;">Vous êtes praticien ?</button> </a><a href="login.php"> <button type="button" class="btn btn-danger" style="top: 0.4375em;">Se connecter</button></a><p> </p>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
7
src/php/constants.php
Normal file
7
src/php/constants.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
const DB_USER = 'postgres';
|
||||
const DB_PASSWORD = 'a';
|
||||
const DB_NAME = 'daesh';
|
||||
const DB_SERVER = "192.168.21.187";
|
||||
const DB_PORT = '5432';
|
||||
?>
|
||||
82
src/php/db/Calendrier.php
Normal file
82
src/php/db/Calendrier.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
function selectRDVTimeByID($pdo, $id){
|
||||
$query = $pdo->prepare("SELECT * FROM rendez_vous WHERE rdv_id = :id");
|
||||
$query->bindParam(':id', $id);
|
||||
$query->execute();
|
||||
$result = $query->fetchAll();
|
||||
|
||||
if (!empty($result)) {
|
||||
return $result[0]['rdv_time'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function selectRDVForDate($pdo, $date, $medecin){
|
||||
$availableHours = array();
|
||||
$query = $pdo->prepare("select * from rendez_vous rdv join public.propose p using (rdv_id) where p.m_id = :m_id and rdv.rdv_date = :date AND rdv.p_id IS NULL ORDER BY rdv_time ASC");
|
||||
$query->bindParam(':date', $date);
|
||||
$query->bindParam(':m_id', $medecin);
|
||||
$query->execute();
|
||||
$outerResult = $query->fetchAll();
|
||||
foreach ($outerResult as $row) {
|
||||
array_push($availableHours, $row['rdv_id']);
|
||||
}
|
||||
return $availableHours;
|
||||
}
|
||||
|
||||
function displayRDVForDate($pdo, $date, $medecin){
|
||||
$availableHours = selectRDVForDate($pdo, $date, $medecin);
|
||||
if(!$availableHours){
|
||||
echo '<p class="ms-5 mt-2 fw-bold">Aucun rendez-vous disponible</p>';
|
||||
}
|
||||
else{
|
||||
echo '<p class="ms-5 mt-2 fw-bold">Rendez-vous disponible :</p>';
|
||||
foreach ($availableHours as $hour){
|
||||
$hourValue = selectRDVTimeByID($pdo, $hour);
|
||||
$hourValue = substr($hourValue, 0, 5);
|
||||
$token = tokenDecode();
|
||||
$patient = $token[1];
|
||||
echo '<a href="./src/php/db/scripts/addRDVToDB.php?id='.$hour.'&patient='.$patient.'" class="btn btn-danger w-100">'.$hourValue.'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function DisplayMedecinCard($pdo, $medecin){
|
||||
$query = $pdo->prepare("SELECT * FROM medecin WHERE m_id = :id");
|
||||
$query->bindParam(':id', $medecin);
|
||||
$query->execute();
|
||||
$result = $query->fetchAll();
|
||||
foreach ($result as $row){
|
||||
echo '<div class="card mb-3">';
|
||||
echo '<div class="row g-0">';
|
||||
echo '<div class="col-md-4">';
|
||||
$imageUrl = 'https://thispersondoesnotexist.com';
|
||||
echo '<img src="' . $imageUrl . '" alt="doctor" class="img-fluid rounded-start" width="300" height="300">';
|
||||
echo '</div>';
|
||||
echo '<div class="col-md-8">';
|
||||
echo '<div class="card-body">';
|
||||
echo '<h5 class="card-title">'.$row['m_name'].' '.$row['m_surname'].'</h5>';
|
||||
echo '<h6 class="card-subtitle mb-2 text-body-secondary">'.$row['m_specialty'].'</h6>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
function addRDVToDBThenRedirect($pdo, $rdv, $patient){
|
||||
$query = $pdo->prepare("UPDATE rendez_vous SET p_id = :p_id WHERE rdv_id = :rdv_id");
|
||||
$query->bindParam(':p_id', $patient);
|
||||
$query->bindParam(':rdv_id', $rdv);
|
||||
$query->execute();
|
||||
//Redirect to the rdv.php page
|
||||
echo '<meta http-equiv="refresh" content="0;URL=../../../rdv.php">';
|
||||
}
|
||||
|
||||
?>
|
||||
80
src/php/db/Login.php
Normal file
80
src/php/db/Login.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
class LoginPatient {
|
||||
|
||||
public static function checkMail($pdo, $mail) {
|
||||
$query = $pdo->prepare("SELECT COUNT(*) as count FROM patient WHERE p_mail = :mail");
|
||||
$query->bindParam(':mail', $mail);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($result['count'] == 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static function Login($pdo,$mail,$password) {
|
||||
|
||||
if(LoginPatient::checkMail($pdo,$mail)){
|
||||
$query = $pdo->prepare("SELECT p_id,p_password FROM patient where p_mail = :mail");
|
||||
$query->bindParam(':mail', $mail);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if(password_verify($password,$result['p_password'])){
|
||||
echo "Login success";
|
||||
return $result['p_id'];
|
||||
} else {
|
||||
echo "Login failed";
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Mail not found";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class LoginMedecin {
|
||||
|
||||
|
||||
public static function checkMail($pdo, $mail) {
|
||||
$query = $pdo->prepare("SELECT COUNT(*) as count FROM medecin WHERE m_mail = :mail");
|
||||
$query->bindParam(':mail', $mail);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($result['count'] == 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static function Login($pdo,$mail,$password) {
|
||||
|
||||
if(LoginMedecin::checkMail($pdo,$mail)){
|
||||
$query = $pdo->prepare("SELECT m_id, m_password FROM medecin where m_mail = :mail");
|
||||
$query->bindParam(':mail', $mail);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if(password_verify($password,$result['m_password'])){
|
||||
echo "Login success";
|
||||
return $result['m_id'];
|
||||
} else {
|
||||
echo "Login failed";
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Mail not found";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
46
src/php/db/Medecin.php
Normal file
46
src/php/db/Medecin.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
class Medecin
|
||||
{
|
||||
public static function getMedecinFromId($pdo,$id) {
|
||||
$query = $pdo->prepare("SELECT * FROM medecin WHERE m_id = :id");
|
||||
$query->bindParam(':id', $id);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getMedecin($pdo,$mail) {
|
||||
$query = $pdo->prepare("SELECT * FROM medecin WHERE m_mail = :mail");
|
||||
$query->bindParam(':mail', $mail);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getMedecinByNom($pdo,$nom) {
|
||||
$query = $pdo->prepare("SELECT * FROM medecin WHERE m_name = :nom");
|
||||
$query->bindParam(':nom', $nom);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getMedecinBySpecialite($pdo,$specialite) {
|
||||
$query = $pdo->prepare("SELECT * FROM medecin WHERE m_specialty = :specialite");
|
||||
$query->bindParam(':specialite', $specialite);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getMedecinByNameAndSpecialite($pdo,$nom,$specialite) {
|
||||
$query = $pdo->prepare("SELECT * FROM medecin WHERE m_name = :nom AND m_specialty = :specialite");
|
||||
$query->bindParam(':nom', $nom);
|
||||
$query->bindParam(':specialite', $specialite);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
31
src/php/db/Patient.php
Normal file
31
src/php/db/Patient.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
class Patient {
|
||||
public static function getPatientFromId($pdo,$id) {
|
||||
$query = $pdo->prepare("SELECT * FROM patient WHERE p_id = :id");
|
||||
$query->bindParam(':id', $id);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getPatient($pdo,$mail) {
|
||||
$query = $pdo->prepare("SELECT * FROM patient WHERE p_mail = :mail");
|
||||
$query->bindParam(':mail', $mail);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function GetRDV($pdo,$mail){
|
||||
$query = $pdo->prepare("SELECT * FROM rendez_vous WHERE p_mail = :mail");
|
||||
$query->bindParam(':mail', $mail);
|
||||
$query->execute();
|
||||
$result = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
53
src/php/db/Rdv-praticien.php
Normal file
53
src/php/db/Rdv-praticien.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
function getAllNiche($pdo, $id){
|
||||
$statement = $pdo->prepare("SELECT rdv_date, rdv_time, concat(p_name,' ', p_surname) as patient, p_mail, p_phone
|
||||
FROM rendez_vous
|
||||
LEFT JOIN patient ON rendez_vous.p_id = patient.p_id
|
||||
INNER JOIN propose ON rendez_vous.rdv_id = propose.rdv_id
|
||||
INNER JOIN medecin ON propose.m_id = medecin.m_id
|
||||
INNER JOIN lieu ON lieu.l_id = rendez_vous.l_id
|
||||
|
||||
WHERE CURRENT_DATE = rdv_date AND medecin.m_id = :id
|
||||
ORDER BY rdv_date, rdv_time ASC");
|
||||
|
||||
$statement->bindParam(':id', $id);
|
||||
$statement->execute();
|
||||
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!empty($result)) {
|
||||
return $result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getLieuID($pdo, $adress, $postal, $city){
|
||||
$statement = $pdo->prepare("SELECT l_id FROM lieu WHERE l_adress = :adress AND l_city = :city AND l_postal = :postal");
|
||||
$statement->bindParam(':adress', $adress);
|
||||
$statement->bindParam(':city', $city);
|
||||
$statement->bindParam(':postal', $postal);
|
||||
$statement->execute();
|
||||
$result = $statement->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!empty($result)) {
|
||||
return $result['l_id'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function getAllLieux($pdo){
|
||||
$statement = $pdo->prepare("SELECT l_adress, l_city, l_postal FROM lieu");
|
||||
$statement->execute();
|
||||
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!empty($result)) {
|
||||
return $result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
72
src/php/db/Rdv.php
Normal file
72
src/php/db/Rdv.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
function getRdvByPatient($pdo, $id){
|
||||
$statement = $pdo->prepare("SELECT rdv_date, rdv_time, concat(m_name, ' ', m_surname) as medecin, medecin.m_specialty, medecin.m_id, concat(p_name, ' ', p_surname) as patient, l_adress as adresse, concat(l_postal, ' ', l_city) as ville
|
||||
FROM rendez_vous
|
||||
INNER JOIN patient ON rendez_vous.p_id = patient.p_id
|
||||
INNER JOIN propose ON rendez_vous.rdv_id = propose.rdv_id
|
||||
INNER JOIN medecin ON propose.m_id = medecin.m_id
|
||||
INNER JOIN lieu on lieu.l_id = rendez_vous.l_id
|
||||
|
||||
WHERE NOW() <= (rdv_date + rdv_time) AND patient.p_id = :id
|
||||
ORDER BY rdv_date, rdv_time ASC");
|
||||
$statement->bindParam(':id', $id);
|
||||
$statement->execute();
|
||||
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!empty($result)) {
|
||||
return $result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function getPastRdvByPatient($pdo, $id){
|
||||
$statement = $pdo->prepare("SELECT rdv_date, rdv_time, concat(m_name, ' ', m_surname) as medecin, medecin.m_specialty, medecin.m_id, concat(p_name, ' ', p_surname) as patient, l_adress as adresse, concat(l_postal, ' ', l_city) as ville
|
||||
FROM rendez_vous
|
||||
INNER JOIN patient ON rendez_vous.p_id = patient.p_id
|
||||
INNER JOIN propose ON rendez_vous.rdv_id = propose.rdv_id
|
||||
INNER JOIN medecin ON propose.m_id = medecin.m_id
|
||||
INNER JOIN lieu on lieu.l_id = rendez_vous.l_id
|
||||
|
||||
WHERE NOW() > (rdv_date + rdv_time) AND patient.p_id = :id
|
||||
ORDER BY rdv_date, rdv_time ASC");
|
||||
$statement->bindParam(':id', $id);
|
||||
$statement->execute();
|
||||
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!empty($result)) {
|
||||
return $result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function getNextRdvByPatient($pdo, $id){
|
||||
$statement = $pdo->prepare("SELECT rdv_date, rdv_time, rendez_vous.rdv_id, concat(m_name, ' ', m_surname) as medecin, medecin.m_specialty, medecin.m_id, concat(p_name, ' ', p_surname) as patient, l_adress as adresse, concat(l_postal, ' ', l_city) as ville
|
||||
FROM rendez_vous
|
||||
INNER JOIN patient ON rendez_vous.p_id = patient.p_id
|
||||
INNER JOIN propose ON rendez_vous.rdv_id = propose.rdv_id
|
||||
INNER JOIN medecin ON propose.m_id = medecin.m_id
|
||||
INNER JOIN lieu on lieu.l_id = rendez_vous.l_id
|
||||
|
||||
WHERE NOW() <= (rdv_date + rdv_time) AND patient.p_id = :id
|
||||
ORDER BY rdv_date, rdv_time ASC");
|
||||
$statement->bindParam(':id', $id);
|
||||
$statement->execute();
|
||||
$result = $statement->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!empty($result)) {
|
||||
return $result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function CancelRDV($pdo, $id){
|
||||
$statement = $pdo->prepare("DELETE FROM propose WHERE rdv_id = :id");
|
||||
$statement->bindParam(':id', $id);
|
||||
$statement->execute();
|
||||
$statement = $pdo->prepare("DELETE FROM rendez_vous WHERE rdv_id = :id");
|
||||
$statement->bindParam(':id', $id);
|
||||
$statement->execute();
|
||||
}
|
||||
74
src/php/db/ResetPassword.php
Normal file
74
src/php/db/ResetPassword.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
class ResetPraticien{
|
||||
static function checkMail($pdo, $mail) {
|
||||
$query = $pdo->prepare("SELECT COUNT(*) as count FROM medecin WHERE m_mail = :mail");
|
||||
$query->bindParam(':mail', $mail);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($result['count'] == 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static function getIdFromMail($pdo, $mail) {
|
||||
$query = $pdo->prepare("SELECT m_id FROM medecin WHERE m_mail = :mail");
|
||||
$query->bindParam(':mail', $mail);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
return $result['m_id'];
|
||||
}
|
||||
|
||||
public static function Reset($pdo,$mail,$password) {
|
||||
if(ResetPraticien::checkMail($pdo,$mail)){
|
||||
$password = password_hash($password, PASSWORD_ARGON2ID);
|
||||
$id = ResetPraticien::getIdFromMail($pdo,$mail);
|
||||
$query = $pdo->prepare("UPDATE medecin SET m_password = :password WHERE m_id = :id");
|
||||
$query->bindParam(':password', $password);
|
||||
$query->bindParam(':id', $id);
|
||||
$query->execute();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ResetPatient{
|
||||
static function checkMail($pdo, $mail) {
|
||||
$query = $pdo->prepare("SELECT COUNT(*) as count FROM patient WHERE p_mail = :mail");
|
||||
$query->bindParam(':mail', $mail);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($result['count'] == 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static function getIdFromMail($pdo, $mail) {
|
||||
$query = $pdo->prepare("SELECT p_id FROM patient WHERE p_mail = :mail");
|
||||
$query->bindParam(':mail', $mail);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
return $result['p_id'];
|
||||
}
|
||||
|
||||
public static function Reset($pdo,$mail,$password) {
|
||||
if(ResetPatient::checkMail($pdo,$mail)){
|
||||
$password = password_hash($password, PASSWORD_ARGON2ID);
|
||||
$id = ResetPatient::getIdFromMail($pdo,$mail);
|
||||
$query = $pdo->prepare("UPDATE patient SET p_password = :password WHERE p_id = :id");
|
||||
$query->bindParam(':password', $password);
|
||||
$query->bindParam(':id', $id);
|
||||
$query->execute();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
228
src/php/db/Search.php
Normal file
228
src/php/db/Search.php
Normal file
@@ -0,0 +1,228 @@
|
||||
<?php
|
||||
function search($pdo, $nom, $postal){
|
||||
if($_POST["nom"] == null && $_POST["postal"] == null){
|
||||
echo '<p class="ms-5 mt-2 fw-bold">Veuillez entrer un nom ou un lieu</p>';
|
||||
}
|
||||
else if($_POST['postal'] == null){
|
||||
$query = $pdo->prepare("SELECT * FROM medecin WHERE m_name = :nom");
|
||||
$query->bindParam(':nom', $_POST['nom']);
|
||||
$query->execute();
|
||||
$result = $query->fetchAll();
|
||||
|
||||
if($result == null){
|
||||
$query = $pdo->prepare("SELECT * FROM medecin WHERE m_specialty = :specialite");
|
||||
$query->bindParam(':specialite', $_POST['nom']);
|
||||
$query->execute();
|
||||
$result = $query->fetchAll();
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
foreach($result as $row){
|
||||
$count++;
|
||||
}
|
||||
|
||||
echo '<p class="ms-5 mt-2 fw-bold">'.$count.' Résultats</p>';
|
||||
|
||||
if($count == 0){
|
||||
echo '<p class="ms-5 mt-2 fw-bold">Aucun résultat</p>';
|
||||
}
|
||||
else{
|
||||
echo '<div class="d-flex flex-row flex-wrap mx-5 gap-5">';
|
||||
foreach($result as $row){
|
||||
echo '<div class="card mb-3">';
|
||||
echo '<div class="row g-0">';
|
||||
echo '<div class="col-md-4">';
|
||||
$imageUrl = 'https://thispersondoesnotexist.com';
|
||||
echo '<img src="' . $imageUrl . '" alt="doctor" class="img-fluid rounded-start" width="300" height="300">';
|
||||
echo '</div>';
|
||||
echo '<div class="col-md-8">';
|
||||
echo '<div class="card-body">';
|
||||
echo '<h5 class="card-title">'.$row['m_name'].' '.$row['m_surname'].'</h5>';
|
||||
echo '<h6 class="card-subtitle mb-2 text-body-secondary">'.$row['m_specialty'].'</h6>';
|
||||
$query = $pdo->prepare("SELECT * FROM propose WHERE m_id = :id");
|
||||
$query->bindParam(':id', $row['m_id']);
|
||||
$query->execute();
|
||||
$result = $query->fetchAll();
|
||||
$count = 0;
|
||||
foreach($result as $row2){
|
||||
$count++;
|
||||
}
|
||||
echo '<p class="card-text">Disponiblilité :'. $count .'</p>';
|
||||
echo '<form method="post" action="../../../calendrier.php">';
|
||||
echo '<input type="hidden" name="id" id="id" value="'.$row['m_id'].'">';
|
||||
echo '<input type="hidden" name="start" id="start" value="'.date("Y-m-d").'">';
|
||||
echo '<button type="submit" class="btn btn-danger">Prendre rendez-vous</button>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
else if($_POST['nom'] == null){
|
||||
if(strlen($_POST['postal']) != 5){
|
||||
$postal = substr($_POST['postal'], 0, 2);
|
||||
$postal = $postal.'%';
|
||||
$query = $pdo->prepare("SELECT * FROM medecin WHERE CAST(m_postal AS TEXT) LIKE :postal");
|
||||
$query->bindParam(':postal', $postal);
|
||||
$query->execute();
|
||||
$result = $query->fetchAll();
|
||||
|
||||
$count = 0;
|
||||
foreach($result as $row){
|
||||
$count++;
|
||||
}
|
||||
|
||||
echo '<p class="ms-5 mt-2 fw-bold">'.$count.' Résultats</p>';
|
||||
|
||||
if($count == 0){
|
||||
echo '<p class="ms-5 mt-2 fw-bold">Aucun résultat</p>';
|
||||
}
|
||||
else{
|
||||
echo '<div class="d-flex flex-row flex-wrap mx-5 gap-5">';
|
||||
foreach($result as $row){
|
||||
echo '<div class="card mb-3">';
|
||||
echo '<div class="row g-0">';
|
||||
echo '<div class="col-md-4">';
|
||||
$imageUrl = 'https://thispersondoesnotexist.com';
|
||||
echo '<img src="' . $imageUrl . '" alt="doctor" class="img-fluid rounded-start" width="300" height="300">';
|
||||
echo '</div>';
|
||||
echo '<div class="col-md-8">';
|
||||
echo '<div class="card-body">';
|
||||
echo '<h5 class="card-title">'.$row['m_name'].' '.$row['m_surname'].'</h5>';
|
||||
echo '<h6 class="card-subtitle mb-2 text-body-secondary">'.$row['m_specialty'].'</h6>';
|
||||
echo '<p class="card-text">Disponiblilité :'. $count .'</p>';
|
||||
echo '<form method="post" action="../../../calendrier.php">';
|
||||
echo '<input type="hidden" name="id" id="id" value="'.$row['m_id'].'">';
|
||||
echo '<input type="hidden" name="start" id="start" value="'.date("Y-m-d").'">';
|
||||
echo '<button type="submit" class="btn btn-danger">Prendre rendez-vous</button>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
else{
|
||||
$query = $pdo->prepare("SELECT * FROM medecin WHERE m_postal = :postal");
|
||||
$query->bindParam(':postal', $_POST['postal']);
|
||||
$query->execute();
|
||||
$result = $query->fetchAll();
|
||||
|
||||
$count = 0;
|
||||
foreach($result as $row){
|
||||
$count++;
|
||||
}
|
||||
|
||||
echo '<p class="ms-5 mt-2 fw-bold">'.$count.' Résultats</p>';
|
||||
|
||||
if($count == 0){
|
||||
echo '<p class="ms-5 mt-2 fw-bold">Aucun résultat</p>';
|
||||
}
|
||||
else{
|
||||
echo '<div class="d-flex flex-row flex-wrap mx-5 gap-5">';
|
||||
foreach($result as $row){
|
||||
echo '<div class="card mb-3">';
|
||||
echo '<div class="row g-0">';
|
||||
echo '<div class="col-md-4">';
|
||||
$imageUrl = 'https://thispersondoesnotexist.com';
|
||||
echo '<img src="' . $imageUrl . '" alt="doctor" class="img-fluid rounded-start" width="300" height="300">';
|
||||
echo '</div>';
|
||||
echo '<div class="col-md-8">';
|
||||
echo '<div class="card-body">';
|
||||
echo '<h5 class="card-title">'.$row['m_name'].' '.$row['m_surname'].'</h5>';
|
||||
echo '<h6 class="card-subtitle mb-2 text-body-secondary">'.$row['m_specialty'].'</h6>';
|
||||
echo '<p class="card-text">Disponiblilité :'. $count .'</p>';
|
||||
echo '<form method="post" action="../../../calendrier.php">';
|
||||
echo '<input type="hidden" name="id" id="id" value="'.$row['m_id'].'">';
|
||||
echo '<input type="hidden" name="start" id="start" value="'.date("Y-m-d").'">';
|
||||
echo '<button type="submit" class="btn btn-danger">Prendre rendez-vous</button>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(strlen($_POST['postal']) != 5){
|
||||
$postal = substr($_POST['postal'], 0, 2);
|
||||
$postal = $postal.'%';
|
||||
$query = $pdo->prepare("SELECT * FROM medecin WHERE CAST(m_postal AS TEXT) LIKE :postal AND m_name = :nom");
|
||||
$query->bindParam(':postal', $postal);
|
||||
$query->bindParam(':nom', $_POST['nom']);
|
||||
$query->execute();
|
||||
$result = $query->fetchAll();
|
||||
}
|
||||
else{
|
||||
$query = $pdo->prepare("SELECT * FROM medecin WHERE m_name = :nom AND m_postal = :postal");
|
||||
$query->bindParam(':nom', $_POST['nom']);
|
||||
$query->bindParam(':postal', $_POST['postal']);
|
||||
$query->execute();
|
||||
$result = $query->fetchAll();
|
||||
}
|
||||
if ($result == null) {
|
||||
if(strlen($_POST['postal']) != 5){
|
||||
$postal = substr($_POST['postal'], 0, 2);
|
||||
$postal = $postal.'%';
|
||||
$query = $pdo->prepare("SELECT * FROM medecin WHERE CAST(m_postal AS TEXT) LIKE :postal AND m_specialty = :specialite");
|
||||
$query->bindParam(':postal', $postal);
|
||||
$query->bindParam(':specialite', $_POST['nom']);
|
||||
$query->execute();
|
||||
$result = $query->fetchAll();
|
||||
}
|
||||
else{
|
||||
$query = $pdo->prepare("SELECT * FROM medecin WHERE m_specialty = :specialite AND m_postal = :postal");
|
||||
$query->bindParam(':specialite', $_POST['nom']);
|
||||
$query->bindParam(':postal', $_POST['postal']);
|
||||
$query->execute();
|
||||
$result = $query->fetchAll();
|
||||
}
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
foreach ($result as $row) {
|
||||
$count++;
|
||||
}
|
||||
|
||||
echo '<p class="ms-5 mt-2 fw-bold">' . $count . ' Résultats</p>';
|
||||
|
||||
if ($count == 0) {
|
||||
echo '<p class="ms-5 mt-2 fw-bold">Aucun résultat</p>';
|
||||
} else {
|
||||
echo '<div class="d-flex flex-row flex-wrap mx-5 gap-5">';
|
||||
foreach ($result as $row) {
|
||||
echo '<div class="card mb-3">';
|
||||
echo '<div class="row g-0">';
|
||||
echo '<div class="col-md-4">';
|
||||
$imageUrl = 'https://thispersondoesnotexist.com';
|
||||
echo '<img src="' . $imageUrl . '" alt="doctor" class="img-fluid rounded-start" width="300" height="300">';
|
||||
echo '</div>';
|
||||
echo '<div class="col-md-8">';
|
||||
echo '<div class="card-body">';
|
||||
echo '<h5 class="card-title">' . $row['m_name'] . ' ' . $row['m_surname'] . '</h5>';
|
||||
echo '<h6 class="card-subtitle mb-2 text-body-secondary">' . $row['m_specialty'] . '</h6>';
|
||||
echo '<p class="card-text">Disponiblilité :'. $count .'</p>';
|
||||
echo '<form method="post" action="../../../calendrier.php">';
|
||||
echo '<input type="hidden" name="id" id="id" value="'.$row['m_id'].'">';
|
||||
echo '<input type="hidden" name="start" id="start" value="'.date("Y-m-d").'">';
|
||||
echo '<button type="submit" class="btn btn-danger">Prendre rendez-vous</button>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
52
src/php/db/Signup.php
Normal file
52
src/php/db/Signup.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
class SignupPatient
|
||||
{
|
||||
public static function Insert($pdo,$name,$surname,$mail,$password,$phone){
|
||||
$password = password_hash($password, PASSWORD_ARGON2ID);
|
||||
$query = $pdo->prepare("INSERT INTO patient (p_name,p_surname,p_mail,p_password,p_phone) VALUES (:name,:surname,:mail,:password,:phone)");
|
||||
$query->bindParam(':name', $name);
|
||||
$query->bindParam(':surname', $surname);
|
||||
$query->bindParam(':mail', $mail);
|
||||
$query->bindParam(':password', $password);
|
||||
$query->bindParam(':phone', $phone);
|
||||
$query->execute();
|
||||
//Check if user is well created in database
|
||||
$query = $pdo->prepare("SELECT COUNT(*) as count FROM patient WHERE p_mail = :mail");
|
||||
$query->bindParam(':mail', $mail);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
if ($result['count'] == 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class SignupMedecin
|
||||
{
|
||||
public static function insertMedecin($pdo,$name,$surname,$mail,$password,$specialite,$phone,$postal) {
|
||||
$password = password_hash($password, PASSWORD_ARGON2ID);
|
||||
$query = $pdo->prepare("INSERT INTO medecin (m_name,m_surname,m_mail,m_password,m_specialty,m_phone,m_postal) VALUES (:name,:surname,:mail,:password,:specialite,:phone,:postal)");
|
||||
$query->bindParam(':name', $name);
|
||||
$query->bindParam(':surname', $surname);
|
||||
$query->bindParam(':mail', $mail);
|
||||
$query->bindParam(':password', $password);
|
||||
$query->bindParam(':specialite', $specialite);
|
||||
$query->bindParam(':phone', $phone);
|
||||
$query->bindParam(':postal', $postal);
|
||||
$query->execute();
|
||||
//Check if user is well created in database
|
||||
$query = $pdo->prepare("SELECT COUNT(*) as count FROM medecin WHERE m_mail = :mail");
|
||||
$query->bindParam(':mail', $mail);
|
||||
$query->execute();
|
||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
if ($result['count'] == 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
24
src/php/db/dbconnect.php
Normal file
24
src/php/db/dbconnect.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
function dbConnect() //fonction de connexion à la base de données
|
||||
{
|
||||
try
|
||||
{
|
||||
$db = new PDO('pgsql:host='.DB_SERVER.';port='.DB_PORT.';dbname='.DB_NAME, DB_USER, DB_PASSWORD);
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
}
|
||||
catch (PDOException $exception)
|
||||
{
|
||||
error_log('Connection error: '.$exception->getMessage());
|
||||
return false;
|
||||
}
|
||||
return $db;
|
||||
}
|
||||
|
||||
function console_log($data)
|
||||
{
|
||||
//Console Log comme en JS
|
||||
echo '<script>';
|
||||
echo 'console.log('. json_encode( $data ) .')';
|
||||
echo '</script>';
|
||||
}
|
||||
?>
|
||||
46
src/php/db/scripts/CancelRDV.php
Normal file
46
src/php/db/scripts/CancelRDV.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require('../dbconnect.php');
|
||||
require('../../constants.php');
|
||||
require('../Login.php');
|
||||
require('../Rdv.php');
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
$pdo = dbConnect();
|
||||
|
||||
|
||||
if (isset($_POST['cancel_button'])) {
|
||||
$rdv_id = $_POST['rdv_id'];
|
||||
CancelRDV($pdo, $rdv_id);
|
||||
header("Location: ../../../../rdv.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['move_button'])) {
|
||||
$rdv_id = $_POST['rdv_id'];
|
||||
$MedID = $_POST['medecin_id'];
|
||||
$date = $_POST['date'];
|
||||
CancelRDV($pdo, $rdv_id);
|
||||
echo '<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title> Déplacer RDV </title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Just+Me+Again+Down+Here&family=Open+Sans&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="src/css/styles.css">
|
||||
<link rel="icon" href="src/img/favicon.png" type="image/x-icon"/>
|
||||
</head>';
|
||||
echo '<form method="post" action="../../../../calendrier.php">';
|
||||
echo '<input type="hidden" name="id" id="id" value="'.$MedID.'">';
|
||||
echo '<input type="hidden" name="start" id="start" value="'.date("Y-m-d").'">';
|
||||
echo '<div class="d-flex flex-row flex-wrap my-5 mx-5 gap-5 justify-content-center text-center">';
|
||||
echo '<button type="submit" class="btn btn-danger ">Sélectionner un nouveau rendez-vous</button>';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
20
src/php/db/scripts/addRDVToDB.php
Normal file
20
src/php/db/scripts/addRDVToDB.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
require('../dbconnect.php');
|
||||
require('../../constants.php');
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
$pdo = dbConnect();
|
||||
|
||||
$rdv = $_GET['id'];
|
||||
$patient = $_GET['patient'];
|
||||
|
||||
$query = $pdo->prepare("UPDATE rendez_vous SET p_id = :p_id WHERE rdv_id = :rdv_id");
|
||||
$query->bindParam(':p_id', $patient);
|
||||
$query->bindParam(':rdv_id', $rdv);
|
||||
$query->execute();
|
||||
|
||||
|
||||
//Redirect to the rdv.php page
|
||||
echo '<meta http-equiv="refresh" content="0;URL=../../../../rdv.php">';
|
||||
|
||||
?>
|
||||
40
src/php/db/scripts/createRDVToDB.php
Normal file
40
src/php/db/scripts/createRDVToDB.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
require('../dbconnect.php');
|
||||
require('../../constants.php');
|
||||
require('../Login.php');
|
||||
require('../Rdv-praticien.php');
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
$pdo = dbConnect();
|
||||
|
||||
if (isset($_POST['createRDV'])) {
|
||||
$medID = $_POST['medID'];
|
||||
$dateUse = $_POST['date'];
|
||||
$dateInter = new DateTime($dateUse);
|
||||
$date = $dateInter->format('Y-m-d');
|
||||
$timeUse = $_POST['time'];
|
||||
$timeInter = new DateTime($timeUse);
|
||||
$time = $timeInter->format('H:i:s');
|
||||
$lieu = $_POST['lieu'];
|
||||
$place = explode(", ", $lieu);
|
||||
$lieuID = getLieuID($pdo, $place[0], $place[1], $place[2]);
|
||||
|
||||
if ($medID != null && $date != null && $time != null && $lieuID != null) {
|
||||
$query = $pdo->prepare("INSERT INTO rendez_vous (rdv_date, rdv_time, l_id) VALUES (:date, :time, :lieuID )");
|
||||
$query->bindParam(':date', $date);
|
||||
$query->bindParam(':time', $time);
|
||||
$query->bindParam(':lieuID', $lieuID);
|
||||
$query->execute();
|
||||
$rdvID = $pdo->lastInsertId();
|
||||
$query = $pdo->prepare("INSERT INTO propose (m_id, rdv_id) VALUES (:medID, :rdvID)");
|
||||
$query->bindParam(':medID', $medID);
|
||||
$query->bindParam(':rdvID', $rdvID);
|
||||
$query->execute();
|
||||
}
|
||||
|
||||
header("Location: ../../../../rdv-praticien.php");
|
||||
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
9
src/php/db/scripts/deconnexion.php
Normal file
9
src/php/db/scripts/deconnexion.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
session_start();
|
||||
unset($_SESSION["token"]);
|
||||
//Redirect to the rdv.php page
|
||||
echo '<meta http-equiv="refresh" content="0;URL=../../../../index.php">';
|
||||
|
||||
?>
|
||||
16
src/php/db/scripts/uploadFile.php
Normal file
16
src/php/db/scripts/uploadFile.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_FILES["file"])) {
|
||||
$uploadDir = "src/uploadFiles/";
|
||||
$nameOfFile = "RDV" . $_POST['rdv_id'];
|
||||
$uploadFile = $uploadDir . $nameOfFile . ".pdf";
|
||||
|
||||
echo "Chemin du fichier de destination : " . $uploadFile . "<br>";
|
||||
|
||||
if (move_uploaded_file($_FILES["file"]["tmp_name"], $uploadFile)) {
|
||||
echo "Le fichier a été téléchargé avec succès.";
|
||||
} else {
|
||||
echo "Erreur lors du téléchargement du fichier. Code d'erreur : " . $_FILES["file"]["error"];
|
||||
error_log("Erreur lors du téléchargement du fichier: " . $_FILES["file"]["error"]);
|
||||
}
|
||||
}
|
||||
?>
|
||||
BIN
src/sql/ProjetS3PHP.mcd
Normal file
BIN
src/sql/ProjetS3PHP.mcd
Normal file
Binary file not shown.
195237
src/sql/data.sql
Normal file
195237
src/sql/data.sql
Normal file
File diff suppressed because it is too large
Load Diff
75
src/sql/schema.sql
Normal file
75
src/sql/schema.sql
Normal file
@@ -0,0 +1,75 @@
|
||||
------------------------------------------------------------
|
||||
-- Script Postgre
|
||||
------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Table: Patient
|
||||
------------------------------------------------------------
|
||||
CREATE TABLE public.Patient(
|
||||
P_ID SERIAL NOT NULL ,
|
||||
P_Mail VARCHAR (50) NOT NULL ,
|
||||
P_Name VARCHAR (50) NOT NULL ,
|
||||
P_Surname VARCHAR (50) NOT NULL ,
|
||||
P_Phone INT NOT NULL ,
|
||||
P_Password VARCHAR (150) NOT NULL ,
|
||||
CONSTRAINT Patient_PK PRIMARY KEY (P_ID)
|
||||
)WITHOUT OIDS;
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Table: Medecin
|
||||
------------------------------------------------------------
|
||||
CREATE TABLE public.Medecin(
|
||||
M_ID SERIAL NOT NULL ,
|
||||
M_Mail VARCHAR (50) NOT NULL ,
|
||||
M_Name VARCHAR (50) NOT NULL ,
|
||||
M_Surname VARCHAR (50) NOT NULL ,
|
||||
M_Password VARCHAR (150) NOT NULL ,
|
||||
M_Postal INT NOT NULL ,
|
||||
M_Phone INT NOT NULL ,
|
||||
M_Specialty VARCHAR (50) NOT NULL ,
|
||||
CONSTRAINT Medecin_PK PRIMARY KEY (M_ID)
|
||||
)WITHOUT OIDS;
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Table: Lieu
|
||||
------------------------------------------------------------
|
||||
CREATE TABLE public.Lieu(
|
||||
L_Id SERIAL NOT NULL ,
|
||||
L_Adress VARCHAR (200) NOT NULL ,
|
||||
L_City VARCHAR (50) NOT NULL ,
|
||||
L_Postal INT NOT NULL ,
|
||||
CONSTRAINT Lieu_PK PRIMARY KEY (L_Id)
|
||||
)WITHOUT OIDS;
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Table: Rendez-Vous
|
||||
------------------------------------------------------------
|
||||
CREATE TABLE public.Rendez_Vous(
|
||||
RDV_Id SERIAL NOT NULL ,
|
||||
RDV_Date DATE NOT NULL ,
|
||||
RDV_Time TIMETZ NOT NULL ,
|
||||
P_ID INT ,
|
||||
L_Id INT NOT NULL ,
|
||||
CONSTRAINT Rendez_Vous_PK PRIMARY KEY (RDV_Id)
|
||||
|
||||
,CONSTRAINT Rendez_Vous_Patient_FK FOREIGN KEY (P_ID) REFERENCES public.Patient(P_ID)
|
||||
,CONSTRAINT Rendez_Vous_Lieu0_FK FOREIGN KEY (L_Id) REFERENCES public.Lieu(L_Id)
|
||||
)WITHOUT OIDS;
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Table: Propose
|
||||
------------------------------------------------------------
|
||||
CREATE TABLE public.Propose(
|
||||
RDV_Id INT NOT NULL ,
|
||||
M_ID INT NOT NULL ,
|
||||
CONSTRAINT Propose_PK PRIMARY KEY (RDV_Id,M_ID)
|
||||
|
||||
,CONSTRAINT Propose_Rendez_Vous_FK FOREIGN KEY (RDV_Id) REFERENCES public.Rendez_Vous(RDV_Id)
|
||||
,CONSTRAINT Propose_Medecin0_FK FOREIGN KEY (M_ID) REFERENCES public.Medecin(M_ID)
|
||||
)WITHOUT OIDS;
|
||||
0
src/uploadFiles/JustToBeHere.pdf
Normal file
0
src/uploadFiles/JustToBeHere.pdf
Normal file
Reference in New Issue
Block a user