示例#1
0
<?php

include "include.php";
file_put_contents('activate.txt', date('Y-m-d H:i:s') . "\n\n" . print_r($_POST, true) . "\n\n", FILE_APPEND);
$privatekey = "9cf4b215ecda1d7d1e66f375e4514573";
if (md5($_REQUEST["security_data"] . $privatekey) != $_REQUEST["security_hash"]) {
    return;
    /* FAILED CHECK */
}
$user_id = Arr::get($_POST, "SubscriptionReferrer");
$subscription_ref = Arr::get($_POST, "SubscriptionReference");
if ($user_id == null) {
    header("HTTP/1.0 404 Not Found");
} else {
    try {
        $subscription_data = $fastspring->getSubscription($subscription_ref);
        FastSpring_Helper::save_subscription($user_id, $subscription_data);
    } catch (FsprgException $getEx) {
        file_put_contents('activate.txt', 'Error: ' . $getEx->getMessage() . "\n", FILE_APPEND);
    }
}
file_put_contents('activate.txt', "\n\n\n", FILE_APPEND);
示例#2
0
<?php

include "include.php";
/** Get the customer's ref */
$user_id = $_SESSION["user_id"];
if (FastSpring_Helper::is_subscribed($user_id)) {
    $redirectToUrl = "subpage1.php";
    header("Location: {$redirectToUrl}");
} else {
    $redirectToUrl = "select.php";
    header("Location: {$redirectToUrl}");
}
示例#3
0
<?php

include "include.php";
if (!FastSpring_Helper::is_subscribed($_SESSION["user_id"])) {
    header("Location: billing.php");
    exit;
}
$subscription_ref = FastSpring_Helper::get_subscription_ref($_SESSION["user_id"]);
if (isset($_POST["cancel"])) {
    try {
        $cancelSub = $fastspring->cancelSubscription($subscription_ref);
    } catch (FsprgException $cancelEx) {
        // die($cancelEx);
    }
} elseif (isset($_POST["renew"])) {
    try {
        $fastspring->renewSubscription($subscription_ref);
    } catch (FsprgException $renewEx) {
        // Error can be handled here
    }
} elseif (isset($_POST["update"])) {
    $update = new FsprgSubscriptionUpdate($subscription_ref);
    if (isset($_POST["productPath"])) {
        $update->productPath = $_POST["productPath"];
    }
    if (isset($_POST["tags"])) {
        $update->tags = $_POST["tags"];
    }
    if (isset($_POST["quantity"])) {
        $update->quantity = $_POST["quantity"];
    }
示例#4
0
<?php

include "include.php";
file_put_contents('deactivate.txt', date('Y-m-d H:i:s') . "\n\n" . print_r($_POST, true) . "\n\n\n", FILE_APPEND);
$privatekey = "90b06da8c09f70fb01fe22a02c1e4f71";
if (md5($_REQUEST["security_data"] . $privatekey) != $_REQUEST["security_hash"]) {
    return;
    /* FAILED CHECK */
}
$user_id = Arr::get($_POST, "SubscriptionReferrer");
if ($user_id == null) {
    header("HTTP/1.0 404 Not Found");
} else {
    FastSpring_Helper::delete_subscription($user_id);
}