diff options
| author | Debulois <quentin@debulois.fr> | 2022-03-24 19:30:30 +0100 |
|---|---|---|
| committer | Debulois <quentin@debulois.fr> | 2022-03-24 19:30:30 +0100 |
| commit | c9d4c87b21f1050a780f5296961d24bd17c9cdc8 (patch) | |
| tree | 38f8b221d21ec7642ee031c906599058a75e5fac /Database | |
| parent | f66e40340d62b5c694093bc6d10f99337382d12a (diff) | |
Grosse mise à jour, principalement changement du système des missions et de "mes missions".
Diffstat (limited to 'Database')
| -rw-r--r-- | Database/dbmain.php | 17 | ||||
| -rw-r--r-- | Database/meth_dbadmin.php | 56 | ||||
| -rw-r--r-- | Database/meth_dbmission.php | 147 | ||||
| -rw-r--r-- | Database/meth_dbsearch.php | 104 | ||||
| -rw-r--r-- | Database/meth_dbuser.php | 90 |
5 files changed, 300 insertions, 114 deletions
diff --git a/Database/dbmain.php b/Database/dbmain.php index 262c55a..1f1ac24 100644 --- a/Database/dbmain.php +++ b/Database/dbmain.php @@ -32,9 +32,7 @@ class DbMain { `password` VARCHAR(128) NOT NULL, `tokenAutoLogin` VARCHAR(128) NULL DEFAULT NULL, `inscriptionDate` TIMESTAMP NOT NULL, - `isClient` TINYINT(1) NOT NULL, - `isPro` TINYINT(1) NOT NULL, - `isAdmin` TINYINT(1) NOT NULL, + `userStatus` TINYINT(1) UNSIGNED NOT NULL, PRIMARY KEY (`userId`) ) ENGINE = InnoDB @@ -48,7 +46,6 @@ class DbMain { `adress` VARCHAR(128) NOT NULL, `zipCode` VARCHAR(6) NOT NULL, `city` VARCHAR(128) NOT NULL, - `job` VARCHAR(128) NULL DEFAULT NULL, `degree` VARCHAR(128) NULL DEFAULT NULL, `capability` TEXT NULL DEFAULT NULL, `description` TEXT NULL DEFAULT NULL, @@ -83,12 +80,12 @@ class DbMain { CONSTRAINT `fk_userJob_userId` FOREIGN KEY (`userId`) REFERENCES `alphajob`.`userAccount` (`userId`) - ON DELETE NO ACTION + ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_userJob_jobCategoryId` FOREIGN KEY (`jobCategoryId`) REFERENCES `alphajob`.`jobCategory` (`jobCategoryId`) - ON DELETE NO ACTION + ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE = InnoDB @@ -99,7 +96,7 @@ class DbMain { `missionId` INT UNSIGNED NOT NULL AUTO_INCREMENT, `date` TIMESTAMP NOT NULL, `subject` VARCHAR(128) NULL DEFAULT NULL, - `note` INT UNSIGNED NULL DEFAULT NULL, + `note` TINYINT(1) UNSIGNED NULL DEFAULT NULL, `review` TEXT NULL DEFAULT NULL, `acceptedByPro` TIMESTAMP NULL DEFAULT NULL, `validatedByClient` TIMESTAMP NULL DEFAULT NULL, @@ -114,17 +111,17 @@ class DbMain { CONSTRAINT `fk_mission_clientId` FOREIGN KEY (`clientId`) REFERENCES `alphajob`.`userAccount` (`userId`) - ON DELETE NO ACTION + ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_mission_proId` FOREIGN KEY (`proId`) REFERENCES `alphajob`.`userAccount` (`userId`) - ON DELETE NO ACTION + ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_mission_jobCategoryId` FOREIGN KEY (`jobCategoryId`) REFERENCES `alphajob`.`jobCategory` (`jobCategoryId`) - ON DELETE NO ACTION + ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE = InnoDB diff --git a/Database/meth_dbadmin.php b/Database/meth_dbadmin.php index 883063b..112bce1 100644 --- a/Database/meth_dbadmin.php +++ b/Database/meth_dbadmin.php @@ -11,7 +11,11 @@ class DbAdmin extends DbMain { // Récupérer toutes les infos de la table userAccount final public function get_all_users_account() { - $reqGetAll = "SELECT * FROM ".$this->tableUserAccount; + $reqGetAll = " + SELECT + * + FROM + ".$this->tableUserAccount; // https://www.php.net/manual/fr/pdostatement.fetch.php // "PDO::FETCH_ASSOC: retourne un tableau indexé // par le nom de la colonne comme retourné dans le jeu de résultats" @@ -24,7 +28,14 @@ class DbAdmin extends DbMain { final public function user_del($userId) { // Préparation de la requète pour voir si l'utilisateur existe // https://stackoverflow.com/questions/1676551/best-way-to-test-if-a-row-exists-in-a-mysql-table - $reqCheckExistId = "SELECT EXISTS(SELECT 1 FROM ".$this->tableUserAccount." WHERE userId = ? LIMIT 1)"; + $reqCheckExistId = " + SELECT EXISTS( + SELECT 1 FROM + ".$this->tableUserAccount." + WHERE + userId = ? + LIMIT 1 + )"; // Exécution de la requète, fetchall pour avoir le résultat // https://www.php.net/manual/fr/pdostatement.fetch.php // struct par défaut req et index (fetch_both) = arr([0] => arr("req" => BOOL, [0] => BOOL)) @@ -48,20 +59,36 @@ class DbAdmin extends DbMain { // Ajout d'une categorie final public function job_category_register($jobCategoryNameEn, $jobCategoryNameFr) { // Préparation et execution de la requète pour voir si la categorie existe en anglais - $reqCheckjobCategoryNameEn = "SELECT EXISTS(SELECT 1 FROM ".$this->tableJobCategory." WHERE jobCategoryNameEn = ? LIMIT 1)"; + $reqCheckjobCategoryNameEn = " + SELECT EXISTS( + SELECT 1 FROM + ".$this->tableJobCategory." + WHERE + jobCategoryNameEn = ? + LIMIT 1 + )"; $reqResultEn = $this->exec_cmd($reqCheckjobCategoryNameEn, array($jobCategoryNameEn))->fetchAll(PDO::FETCH_NUM); // Si il n'existe pas en anglais if (!$reqResultEn[0][0]) { // Préparation et execution de la requète pour voir si la categorie existe en Français - $reqCheckjobCategoryNameFr = "SELECT EXISTS(SELECT 1 FROM ".$this->tableJobCategory." WHERE jobCategoryNameFr = ? LIMIT 1)"; + $reqCheckjobCategoryNameFr = " + SELECT EXISTS( + SELECT 1 FROM + ".$this->tableJobCategory." + WHERE + jobCategoryNameFr = ? + LIMIT 1 + )"; $reqResultFr = $this->exec_cmd($reqCheckjobCategoryNameFr, array($jobCategoryNameFr))->fetchAll(PDO::FETCH_NUM); // Si il n'existe pas en Français non plus if (!$reqResultFr[0][0]) { // Préparation de la requète pour l'ajout - $reqjobCategoryNameAdd = "INSERT INTO ".$this->tableJobCategory." - (jobCategoryNameEn, jobCategoryNameFr) + $reqjobCategoryNameAdd = " + INSERT INTO + ".$this->tableJobCategory." + (jobCategoryNameEn, jobCategoryNameFr) VALUES - (? ,?)"; + (? ,?)"; // Exécution de la requète $this->exec_cmd($reqjobCategoryNameAdd, array($jobCategoryNameEn, $jobCategoryNameFr)); // Retourne 1 pour réussite @@ -79,7 +106,14 @@ class DbAdmin extends DbMain { // Suppresion d'un utilisateur final public function job_category_del($jobCategoryId) { // Préparation de la requète pour voir si l'utilisateur existe - $reqCheckExistId = "SELECT EXISTS(SELECT 1 FROM ".$this->tableJobCategory." WHERE jobCategoryId = ? LIMIT 1)"; + $reqCheckExistId = " + SELECT EXISTS( + SELECT 1 FROM + ".$this->tableJobCategory." + WHERE + jobCategoryId = ? + LIMIT 1 + )"; // Exécution de la requète, fetchall pour avoir le résultat // struct par défaut req et index (fetch_both) = arr([0] => arr("req" => BOOL, [0] => BOOL)) // fetch_num pour casser l'index "req" en chiffre, dict -> list @@ -87,7 +121,11 @@ class DbAdmin extends DbMain { // Si il existe if ($reqResult[0][0]) { // Préparation de la requète pour suppression - $reqDelJobCategory = "DELETE FROM ".$this->tableJobCategory." WHERE jobCategoryId = ?"; + $reqDelJobCategory = " + DELETE FROM + ".$this->tableJobCategory." + WHERE + jobCategoryId = ?"; // Exécution de la requète $this->exec_cmd($reqDelJobCategory, array($jobCategoryId)); // Retourne 1 pour réussite diff --git a/Database/meth_dbmission.php b/Database/meth_dbmission.php index f39f0b6..92f8690 100644 --- a/Database/meth_dbmission.php +++ b/Database/meth_dbmission.php @@ -12,48 +12,125 @@ require_once(dirname( __FILE__ )."/dbmain.php"); class DbMission extends DbMain { // Enregistrement d'une mission - final public function register_mission($subject, $note, $review, $clientId, $proId) { - // Vérification de l'existance de l'id de consultant - $exist = $this->check_exist_pro($proId); - // Si il existe - if ($exist) { - // Préparation de la requète pour enregistrement de la mission - $reqAddMission = "INSERT INTO ".$this->tableMission." - (date, subject, note, review, clientId, proId) - VALUES (?, ?, ?, ?, ?, ?)"; - // Exécution de la requète - $this->exec_cmd($reqAddMission, - array(date("Y-m-d H:i:s"), $subject, - $note, $review, - $clientId, $proId - ) - ); - // Retourne 1 pour réussite - return 1; - } else { - // Retourne 0 pour échec - return 0; - } + final public function register_mission($subject, $clientId, $proId, $jobId) { + // Préparation de la requète pour enregistrement de la mission + $reqAddMission = " + INSERT INTO ".$this->tableMission." + (date, subject, clientId, proId, jobCategoryId) + VALUES + (?, ?, ?, ?, ?)"; + // Exécution de la requète + $this->exec_cmd($reqAddMission, array(date("Y-m-d H:i:s"), $subject, $clientId, $proId, $jobId)); + return 1; + } + + // Enregistrement d'une mission + final public function accept_mission($missionId) { + // Préparation de la requète pour enregistrement de la mission + $reqAddMission = " + UPDATE + ".$this->tableMission." + SET + acceptedByPro = ? + WHERE + missionId = ?"; + // Exécution de la requète + $this->exec_cmd($reqAddMission, array(date("Y-m-d H:i:s"), $missionId)); + return 1; + } + + final public function validate_mission_by_pro($missionId) { + // Préparation de la requète pour enregistrement de la mission + $reqAddMission = " + UPDATE + ".$this->tableMission." + SET + validatedByPro = ? + WHERE + missionId = ?"; + // Exécution de la requète + $this->exec_cmd($reqAddMission, array(date("Y-m-d H:i:s"), $missionId)); + return 1; + } + + final public function validate_mission_by_client($missionId) { + // Préparation de la requète pour enregistrement de la mission + $reqAddMission = " + UPDATE + ".$this->tableMission." + SET + validatedByClient = ? + WHERE + missionId = ?"; + // Exécution de la requète + $this->exec_cmd($reqAddMission, array(date("Y-m-d H:i:s"), $missionId)); + return 1; + } + + final public function review_mission($missionId, $review, $note) { + // Préparation de la requète pour enregistrement de la mission + $reqAddMission = " + UPDATE + ".$this->tableMission." + SET + review = ?, note = ? + WHERE + missionId = ?"; + // Exécution de la requète + $this->exec_cmd($reqAddMission, array($review, $note, $missionId)); + return 1; } // Récupérations des missions d'un pro par son id - final public function get_mission_by_id($id) { - $reqGetAllMission = "SELECT subject, note, review, lastname FROM ".$this->tableMission." - LEFT JOIN ".$this->tableUserInfo." - ON ".$this->tableMission.".missionId = ".$this->tableUserInfo.".userId - WHERE proId = ?"; - $result = $this->exec_cmd($reqGetAllMission, array($id))->fetchAll(PDO::FETCH_ASSOC); + final public function get_mission_by_pro_id($proId) { + $reqGetAllMission = " + SELECT + missionId, date, subject, note, review, + acceptedByPro, validatedByClient, + validatedByPro, jobCategoryId, proId, lastname + FROM + ".$this->tableMission." + LEFT JOIN + ".$this->tableUserInfo." + ON + ".$this->tableMission.".proId = ".$this->tableUserInfo.".userId + WHERE + proId = ?"; + $result = $this->exec_cmd($reqGetAllMission, array($proId))->fetchAll(PDO::FETCH_ASSOC); return $result; } - // Compte le nombre de mission d'un consultant par son nom - final public function count_pro_missions_by_lastname($name) { - $reqCountMission = "SELECT COUNT(*) FROM ".$this->tableMission." - INNER JOIN ".$this->tableUserInfo." - ON ".$this->tableMission.".proId = ".$this->tableUserInfo.".userId - WHERE lastname = ?"; - $result = $this->exec_cmd($reqCountMission, array($name))->fetchAll(PDO::FETCH_ASSOC); + // Récupérations des missions d'un client par son id + final public function get_mission_by_client_id($clientId) { + $reqGetAllMission = " + SELECT + missionId, date, subject, note, review, + acceptedByPro, validatedByClient, + validatedByPro, jobCategoryId, lastname + FROM + ".$this->tableMission." + LEFT JOIN + ".$this->tableUserInfo." + ON + ".$this->tableMission.".proId = ".$this->tableUserInfo.".userId + WHERE + clientId = ?"; + $result = $this->exec_cmd($reqGetAllMission, array($clientId))->fetchAll(PDO::FETCH_ASSOC); return $result; } + // Compte le nombre de mission d'un consultant par son nom + final public function count_pro_missions_by_id($proId) { + $reqCountMission = " + SELECT COUNT(*) FROM + ".$this->tableMission." + INNER JOIN + ".$this->tableUserInfo." + ON + ".$this->tableMission.".proId = ".$this->tableUserInfo.".userId + WHERE + proId = ?"; + $result = $this->exec_cmd($reqCountMission, array($proId))->fetchAll(PDO::FETCH_NUM); + return $result; + } }
\ No newline at end of file diff --git a/Database/meth_dbsearch.php b/Database/meth_dbsearch.php index 5104d15..7557583 100644 --- a/Database/meth_dbsearch.php +++ b/Database/meth_dbsearch.php @@ -13,58 +13,108 @@ class DbSearch extends DbMain { // Récupération des infos d'un compte par son id final public function get_user_account_by_id($id) { - $reqSearchUser = "SELECT userId, email, inscriptionDate, isClient, isPro, isAdmin - FROM ".$this->tableUserAccount." WHERE userId = ?"; + $reqSearchUser = " + SELECT + userId, email, inscriptionDate, userStatus + FROM + ".$this->tableUserAccount." + WHERE + userId = ?"; $result = $this->exec_cmd($reqSearchUser, array($id))->fetch(PDO::FETCH_ASSOC); return $result; } // Récupération des infos d'un utilisateur par son id final public function get_user_info_by_id($id) { - $reqGetUserInfo = "SELECT lastname, firstname, job, degree, - capability, description, phoneNumber, - adress, zipCode, city - FROM ".$this->tableUserInfo." WHERE userId = ?"; + $reqGetUserInfo = " + SELECT + userId, lastname, firstname, degree, + capability, description, phoneNumber, + adress, zipCode, city + FROM + ".$this->tableUserInfo." + WHERE + userId = ?"; $result = $this->exec_cmd($reqGetUserInfo, array($id))->fetchAll(PDO::FETCH_ASSOC); return $result; } // Récupération des infos d'un pro par son nom final public function get_pro_info_by_lastname($research) { - $reqSearchConsultant = "SELECT ".$this->tableUserInfo.".userId, lastname, firstname, job, capability - FROM ".$this->tableUserInfo." - INNER JOIN ".$this->tableUserAccount." - ON ".$this->tableUserInfo.".userId = ".$this->tableUserAccount.".userId - WHERE isPro = '1' AND lastname LIKE CONCAT('%', ?, '%')"; + $reqSearchConsultant = " + SELECT + ".$this->tableUserInfo.".userId, + lastname, firstname, capability + FROM + ".$this->tableUserInfo." + INNER JOIN + ".$this->tableUserAccount." + ON + ".$this->tableUserInfo.".userId = ".$this->tableUserAccount.".userId + WHERE + userStatus = '1' + AND + lastname LIKE CONCAT('%', ?, '%')"; $result = $this->exec_cmd($reqSearchConsultant, array($research))->fetchAll(PDO::FETCH_ASSOC); return $result; } // Récupération des emploies associés à un pro - final public function get_pro_job_category($id) { - $reqGetAll = "SELECT jobCategoryId FROM ".$this->tableUserJob." WHERE userId = ?"; - $result = $this->exec_cmd($reqGetAll, array($id))->fetchAll(PDO::FETCH_NUM); - $proJobs = []; - for ($i = 0; $i < count($result); $i++) { - array_push($proJobs, $result[$i][0]); - } - return $proJobs; + final public function get_pro_job_category($proId) { + $reqGetAll = " + SELECT + ".$this->tableUserJob.".jobCategoryId, + jobCategoryNameEn, jobCategoryNameFr + FROM + ".$this->tableUserJob." + INNER JOIN + ".$this->tableJobCategory." + ON + ".$this->tableUserJob.".jobCategoryId = ".$this->tableJobCategory.".jobCategoryId + WHERE + userId = ?"; + $result = $this->exec_cmd($reqGetAll, array($proId))->fetchAll(PDO::FETCH_ASSOC); + return $result; } // Récupération des notes d'un consultant par son nom - final public function get_pro_note_by_lastname($name) { - $reqCountMission = "SELECT note FROM ".$this->tableMission." - INNER JOIN ".$this->tableUserInfo." - ON ".$this->tableMission.".proId = ".$this->tableUserInfo.".userId - WHERE lastname = ?"; - $result = $this->exec_cmd($reqCountMission, array($name))->fetchAll(PDO::FETCH_ASSOC); + final public function get_pro_note_by_id($proId) { + $reqCountMission = " + SELECT + note + FROM + ".$this->tableMission." + INNER JOIN + ".$this->tableUserInfo." + ON + ".$this->tableMission.".proId = ".$this->tableUserInfo.".userId + WHERE + proId = ?"; + $result = $this->exec_cmd($reqCountMission, array($proId))->fetchAll(PDO::FETCH_NUM); return $result; } // Récupérer toutes les infos de la table jobCategory final public function get_job_category_all() { - $reqGetAll = "SELECT * FROM ".$this->tableJobCategory; - $result = $this->exec_cmd($reqGetAll, array())->fetchAll(PDO::FETCH_ASSOC); + $reqGetAllJobs = " + SELECT + * + FROM + ".$this->tableJobCategory; + $result = $this->exec_cmd($reqGetAllJobs, array())->fetchAll(PDO::FETCH_ASSOC); + return $result; + } + + // Récupérer toutes les infos de la table jobCategory + final public function get_job_category_by_id($jobId) { + $reqGetJobinfo = " + SELECT + * + FROM + ".$this->tableJobCategory." + WHERE + jobCategoryId = ?"; + $result = $this->exec_cmd($reqGetJobinfo, array($jobId))->fetchAll(PDO::FETCH_ASSOC); return $result; } } diff --git a/Database/meth_dbuser.php b/Database/meth_dbuser.php index 1b62b46..ea5c66e 100644 --- a/Database/meth_dbuser.php +++ b/Database/meth_dbuser.php @@ -12,9 +12,8 @@ class DbUser extends DbMain { // **************************************************************************** // Gestion d'un utilisateur // **************************************************************************** - // Enregistrement d'un nouvel utilisateur - final public function user_register($email, $pass, $is_client, $is_pro, $is_admin) { + final public function user_register($email, $pass, $userStatus) { // On vérifie si l'email existe deja dans la bdd $exist = $this->check_exist_email($email); // Si non @@ -22,18 +21,18 @@ class DbUser extends DbMain { // Chiffrement du pass $crypt = $this->crypt_pass($pass); // Préparation de la requète - $reqAddUser = "INSERT INTO ".$this->tableUserAccount." - (email, password, inscriptionDate, isClient, isPro, isAdmin) + $reqAddUser = " + INSERT INTO + ".$this->tableUserAccount." + (email, password, inscriptionDate, userStatus) VALUES - (?, ?, ?, ?, ?, ?)"; + (?, ?, ?, ?)"; // Execution de la requète $this->exec_cmd($reqAddUser, array($email, $crypt, date("Y-m-d H:i:s"), - $is_client, - $is_pro, - $is_admin + $userStatus ) ); // Retourne 1 pour réussite @@ -47,8 +46,13 @@ class DbUser extends DbMain { // Vérification de la combinaison email - pass pour authentification final public function user_check_credential($email, $pass) { // Préparation de la requète pour récupérer les infos ou l'email est présent - $reqCheckCredential = "SELECT userId, password - FROM ".$this->tableUserAccount." WHERE email = ? "; + $reqCheckCredential = " + SELECT + userId, password + FROM + ".$this->tableUserAccount." + WHERE + email = ? "; // Chiffrement du mot de passe $crypt = $this->crypt_pass($pass); // Execution de la requète @@ -67,24 +71,30 @@ class DbUser extends DbMain { // J'ai préféré faire deux requètes distinctes et ne pas utiliser des valeurs // passées par $POST ($key => $value) pour gérer les noms des colonnes // car je préfère les passer en "dur" dans mes requêtes (risque d'injection SQL?). - $reqAddInfoClient = "UPDATE ".$this->tableUserInfo." - SET - lastname = ?, firstname = ?, phoneNumber = ?, - adress = ?, zipCode = ?, city = ? - WHERE - userId = ?"; - $reqAddInfoPro = "UPDATE ".$this->tableUserInfo." - SET - lastname = ?, firstname = ?, phoneNumber = ?, - adress = ?, zipCode = ?, city = ?, - degree = ?, capability = ?, description = ? - WHERE - userId = ?"; - $reqAddInfoProJobs = "INSERT INTO ".$this->tableUserJob." + $reqAddInfoClient = " + REPLACE INTO + ".$this->tableUserInfo." + (lastname, firstname, phoneNumber, + adress, zipCode, city, userId) + VALUES + (?, ?, ?, ?, ?, ?, ?)"; + $reqAddInfoPro = " + REPLACE INTO + ".$this->tableUserInfo." + (lastname, firstname, phoneNumber, + adress, zipCode, city, degree, + capability, description, userId) + VALUES + (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + $reqAddInfoProJobs = " + INSERT INTO + ".$this->tableUserJob." (jobCategoryId, userId) VALUES (?, ?)"; - $reqRemoveInfoProJobs = "DELETE FROM ".$this->tableUserJob." + $reqRemoveInfoProJobs = " + DELETE FROM + ".$this->tableUserJob." WHERE jobCategoryId = ? AND @@ -95,7 +105,7 @@ class DbUser extends DbMain { // Pour passer de dict a list -> array_values() $args = array_values($userInfos); array_push($args, $userId); - $this->exec_cmd($reqAddInfoClient, array_push($args, $userId)); + $this->exec_cmd($reqAddInfoClient, $args); } else { // TODO: Commenter // https://stackoverflow.com/questions/15986235/how-to-use-json-stringify-and-json-decode-properly @@ -118,12 +128,16 @@ class DbUser extends DbMain { // **************************************************************************** // Gestion du token-autologin // **************************************************************************** - // Vérification de la combinaison email - jeton d'auto-login pour authentification final public function autologin_token_check($email, $token) { // Préparation de la requète pour récupérer les infos ou l'email est présent - $reqCheckToken = "SELECT userId, tokenAutoLogin - FROM ".$this->tableUserAccount." WHERE email = ?"; + $reqCheckToken = " + SELECT + userId, tokenAutoLogin + FROM + ".$this->tableUserAccount." + WHERE + email = ?"; // Exécution de la requète $result = $this->exec_cmd($reqCheckToken, array($email))->fetchAll(PDO::FETCH_ASSOC); // Vérifiaction de correspondance email & jeton d'auto-connection @@ -137,8 +151,13 @@ class DbUser extends DbMain { // Mise à jour du jeton d'auto-login final public function autologin_token_update($email, $token) { // Préparation de la requète pour mise à jour du jeton d'auto-connection - $reqUpdateToken = "UPDATE ".$this->tableUserAccount." SET tokenAutoLogin = ? - WHERE email = ?"; + $reqUpdateToken = " + UPDATE + ".$this->tableUserAccount." + SET + tokenAutoLogin = ? + WHERE + email = ?"; // Execution de la requète $this->exec_cmd($reqUpdateToken, array($token, $email))->fetchAll(PDO::FETCH_ASSOC); } @@ -146,8 +165,13 @@ class DbUser extends DbMain { // Supression du jeton d'auto-login final public function autologin_token_delete($email) { // Préparation de la requète pour supression du jeton d'auto-connection - $reqDeleteToken = "UPDATE ".$this->tableUserAccount." SET tokenAutoLogin = NULL - WHERE email = ?"; + $reqDeleteToken = " + UPDATE + ".$this->tableUserAccount." + SET + tokenAutoLogin = NULL + WHERE + email = ?"; // Execution de la requète $this->exec_cmd($reqDeleteToken, array($email))->fetchAll(PDO::FETCH_ASSOC); } |
