コード例 #1
0
ファイル: process_reward.php プロジェクト: jackyFeng/unisol
if ($operation === "remove") {
    $code = $_GET["code"];
    $rewardMgr->removeRewardCode($code);
    header("Location: admin.php");
} else {
    if ($operation === "create") {
        $number = $_POST['numberOfCode'];
        $rewardMgr->createRewardCode($number);
        header("Location: admin.php");
    } else {
        if ($operation === "check") {
            $userid = null;
            $userid = $_SESSION["userid"];
            $code = addslashes(filter_input(INPUT_POST, 'code'));
            $exist = $rewardMgr->checkCode($code);
            $used = $rewardMgr->checkHistory($userid, $code);
            if ($exist === false || $used === true) {
                $arr = array();
                $arr['code'] = $code;
                $arr['status'] = $exist;
                echo json_encode($arr);
                exit;
            }
            $arr = array();
            $arr['code'] = $code;
            $arr['status'] = $exist;
            echo json_encode($arr);
        } else {
            if ($operation === "reward") {
                $code = addslashes(filter_input(INPUT_POST, 'code'));
                $gift = $rewardMgr->getGiftByRewardCode($code);