Exemplo n.º 1
0
if ($_POST['send'] == 'MailChimpAPI') {
    $result = json_encode(MailChimpRequest($method, json_decode($data, true)));
} else {
    if ($_POST['send'] == 'MailChimpUpdateLists') {
        MailChimpUpdateLists($con);
        $result = json_encode(MailChimpSqlResultToArray($con, 'select * from ctcweb9_ctc.mailchimp_lists'));
    } else {
        if ($_POST['send'] == 'MailChimpResetSubscription') {
            MailChimpResetSubscription($con);
            $result = json_encode($_POST['send']);
        } else {
            if ($_POST['send'] == 'MailChimpUpdateListFromDB') {
                $result = json_encode(MailChimpUpdateListFromDB($con, "054eb834c8"));
            } else {
                if ($_POST['send'] == 'SQL') {
                    $result = json_encode(MailChimpSqlResultToArray($con, $data));
                } else {
                    if ($_POST['send'] == 'preg_replace') {
                        $result = json_encode(preg_replace($method, $replace, $data));
                    }
                }
            }
        }
    }
}
?>
<html>
	<head>
		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <style>
Exemplo n.º 2
0
        if ($_POST[$list['id']] == 'on') {
            $listids[] = "'" . $list['id'] . "'";
        }
    }
    echo "{$userid} " . join(",", $listids) . "<br>";
    $sql = "DELETE from ctcweb9_ctc.mailchimp_subscriptions where memberId = {$userid} and listid not in (" . join(",", $listids) . ")";
    echo "<pre>{$sql}</pre>";
    echo mysql_query($sql, $con) or die('delete');
    $sql = "INSERT into ctcweb9_ctc.mailchimp_subscriptions(listid,memberid)\n\t\t\tSELECT listid,{$userid} \n\t\t\tFROM ctcweb9_ctc.mailchimp_lists\n\t\t\tWHERE listid in (" . join(",", $listids) . ")\n\t\t\tAND listid not in (select listid from ctcweb9_ctc.mailchimp_subscriptions where memberid = {$userid})";
    echo "<pre>{$sql}</pre>";
    echo mysql_query($sql, $con) or die('insert');
    $result = MailChimpUpdateListsFromDB($con);
} else {
    $result = array("Waiting");
}
echo json_encode(MailChimpSqlResultToArray($con, "select ml.listname, ms.* \n\t\t\t\t\t\tfrom ctcweb9_ctc.mailchimp_subscriptions ms\n\t\t\t\t\t\tjoin ctcweb9_ctc.mailchimp_lists ml on ml.listid = ms.listid\n\t\t\t\t\t\twhere memberId = {$userid}"));
foreach ($lists['data'] as &$list) {
    $memberinfoargs = array("id" => $list['id'], "emails" => array(array("email" => $email)));
    $memberinfo = MailChimpRequest("lists/member-info", $memberinfoargs);
    $list['is_subscribed'] = sizeof($memberinfo['data']) > 0;
}
?>
<html>
	<head>
		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <style>

    </style>
    <script>