diff --git a/config/config.php b/config/config.php index 93fc1eb..3cc6311 100644 --- a/config/config.php +++ b/config/config.php @@ -12,10 +12,12 @@ $base = ''; $login = ''; $mdp = ''; -$racine='/~kemondejar/WF-Website'; // /~kekentin/WF/WF-Website + +$racine='/~lebeaulato/WF-Website'; // /~kekentin/WF/WF-Website /~lebeaulato/WF-Website /~kemondejar/WF-Website //$racine='/WF-Website'; + //Vues $vues['erreur'] = 'vue/erreur.php'; $vues['accueil'] = 'vue/accueil.php'; diff --git a/index.php b/index.php index 33bc65b..3bc9649 100644 --- a/index.php +++ b/index.php @@ -15,7 +15,7 @@ if(!isset($_SESSION['theme'])){ require_once __DIR__ . '/config/config.php'; require __DIR__ . '/vendor/autoload.php'; -//$co = new \Gateway\Connection('pgsql:host=localhost;dbname=postgres;', 'postgres', 'sucepute'); +//$co = new \Gateway\Connection('pgsql:host=localhost;dbname=wikifantasy3;', 'postgres', 'postgres'); $co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd'); //twig diff --git a/public/styles/style.css b/public/styles/style.css index c265563..76d9ab8 100644 --- a/public/styles/style.css +++ b/public/styles/style.css @@ -6,13 +6,13 @@ --main-dark-gradient : linear-gradient(45deg, #4a148c, #7b1fa2); --main-dark-other-color : #000000; - --main-light-background-color: #ffffff; + --main-light-background-color: #cccccc; /*--main-light-background-color: #ffffff;*/ - --main-light-text-color : #000000; - --main-light-gradient : linear-gradient(90deg, #78b3eb, #64c1ff); + --main-light-text-color : #000; + --main-light-gradient : linear-gradient(90deg, #46BE73, #BAEBF6); /*--main-light-gradient : linear-gradient(-90deg, #f3e0f7, #dd9aff);*/ /*--main-light-gradient : linear-gradient(45deg, #73CFF6, #DE95CA);*/ - --main-light-other-color : #f8eaff; + --main-light-other-color : #46BE73; /*--main-light-other-color : #f8eaff;*/ /*--main-light-other-color : #d2d2d8;*/ } diff --git a/src/Controleur/VisitorControler.php b/src/Controleur/VisitorControler.php index 99589af..0b57488 100644 --- a/src/Controleur/VisitorControler.php +++ b/src/Controleur/VisitorControler.php @@ -131,6 +131,7 @@ Class VisitorControler { { $_SESSION['user'] = Verification::verifChar($pseudo); $_SESSION['role'] = 'user'; + //$this->sendEmailLogin($pseudo,$this->uMod->getEmailWithUser($pseudo)); Envoie un email pour chaque connexion header("Location: ". $racine); exit(); }else @@ -195,6 +196,7 @@ Class VisitorControler { exit(); } else echo $this->uMod->insertUser($pseudo, $email, $hmdp); + $this->sendEmailSignin($pseudo,$email); $_SESSION["role"] = Verification::verifChar('user'); $_SESSION["user"] = Verification::verifChar($pseudo); @@ -202,4 +204,38 @@ Class VisitorControler { header("Location: ". $racine); } } + + public function sendEmailSignin(string $pseudo, string $email) : void{ + $to = $email; // Adresse email de destination + $subject = "What The Fantasy - Création de compte"; // Sujet de l'email + $message = " + Bonjour $pseudo, + + Merci de vous être inscrit sur notre site What The Fantasy. C’est avec grande joie que nous vous accueillons au sein de notre confrérie, pour découvrir ensemble... + + À bientôt ! + L'équipe du site + "; // Contenu de l'email + $headers = "From: noreply@whatTheFantasy.com"; // Adresse email de l'expéditeur + + // Envoyer l'email + mail($to, $subject, $message, $headers); + } + + public function sendEmailLogin(string $pseudo, string $email) : void{ + $to = $email; // Adresse email de destination + $subject = "What The Fantasy - Connexion à votre compte"; // Sujet de l'email + $message = " + Bonjour $pseudo, + + Nous avons détecté une connexion à votre compte $pseudo. Si cela vient de vous, vous pouvez ignorer ce message. Sinon, nous vous conseillons de changer votre mot de passe. + + + L'équipe du site + "; // Contenu de l'email + $headers = "From: noreply@whatTheFantasy.com"; // Adresse email de l'expéditeur + + // Envoyer l'email + mail($to, $subject, $message, $headers); + } } \ No newline at end of file diff --git a/src/Gateway/UserGateway.php b/src/Gateway/UserGateway.php index cee829e..27076f2 100644 --- a/src/Gateway/UserGateway.php +++ b/src/Gateway/UserGateway.php @@ -200,5 +200,11 @@ Class UserGateway extends Gateway{ $query = 'UPDATE Users SET password=:newPassWd WHERE username=:username'; $this->co->executeQuery($query, array(':username'=>array($username, PDO::PARAM_STR), ':newPassWd'=> array($newPassWd, PDO::PARAM_STR))); } + + public function emailWithUser(string $user):array{ + $query = 'SELECT email FROM Users WHERE username = :user'; + $this->co->executeQuery($query, array(':user'=>array($user, PDO::PARAM_STR))); + return $this->co->getResults(); + } } ?> diff --git a/src/Model/UserModel.php b/src/Model/UserModel.php index 28f0c23..0c38d21 100644 --- a/src/Model/UserModel.php +++ b/src/Model/UserModel.php @@ -85,6 +85,11 @@ return $res[0]['id_user']; } + public function getEmailWithUser(string $user){ + $res = $this->gateway->emailWithUser($user); + return $res[0]['email']; + } + // ===================== Bool FUNCTION ===================== public function IsExisteUsername(string $username):bool{