Пример #1
0
}
$action = empty($_GET["action"]) ? '' : $_GET["action"];
if ($action == "") {
    showlist();
} elseif ($action == "toaddpage") {
    toaddpage();
} elseif ($action == "addone") {
    addone();
} elseif ($action == "deleteselected") {
    deleteselected();
} elseif ($action == "groupusermanage") {
    groupusermanage();
} elseif ($action == "deletefromgroup") {
    deletefromgroup();
} elseif ($action == "addtogroup") {
    addtogroup();
} elseif ($action == "initUser") {
    echo initUser();
}
function showlist()
{
    global $db;
    global $smarty;
    $page_size = getPageSize();
    // 每页显示的条目数
    $sub_pages = getSubPages();
    // 每次显示的页数
    $current_page = empty($_GET["p"]) ? "1" : $_GET["p"];
    // 当前被选中的页
    /*$res = $db->query("SELECT a.id, a.groupname FROM wx_group_info a");
    	$rowList=$db->fetch_all($res);*/
Пример #2
0
function subscribe($user_id, $subsc_id, $paid = 0)
{
    global $EP;
    $db = new clsDBNetConnect();
    $query = "select * from subscription_plans where id = '" . $subsc_id . "'";
    $db->query($query);
    if ($db->next_record()) {
        $db2 = new clsDBNetConnect();
        $query = "select * from used_subscriptions where user_id='" . $user_id . "' and subsc_id='" . $subsc_id . "' and expires>'" . time() . "'";
        $db2->query($query);
        if ($db2->next_record()) {
            addtogroup($user_id, $db->f("group"), $db2->f("group"));
            $expires = $db2->f("expires");
            $duration = $db->f("duration");
            $duration = $duration * 86400;
            $duration = $duration + $expires;
            if ($db->f("unlimited")) {
                $duration = 9999999999.0;
            }
            $query = "insert into used_subscriptions (`user_id`, `date`, `expires`, `subsc_id`, `paid`, `group`, `active`) values ('" . $user_id . "', '" . time() . "', '" . $duration . "', '" . $subsc_id . "', '" . $paid . "', '" . $db->f("group") . "', '1')";
            $db2->query($query);
        } else {
            addtogroup($user_id, $db->f("group"));
            $duration = $db->f("duration");
            $duration = $duration * 86400;
            if ($db->f("intro") && $db->f("intro_price") == $paid) {
                $duration = $db->f("intro_duration");
                $duration = $duration * 86400;
            }
            $duration = $duration + time();
            if ($db->f("unlimited")) {
                $duration = 9999999999.0;
            }
            $query = "insert into used_subscriptions (`user_id`, `date`, `expires`, `subsc_id`, `paid`, `group`, `active`) values ('" . $user_id . "', '" . time() . "', '" . $duration . "', '" . $subsc_id . "', '" . $paid . "', '" . $db->f("group") . "', '1')";
            $db->query($query);
        }
        if ($duration == 9999999999.0) {
            $EP["EMAIL_EXPIRES"] = "Never";
        } else {
            $EP["EMAIL_EXPIRES"] = date("F j, Y, g:i a", $duration);
        }
        $return = $duration;
    } else {
        print "Invalid Subscription ID Specified";
        exit;
    }
    return $return;
}