From 27f0e15458adb47dd04bcdb21d18223039a7ac2b Mon Sep 17 00:00:00 2001 From: Emre Date: Wed, 30 Nov 2022 21:07:49 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20d'un=20modele=20pour=20Utilisateur,=20j?= =?UTF-8?q?=20ai=20commencer=20=C3=A0=20pouvoir=20inscrire=20une=20personn?= =?UTF-8?q?e=20et=20que=20le=20formulaire=20d'inscription=20est=20bien=20v?= =?UTF-8?q?=C3=A9rifier,=20j=20ai=20changer=20les=20vues=20(design,=20nom,?= =?UTF-8?q?=20css...),=20J=20ai=20changer=20presque=20tout=20les=20classes?= =?UTF-8?q?=20de=20fa=C3=A7on=20plus=20optimiser,=20j=20ai=20ajouter=20le?= =?UTF-8?q?=20FrontControleur.php!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/Controleur.php | 145 --------- .../{CtrlUtilisateur => CtrlUtilisateur.php} | 0 src/Controller/CtrlVisiteur.php | 100 ++++++ src/Controller/FrontControleur.php | 22 ++ src/Modele/Classe/Liste.php | 67 ++++ src/Modele/Classe/ModeleVisiteur.php | 22 ++ src/Modele/Classe/Tache.php | 77 +++++ src/Modele/{ => Classe}/Utilisateur.php | 22 +- src/Modele/Liste.php | 47 --- src/Modele/ListeGateway.php | 6 +- src/Modele/ModeleUtilisateur.php | 28 ++ src/Modele/Tache.php | 47 --- src/Modele/UtilisateurGateway.php | 18 +- src/Vue/css/home.css | 15 - src/Vue/css/inscription.css | 286 ------------------ src/Vue/css/profil.css | 233 -------------- src/Vue/css/style.css | 34 ++- src/Vue/html/ListeVue.php | 9 - src/Vue/html/NavBar.php | 21 ++ .../html/{index.html => PageListePublic.php} | 54 +--- src/Vue/html/erreur.php | 18 ++ src/Vue/html/inscription.html | 54 ---- src/Vue/html/inscription.php | 59 ++++ src/Vue/html/{login.html => login.php} | 8 +- src/Vue/html/profilARefaire.html | 81 ----- src/Vue/javaScript/inscription.js | 53 ---- src/config/Connection.php | 31 ++ src/config/SplClassLoader.php | 155 ---------- src/config/Validation.php | 77 ++++- src/config/config.php | 21 +- src/index.php | 18 +- 31 files changed, 589 insertions(+), 1239 deletions(-) delete mode 100755 src/Controller/Controleur.php rename src/Controller/{CtrlUtilisateur => CtrlUtilisateur.php} (100%) create mode 100644 src/Controller/CtrlVisiteur.php create mode 100644 src/Controller/FrontControleur.php create mode 100644 src/Modele/Classe/Liste.php create mode 100644 src/Modele/Classe/ModeleVisiteur.php create mode 100644 src/Modele/Classe/Tache.php rename src/Modele/{ => Classe}/Utilisateur.php (59%) delete mode 100644 src/Modele/Liste.php create mode 100644 src/Modele/ModeleUtilisateur.php delete mode 100644 src/Modele/Tache.php delete mode 100644 src/Vue/css/home.css delete mode 100644 src/Vue/css/profil.css delete mode 100644 src/Vue/html/ListeVue.php create mode 100644 src/Vue/html/NavBar.php rename src/Vue/html/{index.html => PageListePublic.php} (65%) create mode 100644 src/Vue/html/erreur.php delete mode 100644 src/Vue/html/inscription.html create mode 100644 src/Vue/html/inscription.php rename src/Vue/html/{login.html => login.php} (91%) delete mode 100644 src/Vue/html/profilARefaire.html delete mode 100644 src/Vue/javaScript/inscription.js create mode 100644 src/config/Connection.php delete mode 100755 src/config/SplClassLoader.php diff --git a/src/Controller/Controleur.php b/src/Controller/Controleur.php deleted file mode 100755 index 4f8e905..0000000 --- a/src/Controller/Controleur.php +++ /dev/null @@ -1,145 +0,0 @@ -Reinit(); - break; - - - case "validationFormulaire": - $this->ValidationFormulaire($dVueEreur); - break; - - case "redirectionLogin": - $this->redirectionLogin($dVueEreur); - break; - - case "redirectionInscription": - $this->redirectionInscription($dVueEreur); - break; - - case "seConnecter": - $this->seConnecter($dVueEreur); - break; - - case "ConsulterListe": - $this->ConsulterListe(); - break; - -//mauvaise action -default: -$dVueEreur[] = "Erreur d'appel php"; -require ($rep.$vues['home']); -break; -} - -} catch (PDOException $e) -{ - //si erreur BD, pas le cas ici - $dVueEreur[] = "Erreur inattendue!!! "; - require ($rep.$vues['erreur']); - -} -catch (Exception $e2) - { - $dVueEreur[] = "Erreur inattendue!!! "; - require ($rep.$vues['erreur']); - } - - -//fin -exit(0); -}//fin constructeur - - -function Reinit() { -global $rep,$vues; - -$dVue = array ( - 'nom' => "", - 'age' => 0, - ); - require ($rep.$vues['Home']); -} - -function ValidationFormulaire(array $dVueEreur) { -global $rep,$vues; - - -//si exception, ca remonte !!! -$nom=$_POST['txtNom']; // txtNom = nom du champ texte dans le formulaire -$age=$_POST['txtAge']; -\config\Validation::val_form($nom,$age,$dVueEreur); - -$model = new \Modele\Simplemodel(); -$data=$model->get_data(); - -$dVue = array ( - 'nom' => $nom, - 'age' => $age, - 'data' => $data, - ); - require ($rep.$vues['inscription']); -} - - -function redirectionLogin(array $dVueEreur) { - global $rep,$vues; - require ($rep.$vues['login']); -} - -function redirectionInscription(array $dVueEreur) { - global $rep,$vues; - require ($rep.$vues['inscription']); -} - -function seConnecter(array $dVueEreur) { - global $rep,$vues; - - - //si exception, ca remonte !!! - $mail=$_POST['mail']; // txtNom = nom du champ texte dans le formulaire - $password=$_POST['password']; - \config\Validation::val_connection($nom,$age,$dVueEreur); - require ($rep.$vues['login']); -} - -function ConsulterListe(){ - global $rep,$vues; - $con=new Connection("mysql:host=localhost;dbname=dbrahassou","rahassou","achanger"); - $model = new ListeGateway($con); - $results=array(); - $results=$model->getListePublic(0,10); - $dVue = array ( - 'results' => $results - ); - require ($rep.$vues['listeVue']); - } - - -}//fin class - -?> diff --git a/src/Controller/CtrlUtilisateur b/src/Controller/CtrlUtilisateur.php similarity index 100% rename from src/Controller/CtrlUtilisateur rename to src/Controller/CtrlUtilisateur.php diff --git a/src/Controller/CtrlVisiteur.php b/src/Controller/CtrlVisiteur.php new file mode 100644 index 0000000..a806253 --- /dev/null +++ b/src/Controller/CtrlVisiteur.php @@ -0,0 +1,100 @@ +Reinit(); + break; + + case "validationFormulaire": + $this->ValidationFormulaire($dVueEreur); + break; + + case "redirectionLogin": + $this->redirectionLogin($dVueEreur); + break; + + case "redirectionInscription": + $this->redirectionInscription($dVueEreur); + break; + + case "seConnecter": + $this->seConnecter($dVueEreur); + break; + + case "ConsulterListe": + $this->ConsulterListe(); + break; + + //mauvaise action + default: + $dVueEreur[] = "Erreur d'appel php"; + require ($rep.$vues['home']); + break; + } + + } catch (PDOException $e) + { + //si erreur BD, pas le cas ici + $dVueEreur[] = "Erreur inattendue!!! "; + require ($rep.$vues['erreur']); + + } + catch (Exception $e2) + { + $dVueEreur[] = "Erreur inattendue!!! "; + require ($rep.$vues['erreur']); + } + + + //fin + exit(0); + }//fin constructeur + + + function Reinit() { + require ($rep.$vues['Home']); + } + + function ValidationFormulaire(array $dVueEreur) { + require ($rep.$vues['inscription']); + } + + + function redirectionLogin(array $dVueEreur) { + require ($rep.$vues['login']); + } + + function redirectionInscription(array $dVueEreur) { + require ($rep.$vues['inscription']); + } + + function seConnecter(array $dVueEreur) { + require ($rep.$vues['login']); + } + + function ConsulterListe(){ + require ($rep.$vues['listeVue']); + } + + +}//fin class + +?> diff --git a/src/Controller/FrontControleur.php b/src/Controller/FrontControleur.php new file mode 100644 index 0000000..274afb7 --- /dev/null +++ b/src/Controller/FrontControleur.php @@ -0,0 +1,22 @@ + diff --git a/src/Modele/Classe/Liste.php b/src/Modele/Classe/Liste.php new file mode 100644 index 0000000..f3ba958 --- /dev/null +++ b/src/Modele/Classe/Liste.php @@ -0,0 +1,67 @@ +id = $id; + $this->nom = $nom; + $this->description = $description; + $this->dateCreation = $dateCreation; + $this->estPublic = $estPublic; + $this->idUser = $idUser; + } + + //Id + public function getId(){ + return $this->id; + } + + public function setId($id){ + $this->id=$id; + } + + //Nom + public function getNom(){ + return $this->nom; + } + + public function setNom($nom){ + $this->nom=$nom; + } + + //DateCreation + public function getDateCreation(){ + return $this->dateCreation; + } + + public function setDateCreation($dateCreation){ + $this->dateCreation = $dateCreation; + } + + //EstPublic + public function getEstPublic(){ + return $this->estPublic; + } + + public function setEstPublic($estPublic){ + $this->estPublic = $estPublic; + } + + //IdUser + public function getIdUser(){ + return $this->idUser; + } + + public function setIdUser($idUser){ + $this->idUser = $idUser; + } + +} diff --git a/src/Modele/Classe/ModeleVisiteur.php b/src/Modele/Classe/ModeleVisiteur.php new file mode 100644 index 0000000..23541ab --- /dev/null +++ b/src/Modele/Classe/ModeleVisiteur.php @@ -0,0 +1,22 @@ +id = $id; + $this->nom = $nom; + $this->description = $description; + $this->dateCreation = $dateCreation; + $this->estValide = $estValide; + $this->idListe = $idListe; + } + + //Id + public function getid(){ + return $this->id; + } + + public function setId($id){ + $this->id=$id; + } + + //Nom + public function getNom(){ + return $this->nom; + } + + public function setNom($nom){ + $this->nom=$nom; + } + + //Description + public function getDescription(){ + return $this->description; + } + + public function setDescription($description){ + $this->description=$description; + } + + //DateCreation + public function getDateCreation(){ + return $this->dateCreation; + } + + public function setDateCreation($dateCreation){ + $this->dateCreation = $dateCreation; + } + + //EstValide + public function getEstValide(){ + return $this->estValide; + } + + public function setEstValide($estValide){ + $this->estValide = $estValide; + } + + //idList + public function getIdListe(){ + return $this->estValide; + } + + public function setIdListe($idListe){ + $this->idListe = $idListe; + } + +} diff --git a/src/Modele/Utilisateur.php b/src/Modele/Classe/Utilisateur.php similarity index 59% rename from src/Modele/Utilisateur.php rename to src/Modele/Classe/Utilisateur.php index 3f0c917..256990a 100644 --- a/src/Modele/Utilisateur.php +++ b/src/Modele/Classe/Utilisateur.php @@ -4,13 +4,13 @@ namespace modeles; class Utilisateur { - private string $id; - private string $nom; - private string $prenom; - private string $pseudo; - private string $email; + private $id; + private $nom; + private $prenom; + private $pseudo; + private $email; - public function __construct(string $id, string $nom, string $prenom, string $pseudo, string $email,string $motDePasse, bool $isAdmin){ + public function __construct($id, $nom, $prenom, $pseudo, $email, $motDePasse, $isAdmin){ $this->id = $id; $this->nom = $nom; $this->prenom = $prenom; @@ -23,7 +23,7 @@ class Utilisateur return $this->id; } - public function setId(string $id){ + public function setId($id){ $this->nom = $id; } @@ -32,7 +32,7 @@ class Utilisateur return $this->nom; } - public function setNom(string $nom){ + public function setNom($nom){ $this->nom = $nom; } @@ -41,7 +41,7 @@ class Utilisateur return $this->prenom; } - public function setPrenom(string $prenom){ + public function setPrenom($prenom){ $this->prenom = $prenom; } @@ -50,7 +50,7 @@ class Utilisateur return $this->pseudo; } - public function setPseudo(string $pseudo){ + public function setPseudo($pseudo){ $this->pseudo = $pseudo; } @@ -59,7 +59,7 @@ class Utilisateur return $this->email; } - public function setEmail(string $email){ + public function setEmail($email){ $this->email = $email; } diff --git a/src/Modele/Liste.php b/src/Modele/Liste.php deleted file mode 100644 index b7b5856..0000000 --- a/src/Modele/Liste.php +++ /dev/null @@ -1,47 +0,0 @@ -id = $id; - $this->nom = $nom; - $this->description = $description; - $this->dateCreation = $dateCreation; - $this->estValide = false; - $this->liste = $liste; - } - - //Nom - public function getNom(){ - return $this->nom; - } - - //Id - public function getid(){ - return $this->id; - } - - //DateCreation - public function getDateCreation(){ - return $this->dateCreation; - } - - //EstValide - public function getEstValide(){ - return $this->estValide; - } - - public function getListe(){ - return $this->liste; - } - - -} diff --git a/src/Modele/ListeGateway.php b/src/Modele/ListeGateway.php index 92de164..04fb9e5 100644 --- a/src/Modele/ListeGateway.php +++ b/src/Modele/ListeGateway.php @@ -21,9 +21,9 @@ class ListeGateway{ $this->con->executeQuery($query, array('nom' => array($Liste->getNom(), PDO::PARAM_STRING)), array('id' => array($Liste->getId()),PDO::PARAM_INT)); } - public function Supprimer(Liste $liste){ + public function Supprimer(int $id){ $query='DELETE FROM ToDoListe_Liste WHERE id=:id'; - $this->con->executeQuery($query,'id' => array($liste->id, PDO::PARAM_STRING))); + $this->con->executeQuery($query,'id' => array($id, PDO::PARAM_STRING))); } public function getListe(int $offset, int $limit){ @@ -41,7 +41,7 @@ class ListeGateway{ } public function getListePublic($offset,$limit){ - $query = "SELECT * FROM ToDoListe_Liste AND isPublic LIMITS $offset,$limit"; + $query = "SELECT * FROM ToDoListe_Liste AND estPublic LIMITS $offset,$limit"; $this->con->executeQuery($query); $results=$this->con->getResults(); return $results; diff --git a/src/Modele/ModeleUtilisateur.php b/src/Modele/ModeleUtilisateur.php new file mode 100644 index 0000000..f1a22f6 --- /dev/null +++ b/src/Modele/ModeleUtilisateur.php @@ -0,0 +1,28 @@ +AjouterUtilisateur(); + } + + + + + + + +} diff --git a/src/Modele/Tache.php b/src/Modele/Tache.php deleted file mode 100644 index 3a76aba..0000000 --- a/src/Modele/Tache.php +++ /dev/null @@ -1,47 +0,0 @@ -id = $id; - $this->nom = $nom; - $this->description = $description; - $this->dateCreation = $dateCreation; - $this->estValide = false; - } - - //Nom - public function getNom(){ - return $this->nom; - } - - //Id - public function getid(){ - return $this->id; - } - - //Description - public function getDescription(){ - return $this->description; - } - - //DateCreation - public function getDateCreation(){ - return $this->dateCreation; - } - - //EstValide - public function getEstValide(){ - return $this->estValide; - } - - -} diff --git a/src/Modele/UtilisateurGateway.php b/src/Modele/UtilisateurGateway.php index 7e708fc..fcd6e9c 100644 --- a/src/Modele/UtilisateurGateway.php +++ b/src/Modele/UtilisateurGateway.php @@ -1,11 +1,11 @@ con=$con; + public function __construct(){ + $this->con=new Connection($dsn,$user,$pass); } - public function CreerUtilisateur(string $nom,string $prenom, string $pseudo, string $email, string $mdp){ + public function AjouterUtilisateur(string $nom,string $prenom, string $pseudo, string $email, string $mdp){ $query='INSERT INTO ToDoList_Utilisateur(nom,prenom,pseudo,email,motDePasse) values (:nom,:prenom,:pseudo,:email,:mdp);'; $this->con->executeQuery($query, array( 'nom' => array($nom, PDO::PARAM_STRING), @@ -15,10 +15,18 @@ class UtilisateurGateway{ 'mdp' => array($mdp, PDO::PARAM_STRING))); } - public function Supprimer(Utilisateur $user){ + public function SupprimerUtilisateur(int $id){ $query='DELETE FROM ToDoList_Utilisateur WHERE id=:id;'; $this->con->executeQuery($query, array( - 'id' => array($user->getNom(), PDO::PARAM_STRING))); + 'id' => array($id, PDO::PARAM_STRING))); + } + + public function RechercheUtilisateurViaPseudo(string $pseudo){ + + } + + public function RechercheUtilisateurViaEmail(string $pseudo){ + } } ?> \ No newline at end of file diff --git a/src/Vue/css/home.css b/src/Vue/css/home.css deleted file mode 100644 index cfabfd4..0000000 --- a/src/Vue/css/home.css +++ /dev/null @@ -1,15 +0,0 @@ -.button-home{ - color: white; - background-color: transparent; - font-family: JetBrains Mono,Menlo,Droid Sans Mono,monospace; - border-color: transparent; - font-weight: 600; -} - -.button-home:hover{ - color: #6a52fd; -} - -.navbar-home{ - margin-left: 10%; -} \ No newline at end of file diff --git a/src/Vue/css/inscription.css b/src/Vue/css/inscription.css index 7baaa66..2830096 100644 --- a/src/Vue/css/inscription.css +++ b/src/Vue/css/inscription.css @@ -11,289 +11,3 @@ body::before { transform: rotate(-5deg); z-index: -1; } - -.form-redirection{ - margin-top: -25px; -} - -.main-logo{ - display: flex; - flex-direction: column; - margin-left: auto; - margin-right: auto; - align-items: center; -} - -.main-logo img{ - width: 50%; -} - -body fieldset { - box-shadow: 0 8px 10px #29a329; -} - -body.error { - background: #f04000; -} -body.error fieldset { - box-shadow: 0 8px 10px #bd3200; -} - -h2 { - position: absolute; - left: 50%; - transform: translateX(-50%); - font-family: sans-serif; - text-transform: uppercase; - letter-spacing: 2px; -} - -h1 { - color: white; - font-size: 100%; - /*transform: translateX(-50%);*/ - font-family: sans-serif; - text-transform: uppercase; -} - -h2 { - top: 44px; - color: white; - font-size: 10px; - opacity: 0.7; -} - -ul.items { - position: absolute; - width: 30px; - height: auto; - top: 50%; - left: -60px; - transform: translateY(-50%); -} -ul.items li { - width: 8px; - height: 8px; - margin: 10px 0; - background: white; - border-radius: 50%; - opacity: 0.4; - cursor: pointer; -} -ul.items li.active { - opacity: 1; -} - -form { - position: absolute; - width: 300px; - height: 60px; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); -} -form fieldset { - position: absolute; - width: 300px; - height: 60px; - background: white; - border-radius: 3px; - opacity: 0; - transform: scale(0.2); - transition: all 0.4s ease-in-out; -} -form fieldset input, form fieldset p { - display: inline-block; - width: 200px; - margin-left: 50px; - color: #333333; - font-size: 16px; - letter-spacing: 1px; -} -form fieldset p { - margin-top: 22px; - text-align: center; -} -form fieldset input { - height: 40px; - margin-top: 8px; - border: none; - outline: none; -} -form fieldset .icon { - position: absolute; - width: 30px; - height: 30px; - top: 15px; - transition: all 0.4s ease; -} -form fieldset .icon i { - position: absolute; - display: block; -} -form fieldset .icon i::before, form fieldset .icon i::after { - position: absolute; - content: ""; -} -form fieldset .icon.left { - left: 10px; -} -form fieldset .icon.right { - right: 10px; - cursor: pointer; -} -form fieldset .icon.button:hover { - background: #f2f2f2; - border-radius: 3px; - transition: all 0.4s ease; -} -form fieldset.enable { - z-index: 1; - opacity: 1; - transition: all 0.5s ease-out 0.2s; - transform: scale(1); - animation: enable 0.5s ease-out 0.2s; -} -form fieldset.disable { - opacity: 0; - transition: all 0.3s ease-in; - transform: translateY(120px) scale(0.9); -} - -body.error fieldset { - transform-origin: 50% 100%; - animation: error 0.3s ease-out; -} - -@keyframes enable { - 0% { - opacity: 0; - transform: scale(0.2); - } - 60% { - transform: scale(1.1); - } - 100% { - opacity: 1; - transform: scale(1); - } -} -@keyframes error { - 0%, 50%, 100% { - transform: rotate(0deg); - } - 25% { - transform: rotate(-3deg); - } - 75% { - transform: rotate(3deg); - } -} -/** - * * Icons in CSS, long as f**** - * */ -.icon .arrow { - width: 2px; - height: 17px; - top: 5px; - left: 14px; - background: #333333; -} -.icon .arrow::before { - width: 6px; - height: 6px; - bottom: -1px; - left: -3px; - border-color: #333333; - border-right: 2px solid; - border-bottom: 2px solid; - transform: rotate(45deg); -} - -.icon .user { - width: 20px; - height: 10px; - bottom: 5px; - left: 5px; - box-shadow: 0 0 0 2px #333333 inset; - border-radius: 6px 6px 3px 3px; -} -.icon .user::before { - width: 10px; - height: 10px; - top: -9px; - left: 5px; - box-shadow: 0 0 0 2px #333333 inset; - border-radius: 50%; -} - -.icon .letter { - width: 20px; - height: 12px; - top: 9px; - left: 5px; - box-shadow: 0 0 0 2px #333333 inset; - border-radius: 3px; -} -.icon .letter::before, .icon .letter::after { - width: 11px; - height: 2px; - top: 4px; - background: #333333; -} -.icon .letter::before { - left: 0; - transform: rotate(30deg); -} -.icon .letter::after { - right: 0; - transform: rotate(-30deg); -} - -.icon .lock { - width: 20px; - height: 16px; - top: 9px; - left: 5px; - box-shadow: 0 0 0 2px #333333 inset; - border-radius: 3px; -} -.icon .lock::before { - width: 8px; - height: 8px; - top: -4px; - left: 4px; - border: 2px solid transparent; - border-top: 2px solid #333333; - border-right: 2px solid #333333; - border-radius: 50%; - transform: rotate(-45deg); -} -.icon .lock::after { - width: 6px; - height: 7px; - top: 4px; - left: 7px; - box-shadow: 0 0 0 2px #333333 inset; -} - -.icon .heart { - width: 10px; - height: 10px; - top: 11px; - left: 7px; - background: #ff5233; - transform: rotate(45deg); -} -.icon .heart::before, .icon .heart::after { - width: 10px; - height: 10px; - border-radius: 50%; - background: #ff5233; -} -.icon .heart::before { - left: -6px; -} -.icon .heart::after { - top: -6px; -} \ No newline at end of file diff --git a/src/Vue/css/profil.css b/src/Vue/css/profil.css deleted file mode 100644 index d30f5c5..0000000 --- a/src/Vue/css/profil.css +++ /dev/null @@ -1,233 +0,0 @@ -@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;600;700&display=swap'); - -body { - font: 18px "Nunito", sans-serif; - color: black; - min-height: 100vh; - padding: 2rem; - display: flex; - justify-content: center; - align-items: center; -} - -body::before { - content: ''; - position: fixed; - inset: 0; - z-index: -1; - pointer-events: none; - background: url("../Images/Back(2).jpg") no-repeat center; - background-size: cover; - animation: backgroundZoomAnimate 20s forwards; -} - -@keyframes backgroundZoomAnimate { - from { - transform: scale(1); - } - to { - transform: scale(1.3); - } -} - -.profil-card { - box-shadow: 0 18px 200px -60px black; - border-radius: 50px; - width: 650px; - position: relative; - backdrop-filter: blur(15px); - border: 2px solid #ffffff40; - padding: 3rem 5rem; - display: flex; - flex-direction: column; - gap: 40px; - - @media screen and (max-width: 768px) { - width: auto; - } - -} - -.profil-card__img img { - margin: auto; - width: 200px; - height: 200px; - border-radius: 50%; - object-fit: cover; - display: block; - box-shadow: 0 10px 60px -10px rgba(13,28,39,.5); -} - -.profil-card__desc { - text-align: center; - display: flex; - flex-direction: column; - gap: 25px; - -} - -.localisation { - display: flex; - align-items:center; - gap:10px; - justify-content: center; -} - -.profil-card__desc h1 { - font-size: 2.5rem; - font-weight: bold; -} - -.profil-card__desc h1 + div { - font-size: 20px; -} - -.info{ - display: flex; - justify-content: center; - gap: 50px; - - @media screen and (max-width: 576px) { - gap: 30px; - } -} - -.info > div { - text-transform: uppercase; - font-weight: bold; - letter-spacing: 1px; - text-align: center; -} - -.info > div > *:first-child { - font-weight: bold; - letter-spacing: 3px; - font-size: 2rem; - margin-bottom: 15px; -} - -.info > div > *:last-child { - font-size: 16px; - opacity: .7; -} - -.social { - display: flex; - justify-content: center; - align-items: center; - flex-wrap: wrap; -} - -.social a { - display: inline-block; - width: 55px; - height: 55px; - margin: 15px; - border-radius: 40%; - align-items: center; - justify-content: center; - color: white; - position: relative; - flex-shrink: 0; - transition: all .2s; - - @media screen and (max-width: 768px) { - width: 50px; - height: 50px; - margin: 10px; - } -} - -@media screen and (min-width: 768px) { - .social a:hover { - transform: scale(1.2) translateY(-5px); - } -} - -.social a.facebook { - padding-top: 15px; - padding-left: 15px; - background: linear-gradient(45deg, #3b5998,#0078d7); - box-shadow: 0 4px 30px rgba(45, 98, 169, 1); -} - -.social a.twitter { - padding-top: 15px; - padding-left: 15px; - background: linear-gradient(45deg, #1da1f2,#0e71c8); - box-shadow: 0 4px 30px rgba(19, 127, 212, 1); -} - -.social a.instagram { - padding-top: 15px; - padding-left: 15px; - background: linear-gradient(45deg, #405de6,#5851db,#833ab4,#c13584,#e1306c,#fd1d1d); - box-shadow: 0 4px 30px rgba(120, 64, 190, 0.8); -} - -.social a.gitlab { - padding-top: 15px; - padding-left: 15px; - background: linear-gradient(45deg, #FF9467,#DB4100); - box-shadow: 0 4px 30px rgba(255,148,103, 0.6); -} - -.actions { - display: flex; - align-items: center; - justify-content: center; - gap: 2rem; - - @media screen and (max-width: 576px) { - flex-direction: column; - gap: 1.5rem; - } -} - -.actions > button { - font-weight: bold; - font-size: 22px; - padding: 15px 0; - min-width: 250px; - border-radius: 50px; - text-align: center; - color: white; - cursor: pointer; - transition: all .2s; - - @media screen and (max-width: 760px) { - min-width: 170px; - } - - @media screen and (max-width: 576px) { - min-width: inherit; - width: 100%; - max-width: 350%; - } -} - -@media screen and (min-width: 576px) { - .actions > button:hover { - transform: translateY(-5px); - } -} - -.bleu{ - background: linear-gradient(45deg, #1da1f2,#0e71c8); - box-shadow: 0 4px 30px rgba(19, 127, 212, 0.4); -} - -.bleu:hover { - box-shadow: 0 7px 30px rgba(19, 127, 212, 0.75); -} - - -.orange { - background: linear-gradient(45deg, #d5135a,#f05924); - box-shadow: 0 4px 30px rgba(223, 45, 70, 0.35); -} - - -.orange:hover { - box-shadow: 0 7px 30px rgba(223,45,70,0.75); -} diff --git a/src/Vue/css/style.css b/src/Vue/css/style.css index 0663188..ec3da44 100644 --- a/src/Vue/css/style.css +++ b/src/Vue/css/style.css @@ -211,16 +211,6 @@ body::before { accent-color: black; } -.model button { - background: #38b6ff; - color: white; - padding: 1rem; - border-radius: 100px; - text-transform: uppercase; - letter-spacing: 2px; - transition: background .5s; -} - .login-card-form button:hover { background-color: rgba(84,192,255,.85); cursor: pointer; @@ -270,6 +260,30 @@ body::before { /* Button */ +.mon-button{ + font-family: 'Poppins', sans-serif; + font-weight: bold; + border-color: transparent; + background-color: transparent; + color: #35339a; +} + +.mon-button:hover{ + text-decoration: underline 1px; +} + +.button-body{ + background: #38b6ff; + color: white; + padding: 1rem; + border-radius: 100px; + text-transform: uppercase; + letter-spacing: 2px; + transition: background .5s; +} + + + .button{ border-color: #38b6ff; height: 2rem; diff --git a/src/Vue/html/ListeVue.php b/src/Vue/html/ListeVue.php deleted file mode 100644 index 25a90a4..0000000 --- a/src/Vue/html/ListeVue.php +++ /dev/null @@ -1,9 +0,0 @@ -getNom(); - echo ("
"); - print $row->getDateCreation(); - echo ("
"); - } -?> diff --git a/src/Vue/html/NavBar.php b/src/Vue/html/NavBar.php new file mode 100644 index 0000000..e8bc2ac --- /dev/null +++ b/src/Vue/html/NavBar.php @@ -0,0 +1,21 @@ +
+ +
+ + + + + \ No newline at end of file diff --git a/src/Vue/html/index.html b/src/Vue/html/PageListePublic.php similarity index 65% rename from src/Vue/html/index.html rename to src/Vue/html/PageListePublic.php index 8a00d74..f457800 100644 --- a/src/Vue/html/index.html +++ b/src/Vue/html/PageListePublic.php @@ -6,7 +6,6 @@ Home Page - @@ -15,49 +14,28 @@ - -
+ - getNom(); - echo ("
"); - print $row->getDateCreation(); - echo ("
"); - } - ?> + diff --git a/src/Vue/html/erreur.php b/src/Vue/html/erreur.php new file mode 100644 index 0000000..ad8f691 --- /dev/null +++ b/src/Vue/html/erreur.php @@ -0,0 +1,18 @@ + +Erreur + + + + +

ERREUR !!!!!

+ + + + + \ No newline at end of file diff --git a/src/Vue/html/inscription.html b/src/Vue/html/inscription.html deleted file mode 100644 index e085aec..0000000 --- a/src/Vue/html/inscription.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - Page d'inscription - - - - - - - - - - -
- - -
-
- -
-
- - - -
-
- -
-
- -
-
-

Merci pour votre inscription

-
-
- -
- - - - \ No newline at end of file diff --git a/src/Vue/html/inscription.php b/src/Vue/html/inscription.php new file mode 100644 index 0000000..32c18e8 --- /dev/null +++ b/src/Vue/html/inscription.php @@ -0,0 +1,59 @@ + + + + + Page d'inscription + + + + + + + + + + + + + + +
+ +
+
+
+ + +
+
+
+
+ + +
+
+
+ + +
+ + +
+ + +
+ + +
+ + + + +
+ + + + \ No newline at end of file diff --git a/src/Vue/html/login.html b/src/Vue/html/login.php similarity index 91% rename from src/Vue/html/login.html rename to src/Vue/html/login.php index 7125ac2..80bb036 100644 --- a/src/Vue/html/login.html +++ b/src/Vue/html/login.php @@ -46,12 +46,16 @@ Oublie de mot de passe - +
diff --git a/src/Vue/html/profilARefaire.html b/src/Vue/html/profilARefaire.html deleted file mode 100644 index abc8b90..0000000 --- a/src/Vue/html/profilARefaire.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - Page Profil - - - - -
-
- Image Profil -
- -
-

Ritchie Golozer

-
front-end Developer
-
- - - - - - Clermont-Ferrand -
-
- - -
-
-
850
-
Followers
-
-
-
50
-
References
-
-
-
105
-
Works
-
-
- -
- -
-
- -
-
- - \ No newline at end of file diff --git a/src/Vue/javaScript/inscription.js b/src/Vue/javaScript/inscription.js deleted file mode 100644 index 93fb3f2..0000000 --- a/src/Vue/javaScript/inscription.js +++ /dev/null @@ -1,53 +0,0 @@ - -function init() { - // Generate li foreach fieldset - for (var i = 0; i < count; i++) { - var ul = document.querySelector("ul.items"), - li = document.createElement("li"); - - ul.appendChild(li); - } - // Add class active on first li - ul.firstChild.classList.add("active"); -} - -function next(target) { - var input = target.previousElementSibling; - - // Check if input is empty - if (input.value === "") { - body.classList.add("error"); - } else { - body.classList.remove("error"); - - var enable = document.querySelector("form fieldset.enable"), - nextEnable = enable.nextElementSibling; - enable.classList.remove("enable"); - enable.classList.add("disable"); - nextEnable.classList.add("enable"); - - // Switch active class on left list - var active = document.querySelector("ul.items li.active"), - nextActive = active.nextElementSibling; - active.classList.remove("active"); - nextActive.classList.add("active"); - } -} - -function keyDown(event) { - var key = event.keyCode, - target = document.querySelector("fieldset.enable .button"); - if (key == 13 || key == 9) next(target); -} - -var body = document.querySelector("body"), - form = document.querySelector("form"), - count = form.querySelectorAll("fieldset").length; - -window.onload = init; -document.body.onmouseup = function (event) { - var target = event.target || event.toElement; - if (target.classList.contains("button")) next(target); -}; -document.addEventListener("keydown", keyDown, false); - diff --git a/src/config/Connection.php b/src/config/Connection.php new file mode 100644 index 0000000..af422a3 --- /dev/null +++ b/src/config/Connection.php @@ -0,0 +1,31 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +} + + +/** * @param string $query + * @param array $parameters * + * @return bool Returns `true` on success, `false` otherwise +*/ + +public function executeQuery(string $query, array $parameters = []) : bool{ + $this->stmt = parent::prepare($query); + foreach ($parameters as $name => $value) { + $this->stmt->bindValue($name, $value[0], $value[1]); + } + + return $this->stmt->execute(); +} + +public function getResults() : array { + return $this->stmt->fetchall(); + +} +} diff --git a/src/config/SplClassLoader.php b/src/config/SplClassLoader.php deleted file mode 100755 index 378906e..0000000 --- a/src/config/SplClassLoader.php +++ /dev/null @@ -1,155 +0,0 @@ -. - */ - -/** - * SplClassLoader implementation that implements the technical interoperability - * standards for PHP 5.3 namespaces and class names. - * - * http://groups.google.com/group/php-standards/web/psr-0-final-proposal?pli=1 - * - * // Example which loads classes for the Doctrine Common package in the - * // Doctrine\Common namespace. - * $classLoader = new SplClassLoader('Doctrine\Common', '/path/to/doctrine'); - * $classLoader->register(); - * - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @author Jonathan H. Wage - * @author Roman S. Borschel - * @author Matthew Weier O'Phinney - * @author Kris Wallsmith - * @author Fabien Potencier - */ -class SplClassLoader -{ - private $_fileExtension = '.php'; - private $_namespace; - private $_includePath; - private $_namespaceSeparator = '\\'; - - /** - * Creates a new SplClassLoader that loads classes of the - * specified namespace. - * - * @param string $ns The namespace to use. - */ - public function __construct(string $ns = null, string $includePath = null) - { - $this->_namespace = $ns; - $this->_includePath = $includePath; - } - - /** - * Sets the namespace separator used by classes in the namespace of this class loader. - * - * @param string $sep The separator to use. - */ - public function setNamespaceSeparator(string $sep) - { - $this->_namespaceSeparator = $sep; - } - - /** - * Gets the namespace seperator used by classes in the namespace of this class loader. - * - * @return void - */ - public function getNamespaceSeparator() - { - return $this->_namespaceSeparator; - } - - /** - * Sets the base include path for all class files in the namespace of this class loader. - * - * @param string $includePath - */ - public function setIncludePath(string $includePath) - { - $this->_includePath = $includePath; - } - - /** - * Gets the base include path for all class files in the namespace of this class loader. - * - * @return string $includePath - */ - public function getIncludePath() - { - return $this->_includePath; - } - - /** - * Sets the file extension of class files in the namespace of this class loader. - * - * @param string $fileExtension - */ - public function setFileExtension($fileExtension) - { - $this->_fileExtension = $fileExtension; - } - - /** - * Gets the file extension of class files in the namespace of this class loader. - * - * @return string $fileExtension - */ - public function getFileExtension() - { - return $this->_fileExtension; - } - - /** - * Installs this class loader on the SPL autoload stack. - */ - public function register() - { - spl_autoload_register(array($this, 'loadClass')); - } - - /** - * Uninstalls this class loader from the SPL autoloader stack. - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - } - - /** - * Loads the given class or interface. - * - * @param string $className The name of the class to load. - * @return void - */ - public function loadClass(string $className) - { - if (null === $this->_namespace || $this->_namespace.$this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace.$this->_namespaceSeparator))) { - $fileName = ''; - $namespace = ''; - if (false !== ($lastNsPos = strripos($className, $this->_namespaceSeparator))) { - $namespace = substr($className, 0, $lastNsPos); - $className = substr($className, $lastNsPos + 1); - $fileName = str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; - } - $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->_fileExtension; - - require ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName; - } - } -} \ No newline at end of file diff --git a/src/config/Validation.php b/src/config/Validation.php index e398a10..2df0bd8 100755 --- a/src/config/Validation.php +++ b/src/config/Validation.php @@ -4,36 +4,81 @@ namespace config; class Validation { - static function val_action($action) { - - if (!isset($action)) { - throw new Exception('pas d\'action'); - //on pourrait aussi utiliser -//$action = $_GET['action'] ?? 'no'; - // This is equivalent to: - //$action = if (isset($_GET['action'])) $action=$_GET['action'] else $action='no'; - } - } - - static function val_form(string &$nom, string &$age, &$dVueEreur) { + static function val_form_user(string &$nom, string &$prenom, string &$pseudo, string &$mdp, string &$email, &$dVueEreur) { + int $i=0; + //Vérification Nom if (!isset($nom)||$nom=="") { $dVueEreur[] = "pas de nom"; $nom=""; + $i++; + } + + val_string($Nom,$i,$dVueEreur); + + //Vérification Prenom + if (!isset($prenom)||$prenom=="") { + $dVueEreur[] = "pas de prenom"; + $pseudo=""; + $i++; + } + + val_string($prenom,$i,$dVueEreur); + + //Vérification Email + if (!isset($email)||$email=="") { + $dVueEreur[] = "pas de email"; + $pseudo=""; + $i++; } - if ($nom != filter_var($nom, FILTER_SANITIZE_STRING)) + if ($email != filter_var($email, FILTER_SANITIZE_STRING)) { $dVueEreur[] = "testative d'injection de code (attaque sécurité)"; $nom=""; + $i++; + } + + val_string($email,$i,$dVueEreur); + //Vérification Pseudo + if (!isset($pseudo)||$pseudo=="") { + $dVueEreur[] = "pas de pseudo"; + $pseudo=""; + $i++; } - if (!isset($age)||$age==""||!filter_var($age, FILTER_VALIDATE_INT)) { - $dVueEreur[] = "pas d'age "; - $age=0; + val_string($pseudo,$i,$dVueEreur); + + //Vérification Mot de Passe + if (!isset($mdp)||$mdp=="") { + $dVueEreur[] = "pas de mot de passe"; + $mdp=""; + $i++; + } + + val_string($mdp,$i,$dVueEreur); + + + if (!preg_match('/^.{5,}$/', $mdp)) { + $dVueEreur[] = "Mot de passe trop léger : Plus de 5 caractères minimum !"; + $i++; } + if($i>0){ + return false; + } + return true; + + } + + static function val_string(string &$str, int &$i ,&$dVueEreur) { + if ($str != filter_var($str, FILTER_SANITIZE_STRING)) + { + $dVueEreur[] = "tentative d'injection de code (attaque sécurité)"; + $str=""; + $i++; + } } } diff --git a/src/config/config.php b/src/config/config.php index 32b4fd5..810ba15 100755 --- a/src/config/config.php +++ b/src/config/config.php @@ -3,24 +3,17 @@ //gen $rep=__DIR__.'/../'; -// liste des modules à inclure - -//$dConfig['includes']= array('controleur/Validation.php'); - - - //BD -$base="dbrahassou"; -$login="rahassou"; -$mdp="achanger"; - +$user= 'rahassou'; +$pass='achanger'; +$dsn='mysql:host=londres.uca.local;dbname=dbrahassou'; //Vues -$vues['inscription']='Vue/html/inscription.html'; -$vues['Home']='Vue/html/index.html'; -$vues['login']='Vue/html/login.html'; -$vues['profil']='Vue/html/profil.html'; +$vues['erreur']='vues/erreur.php'; +$vues['inscription']='Vue/html/inscription.php'; +$vues['ListPublic']='Vue/html/PageListPublic.php'; +$vues['login']='Vue/html/login.php'; $vues['listeVue']='Vue/html/ListeVue.php'; ?> diff --git a/src/index.php b/src/index.php index a48c9ee..6c58727 100755 --- a/src/index.php +++ b/src/index.php @@ -7,23 +7,11 @@ //chargement config require_once(__DIR__.'/config/config.php'); -//autolarder du cours //chargement autoloader pour autochargement des classes -//require_once(__DIR__.'/config/Autoload.php'); -//Autoload::charger(); +require_once(__DIR__.'/config/Autoload.php'); +Autoload::charger(); - -//autoloader conforme norme PSR-0 -require_once(__DIR__.'/config/SplClassLoader.php'); -$myLibLoader = new SplClassLoader('Controller', './'); -$myLibLoader->register(); -$myLibLoader = new SplClassLoader('config', './'); -$myLibLoader->register(); -$myLibLoader = new SplClassLoader('Modele', './'); -$myLibLoader->register(); - - -$cont = new \Controller\Controleur(); +$cont = new FrontControleur(); ?> \ No newline at end of file