diff options
Diffstat (limited to 'Wrapper/wrapper.php')
| -rw-r--r-- | Wrapper/wrapper.php | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/Wrapper/wrapper.php b/Wrapper/wrapper.php index 62077c2..13e0713 100644 --- a/Wrapper/wrapper.php +++ b/Wrapper/wrapper.php @@ -44,16 +44,16 @@ if (isset($_SESSION["src"])) { && $_POST["password"] !== "" ) { if (isset($_POST["rememberMe"]) && $_POST["rememberMe"] == "on") { - $_POST["rememberMe"] = true; + $_POST["rememberMe"] = 1; } else { - $_POST["rememberMe"] = false; + $_POST["rememberMe"] = 0; } login(0, $_POST["email"], $_POST["password"], $_POST["rememberMe"]); // Condition pour une connection auto } elseif ($_SESSION["src"] == "autoLogin" && isset($_COOKIE["autoLogin"]) - && $_SESSION["loggedIn"] == false + && $_SESSION["loggedIn"] ) { // Si connection par cookie, on le décode avant de le passer à la fonction. login(json_decode(base64_decode($_COOKIE["autoLogin"]))); @@ -61,7 +61,7 @@ if (isset($_SESSION["src"])) { // Condition pour une déconnection } elseif ($_SESSION["src"] == "logout" && isset($_SESSION["loggedIn"]) - && $_SESSION["loggedIn"] == true + && $_SESSION["loggedIn"] ) { logout(); @@ -96,28 +96,39 @@ if (isset($_SESSION["src"])) { ); // Condition pour une modification des infos - } elseif ($_SESSION["src"] == "userInfo" - && isset($_SESSION["loggedIn"], $_SESSION["userId"], - $_POST["lastname"], $_POST["firstname"], $_POST["job"], - $_POST["degree"], $_POST["capability"], $_POST["description"], - $_POST["phoneNumber"], $_POST["adress"], $_POST["zipCode"], $_POST["city"] - ) - && $_SESSION["loggedIn"] == true && $_SESSION["userId"] !== "" - && $_POST["lastname"] !== "" && $_POST["firstname"] !== "" + } elseif ($_SESSION["src"] == "userInfo" + // Vérification des données si client + && (isset($_SESSION["loggedIn"], $_SESSION["userId"], $_SESSION["isClient"], + $_POST["lastname"], $_POST["firstname"], $_POST["phoneNumber"], + $_POST["adress"], $_POST["zipCode"], $_POST["city"] + ) + && $_SESSION["isClient"] + && $_POST["lastname"] !== "" && $_POST["firstname"] !== "" + && $_POST["phoneNumber"] !== "" && $_POST["adress"] !== "" + && $_POST["zipCode"] !== "" && $_POST["city"] !== "" + // Ou si pro + || isset($_SESSION["loggedIn"], $_SESSION["userId"], $_SESSION["isPro"], + $_POST["lastname"], $_POST["firstname"], $_POST["phoneNumber"], + $_POST["adress"], $_POST["zipCode"], $_POST["city"], $_POST["jobs"], + $_POST["degree"], $_POST["capability"], $_POST["description"] + ) + && $_SESSION["isPro"] + && $_POST["lastname"] !== "" && $_POST["firstname"] !== "" + && $_POST["phoneNumber"] !== "" && $_POST["adress"] !== "" + && $_POST["zipCode"] !== "" && $_POST["city"] !== "" + && $_POST["degree"] !== "" && $_POST["capability"] !== "" + && $_POST["description"] !== "" + ) ) { - modify_user_info($_POST["lastname"], $_POST["firstname"], $_POST["job"], - $_POST["degree"], $_POST["capability"], $_POST["description"], - $_POST["phoneNumber"], $_POST["adress"], $_POST["zipCode"], - $_POST["city"], $_SESSION["userId"] - ); + modify_user_info($_POST, $_SESSION["userId"], $_SESSION["isPro"]); // Condition pour l'administration du site } elseif ($_SESSION["src"] == "admin" && isset($_SESSION["loggedIn"], $_SESSION["isAdmin"], ) - && $_SESSION["loggedIn"] == true - && $_SESSION["isAdmin"] == true + && $_SESSION["loggedIn"] + && $_SESSION["isAdmin"] && (isset($_POST["userId"]) || isset($_POST["addCategoryNameEn"], $_POST["addCategoryNameFr"] @@ -125,6 +136,7 @@ if (isset($_SESSION["src"])) { || isset($_POST["delCategoryId"]) ) ) { + // Suppression d'un utilisateur if (isset($_POST["userId"]) && $_POST["userId"] !== "" ) { @@ -149,8 +161,8 @@ if (isset($_SESSION["src"])) { $_POST["subject"], $_POST["note"], $_POST["review"], $_POST["proId"] ) - && $_SESSION["loggedIn"] == true - && $_SESSION["isClient"] == true + && $_SESSION["loggedIn"] + && $_SESSION["isClient"] && $_POST["subject"] !== "" && $_POST["note"] !== "" && $_POST["review"] !== "" |
