Пример #1
0
     $description = isset($_POST["description"]) ? $_POST["description"] : "";
     $list = $_POST["list"];
     $forceInsert = isset($_POST["force"]) ? filter_var($_POST["force"], FILTER_VALIDATE_BOOLEAN) : false;
     $message = insertWord($conn, $userID, $word, $translation, $description, $wordBase, $list, $forceInsert);
     break;
 case "get":
     $message["action"] = "check";
     break;
 case "userinfo":
     $message["user"] = getUserInfo($conn, $userID);
     break;
 case "userdetail":
     $message["user"] = getUserDetail($conn, $userID);
     break;
 case "updateuserdetail":
     $message["status"] = updateUserDetail($conn, $userID, $_POST["firstname"], $_POST["lastname"], $_POST["nickname"]);
     break;
 case "updatepassword":
     $message["update"] = updatePassword($conn, $userID, $_POST["password"], $_POST["newpassword"], $passwordSalt);
     break;
 case "wordlist":
     $filter = "%";
     if (isset($_POST["filter"])) {
         $filter = $_POST["filter"];
     }
     $message["wordcount"] = getWordsCount($conn, $_POST["lists"], $userID, $filter);
     $message["words"] = getWordsList($conn, $userID, $_POST["lists"], $_POST["first"], $_POST["last"], $filter);
     break;
 case "wordcount":
     $message["wordcount"] = getWordsCount($conn, $_GET["list"], $userID);
     break;
Пример #2
0
            $result->message = "password different";
        }
    } else {
        $result->message = "parameter invalid";
    }
    echo json_encode($result);
});
$app->post("/updateUser", function () {
    global $app;
    $result = new stdClass();
    $result->status = false;
    $post = getPosts();
    if (isset($post["nama_depan"]) && isset($post["nama_belakang"]) && isset($post["deskripsi"]) && isset($post["gender"])) {
        $user = getUserBykey(getHeaders("key"));
        if ($user) {
            updateUserDetail($user["id"], $post["nama_depan"], $post["nama_belakang"], $post["deskripsi"], $post["gender"]);
            $result->status = true;
        } else {
            $result->message = "invalid_key";
        }
    } else {
        $result->message = "parameter invalid";
    }
    echo json_encode($result);
});
$app->post("/logout", function () {
    global $app;
    $result = new stdClass();
    $result->status = false;
    $data = getPosts();
    if (isset($data["key"])) {