コード例 #1
0
ファイル: ajax.php プロジェクト: itri980112/dashboard
$json = json_decode($data, true);
if (isset($json)) {
    $conn = getConnection("ibabymall");
    if ($json['type'] == "addStarBrand") {
        $d = $json['data'];
        if (checkStarBrand($conn, $_SESSION['user_id'], $d['bid']) == 0) {
            addStarBrand($conn, $_SESSION['user_id'], $d['bid']);
            echo '{"status":"OK","data":{"code":0}}';
        } else {
            echo '{"status":"ERROR","data":{"reason":"already existed","code":1}}';
        }
    }
    if ($json['type'] == "deleteStarBrand") {
        $d = $json['data'];
        if (checkStarBrand($conn, $_SESSION['user_id'], $d['bid']) > 0) {
            deleteStarBrand($conn, $_SESSION['user_id'], $d['bid']);
            echo '{"status":"OK","data":{"code":0}}';
        } else {
            echo '{"status":"ERROR","data":{"reason":"the star brand doesn\'t exist","code":1}}';
        }
    }
    if ($json['type'] == "addStarStore") {
        $d = $json['data'];
        if (checkStarStore($conn, $_SESSION['user_id'], $d['store_id']) == 0) {
            addStarStore($conn, $_SESSION['user_id'], $d['store_id']);
            echo '{"status":"OK","data":{"code":0}}';
        } else {
            echo '{"status":"ERROR","data":{"reason":"already existed","code":1}}';
        }
    }
    if ($json['type'] == "deleteStarStore") {
コード例 #2
0
ファイル: ajax.php プロジェクト: kaogaau/Dashboard
$json = json_decode($data, true);
if (isset($json)) {
    $conn = getConnection("ibabymall");
    if ($json['type'] == "addStarBrand") {
        $d = $json['data'];
        if (checkStarBrand($conn, $d['uid'], $d['bid']) == 0) {
            addStarBrand($conn, $d['uid'], $d['bid']);
            echo '{"status":"OK","data":{"code":0}}';
        } else {
            echo '{"status":"ERROR","data":{"reason":"already existed","code":1}}';
        }
    }
    if ($json['type'] == "deleteStarBrand") {
        $d = $json['data'];
        if (checkStarBrand($conn, $d['uid'], $d['bid']) > 0) {
            deleteStarBrand($conn, $d['uid'], $d['bid']);
            echo '{"status":"OK","data":{"code":0}}';
        } else {
            echo '{"status":"ERROR","data":{"reason":"the star brand doesn\'t exist","code":1}}';
        }
    }
    if ($json['type'] == "addStarStore") {
        $d = $json['data'];
        if (checkStarStore($conn, $d['uid'], $d['store_id']) == 0) {
            addStarStore($conn, $d['uid'], $d['store_id']);
            echo '{"status":"OK","data":{"code":0}}';
        } else {
            echo '{"status":"ERROR","data":{"reason":"already existed","code":1}}';
        }
    }
    if ($json['type'] == "deleteStarStore") {