diff --git a/login.php b/login.php
deleted file mode 100755
index 6edee3f..0000000
--- a/login.php
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
- 1 && strlen($_POST['mail']) > 1 && strlen($_POST['password']) > 1 && strlen($_POST['co']) > 1; // si au moins 1 caractère
- $usernameCheck = $postVariablesNEmpty && preg_match("/^[\w -]{3,10}$/i", $_POST['username']); // utilisateur -> "alphanum_- " -> 3 à 10 caractères
- $mailCheck = $usernameCheck && preg_match("/^[\w\.-]+@[\w\.-]+\.[a-z]{2,4}$/i", $_POST['mail']); // mail -> bon format
- $passwordCheck = $mailCheck && preg_match("/^[\w -]{8,50}$/i", $_POST['password']); // password -> "alphanum_- " -> 8 à 50 caractères
- $coCheck = $passwordCheck && $_POST['co'] == 'Me connecter';
-
-if( $coCheck ){ // si toutes les valeurs sont correctes
-
- $user = array(); // on définit l'utilisateur
- $user['name'] = $_POST['username'];
- $user['mail'] = $_POST['mail'];
- $user['password'] = $_POST['password'];
- $user['hash'] = sha1($_POST['password']);
-
-}
-
-
-// retourne VRAI si l'utilisateur est connecté
-function connected($user){ return ($user != null); }
-
-?>
-
-
-
- Tests php
-
-
-
-
-
-
-
-
-
-
-
- ";
-
- /* AFFICHAGE D'ERREURS */
- if( $postVariablesAreSet ){ // si formulaire soumis
- if( !$postVariablesNEmpty )
- echo 'Certains champs requis sont vides.';
- elseif( !$usernameCheck )
- echo 'Nom d\'utilisateur incorrect. (3 car. min)';
- elseif( !$mailCheck )
- echo 'Adresse mail incorrecte.';
- elseif( !$passwordCheck )
- echo 'Mot de passe incorrect. (8 car. min)';
- elseif( connected($user) )
- echo 'Vous êtes connectés.';
- }
-
- echo "";
- echo "";
- echo "";
- echo "";
- echo "";
-
- ?>
-
-
-
-
\ No newline at end of file
diff --git a/repositories/exemple_config.json b/repositories/exemple_config.json
index 8f65e65..f853bc6 100755
--- a/repositories/exemple_config.json
+++ b/repositories/exemple_config.json
@@ -1,6 +1,6 @@
{
"host": "localhost",
- "login": "php",
- "password": "Qt358nUdyeTxLDM8",
- "database": "projetphp"
+ "login": "login",
+ "password": "password",
+ "database": "DBName"
}
diff --git a/repositories/repos/MedecinRepo.php b/repositories/repos/MedecinRepo.php
index 337753c..9b4d324 100755
--- a/repositories/repos/MedecinRepo.php
+++ b/repositories/repos/MedecinRepo.php
@@ -25,7 +25,7 @@ class MedecinRepo
$req = $this->connexion->prepare('INSERT INTO Medecin VALUES (DEFAULT,:civilite,:prenom,:nom)');
$result = $req->execute(['civilite' => $civilite,
'nom' => $nom,
- 'prenom' => $prenom));
+ 'prenom' => $prenom]);
if($result){return ['id' => $this->connexion->lastInsertId()];}
else{return false;}
}
diff --git a/repositories/repos/PatientRepo.php b/repositories/repos/PatientRepo.php
index 71cb119..2ff88f4 100755
--- a/repositories/repos/PatientRepo.php
+++ b/repositories/repos/PatientRepo.php
@@ -21,13 +21,17 @@ class PatientRepo
}
- public function add($civilite,$prenom,$nom,$adresse,$ville,$codePostal,$dateNaissance,$lieuNaissance,$numSecu,$medecinTraitant = null){
+ public function add($civilite,$prenom,$nom,$adresse,$adresse2,$ville,$codePostal,$dateNaissance,$lieuNaissance,$numSecu,$medecinTraitant = null){
- $req = $this->connexion->prepare('INSERT INTO Patient VALUES (:civilite,:nom,:prenom,:adresse,:ville,:codePostal,:dateNaissance,:lieuNaissance,:numSecu,DEFAULT,:medecin)');
+ $dateNaissance = strtotime($dateNaissance);
+ $dateNaissance = Date('o-m-d',$dateNaissance);
+
+ $req = $this->connexion->prepare('INSERT INTO Patient VALUES (:civilite,:nom,:prenom,:adresse,:adresse2,:ville,:codePostal,:dateNaissance,:lieuNaissance,:numSecu,DEFAULT,:medecin)');
$result = $req->execute(['civilite' => $civilite,
'nom' => $nom,
'prenom' => $prenom,
'adresse' => $adresse,
+ 'adresse2' => $adresse2,
'ville' => $ville,
'codePostal' => $codePostal,
'dateNaissance' => $dateNaissance,
@@ -49,7 +53,7 @@ class PatientRepo
public function updateMedecinTraitant($idPatient,$idMedecin){
$req = $this->connexion->prepare('UPDATE Patient SET MedecinTraitant = :medecin WHERE Id = :id');
- return $req->execute['medecin' => $idMedecin,
+ return $req->execute(['medecin' => $idMedecin,
'id' => $idPatient]);
}
diff --git a/repositories/repos/RDVRepo.php b/repositories/repos/RDVRepo.php
index 9fa90a5..8b312f8 100755
--- a/repositories/repos/RDVRepo.php
+++ b/repositories/repos/RDVRepo.php
@@ -22,8 +22,11 @@ class RDVRepo
}
public function getByDate($date){
- $date = date('o-m-d',$date);
- $req = $this->connexion->prepare('SELECT * FROM RDV WHERE DATE(FROM_UNIXTIME(1449136444)) = :date');
+ $date = strtotime($date);
+ $date = date('o-m-d',$date);
+ $req = $this->connexion->prepare('SELECT * FROM RDV WHERE DATE(FROM_UNIXTIME(1449136444)) = :date');
+ $req->execute(['date' => $date]);
+ return StaticRepo::delNumeric($req->fetchAll());
}
public function delete($idRDV){
diff --git a/toBDD.php b/toBDD.php
new file mode 100644
index 0000000..1573d71
--- /dev/null
+++ b/toBDD.php
@@ -0,0 +1,28 @@
+add($patient['Civilite'], $patient['Prenom'], $patient['Nom']);
+}
+
+foreach($jsonP as $patient){
+ $repo->add($patient['Civilite'],$patient['Prenom'],$patient['Nom'],$patient['Adresse'],NULL,$patient['Ville'],$patient['CodePostal'],$patient['DateNaissance'],$patient['LieuNaissance'],$patient['NumSecuriteSociale'],$patient['MedecinTraitant']);
+}
\ No newline at end of file