コード例 #1
0
<?php

$option = isset($_POST["option"]) ? $_POST["option"] : "";
$response = array();
switch ($option) {
    case "INS":
        $name = $_POST["name"];
        $description = $_POST["description"];
        $webSite = $_POST["webSite"];
        $redirectUri = $_POST["redirectUri"];
        try {
            $arrayData = array("CLIENT_NAME" => $name, "CLIENT_DESCRIPTION" => $description, "CLIENT_WEBSITE" => $webSite, "REDIRECT_URI" => $redirectUri, "USR_UID" => $_SESSION["USER_LOGGED"]);
            $oclient = new OauthClients();
            $result = $oclient->create($arrayData);
            $response["status"] = "OK";
            $response["data"] = $result;
        } catch (Exception $e) {
            $response["status"] = "ERROR";
            $response["message"] = $e->getMessage();
        }
        break;
    case "UPD":
        $oauthClientId = $_POST["oauthClientId"];
        $name = $_POST["name"];
        $description = $_POST["description"];
        $webSite = $_POST["webSite"];
        $redirectUri = $_POST["redirectUri"];
        try {
            $arrayData = array("CLIENT_ID" => $oauthClientId, "CLIENT_NAME" => $name, "CLIENT_DESCRIPTION" => $description, "CLIENT_WEBSITE" => $webSite, "REDIRECT_URI" => $redirectUri, "USR_UID" => $_SESSION["USER_LOGGED"]);
            $oclient = new OauthClients();
            $result = $oclient->update($arrayData);