/** * response all msg * @param $postObj * @return string */ function response($postObj) { $log = new Logs(); $return = ''; $msgType = $postObj->MsgType; $logmsg = '[user] ' . $postObj->FromUserName . ' [msg-type] ' . $msgType; switch ($msgType) { case MSGTYPE_EVENT: $logmsg .= ' [event] ' . $postObj->Event; switch ($postObj->Event) { case 'subscribe': //关注 $return = subscribe($postObj); break; case 'unsubscribe': unsubscribe($postObj); break; case 'CLICK': switch ($postObj->EventKey) { case 'MENU_NEWS': $return = news($postObj); break; } } break; case MSGTYPE_TEXT: //txt $logmsg .= ' [content] ' . $postObj->Content; $return = textResponse($postObj); break; default: $return = news($postObj); break; } if (!$log->write_log($logmsg, 'access')) { if (DEBUG) { echo 'error: ' . $log->error; } } return $return; }
} //all other actions require user to be logged in if (check_logged_in()) { switch ($action) { case 'account-settings': display_account_form(get_email(), get_real_name(get_email()), get_mimetype(get_email())); break; case 'show-other-lists': display_items('Unsubscribed Lists', get_unsubscribed_lists(get_email()), 'information', 'show-archive', 'subscribe'); break; case 'subscribe': subscribe(get_email(), $_GET['id']); display_items('Subscribed Lists', get_subscribed_lists(get_email()), 'information', 'show-archive', 'unsubscribe'); break; case 'unsubscribe': unsubscribe(get_email(), $_GET['id']); display_items('Subscribed Lists', get_subscribed_lists(get_email()), 'information', 'show-archive', 'unsubscribe'); break; case '': case 'show-my-lists': display_items('Subscribed Lists', get_subscribed_lists(get_email()), 'information', 'show-archive', 'unsubscribe'); break; case 'change-password': display_password_form(); break; case 'store-change-password': if (change_password(get_email(), $_POST['old_passwd'], $_POST['new_passwd'], $_POST['new_passwd2'])) { echo "<p style=\"padding-bottom: 50px\">OK: Password\n changed.</p>"; } else { echo "<p style=\"padding-bottom: 50px\">Sorry, your\n password could not be changed.</p>"; display_password_form();
} else { include "header.php"; $stop = translate("This account or IP has been temporarily disabled. This means that either this IP, or user account has been moderated down more than x times in the last few hours. If you think this is unfair, you should contact the admin.") . "<br />"; error_handler($stop); include "footer.php"; } } else { redirect_url("index.php"); } } else { redirect_url("index.php"); } } settype($op, 'string'); switch ($op) { case "subscribe": subscribe($email); break; case "subscribeOK": //anti_spambot if (!R_spambot($asb_question, $asb_reponse, "")) { Ecr_Log("security", "LNL Anti-Spam : email=" . $email, ""); redirect_url("index.php"); die; } subscribe_ok($email); break; case "unsubscribe": unsubscribe($email); break; }
// select 1 row from table where statecheck = 0 $sqlBuilder = new \Simplon\Mysql\Manager\SqlQueryBuilder(); $sqlBuilder->setQuery('SELECT * FROM bazanoua WHERE state = :state')->setConditions(array('state' => '0')); $select = $sqlManager->fetchRow($sqlBuilder); print_r($select); // change statecheck to 1 $data = array('state' => '1'); $sqlBuilder = new \Simplon\Mysql\Manager\SqlQueryBuilder(); $sqlBuilder->setTableName('bazanoua')->setConditions(array('id' => $select['id']))->setConditionsQuery("id = :id")->setData($data); $update = $sqlManager->update($sqlBuilder); // print_r($select['email']); foreach ($csv as $key => $mail) { $email = $mail[0]; if ($select['email'] == $email) { echo "\n" . "Am gasit rejectu" . "\n"; unsubscribe($select['id'], $sqlManager); // sleep(2); } // print_r($email); } $data = array('state' => '2'); $sqlBuilder = new \Simplon\Mysql\Manager\SqlQueryBuilder(); $sqlBuilder->setTableName('bazanoua')->setConditions(array('id' => $select['id']))->setConditionsQuery("id = :id")->setData($data); $update = $sqlManager->update($sqlBuilder); // break; } while ($select); function unsubscribe($id, $sqlManager) { try { $data = array('unsubscribe' => '1'); $sqlBuilder = (new \Simplon\Mysql\Manager\SqlQueryBuilder())->setTableName('bazanoua')->setConditions(array('id' => $id))->setConditionsQuery("id = :id")->setData($data);
} if (isset($_POST['clearOneTestsolveRequest'])) { $pid = $_POST['pid']; clearOneTestsolveRequest($pid); header("Location: " . URL . "/puzzle.php?pid=" . $pid); exit(0); } if (isset($_POST['emailSub'])) { $pid = $_POST['pid']; subscribe($uid, $pid); header("Location: " . URL . "/puzzle.php?pid=" . $pid); exit(0); } if (isset($_POST['emailUnsub'])) { $pid = $_POST['pid']; unsubscribe($uid, $pid); header("Location: " . URL . "/puzzle.php?pid=" . $pid); exit(0); } if (isset($_POST['getTest'])) { $pid = getPuzzleToTest($uid); if ($pid) { addPuzzleToTestQueue($uid, $pid); } else { $_SESSION['failedToAdd'] = TRUE; } header("Location: " . URL . "/testsolving.php"); exit(0); } if (isset($_POST['SelfAddFactchecker'])) { // User wishes to opt in to factchecking duty.
// getting nb articles, gen random num, then select one article is much faster than "sql(order by rand limit 1)" $result = $GLOBALS['db_handle']->query("SELECT count(ID) FROM articles")->fetch(); $rand = mt_rand(0, $result[0] - 1); $tableau = liste_elements("SELECT * FROM articles LIMIT {$rand}, 1", array(), 'articles'); } catch (Exception $e) { die('Erreur rand: ' . $e->getMessage()); } header('Location: ' . $tableau[0]['bt_link']); exit; } // unsubscribe from comments-newsletter and redirect on main page if (isset($_GET['unsub']) and $_GET['unsub'] == 1 and (isset($_GET['comment']) and preg_match('#\\d{14}#', $_GET['comment'])) and isset($_GET['mail'])) { if (isset($_GET['all'])) { $res = unsubscribe(htmlspecialchars($_GET['comment']), $_GET['mail'], 1); } else { $res = unsubscribe(htmlspecialchars($_GET['comment']), $_GET['mail'], 0); } if ($res == TRUE) { header('Location: ' . $_SERVER['PHP_SELF'] . '?unsubsribe=yes'); } else { header('Location: ' . $_SERVER['PHP_SELF'] . '?unsubsribe=no'); } } /***************************************************************************** Show one post : 1 blogpost (with comments) ******************************************************************************/ // Single Blog Post if (isset($_GET['d']) and preg_match('#^\\d{4}/\\d{2}/\\d{2}/\\d{2}/\\d{2}/\\d{2}#', $_GET['d'])) { $tab = explode('/', $_GET['d']); $id = substr($tab['0'] . $tab['1'] . $tab['2'] . $tab['3'] . $tab['4'] . $tab['5'], '0', '14'); // 'admin' connected is allowed to see draft articles, but not 'public'. Same for article posted with a date in the future.
{ BoincSubscription::delete($user->id, $thread->id); if (!BoincSubscription::lookup($user->id, $thread->id)) { page_head(tra("Unsubscription successful")); show_forum_header($user); show_title($forum, $thread); echo "<p>" . tra("You are no longer subscribed to %1. You will no longer receive notifications for this thread.", "<b>" . cleanup_title($thread->title) . "</b>"); } else { page_head(tra("Unsubscription failed")); echo "<p>" . tra("We are currently unable to unsubscribe you from %1. Please try again later..", "<b>" . cleanup_title($thread->title) . "</b>"); } echo "</p><p><br /><a href=\"forum_thread.php?id=" . $thread->id . "\">" . tra("Return to thread") . "</a></p>"; page_tail(); } if (!$thread || !$action) { error_page(tra("Unknown subscription action")); } $user = get_logged_in_user(); check_tokens($user->authenticator); if ($action == "subscribe") { subscribe($forum, $thread, $user); exit; } else { if ($action == "unsubscribe") { unsubscribe($forum, $thread, $user); exit; } } ?>
} if (!empty($_REQUEST['identifier'])) { $keys = log_campaign_activity($_REQUEST['identifier'], 'removed'); global $current_language; $mod_strings = return_module_language($current_language, 'Campaigns'); global $beanFiles, $beanList; if (!empty($keys) && $keys['target_type'] == 'Users') { //Users cannot opt out of receiving emails, print out warning message. echo $mod_strings['LBL_USERS_CANNOT_OPTOUT']; } elseif (!empty($keys) && isset($keys['campaign_id']) && !empty($keys['campaign_id'])) { //we need to unsubscribe the user from this particular campaign $beantype = $beanList[$keys['target_type']]; require_once $beanFiles[$beantype]; $focus = new $beantype(); $focus->retrieve($keys['target_id']); unsubscribe($keys['campaign_id'], $focus); } elseif (!empty($keys)) { $id = $keys['target_id']; $module = trim($keys['target_type']); $class = $beanList[$module]; require_once $beanFiles[$class]; $mod = new $class(); $db = DBManagerFactory::getInstance(); $id = $db->quote($id); //no opt out for users. if (preg_match('/^[0-9A-Za-z\\-]*$/', $id) && $module != 'Users') { //record this activity in the campaing log table.. $query = "UPDATE email_addresses SET email_addresses.opt_out = 1 WHERE EXISTS(SELECT 1 FROM email_addr_bean_rel ear WHERE ear.bean_id = '{$id}' AND ear.deleted=0 AND email_addresses.id = ear.email_address_id)"; $status = $db->query($query); if ($status) { echo "*";
<?php $subscription_file = "/database/smartwink-subscriptions"; # Barebones upnp subscribe / unsubscribe implementation. # PHP on the Wink Hub doesn't come with sockets support, so we tie to socat. $request = stream_get_line(STDIN, 4096, "\r\n\r\n"); $events = array(); $callbacks = array(); if (preg_match("@SUBSCRIBE /upnp/event/(\\w+)/(\\w+)@", $request, $events) && preg_match("@CALLBACK: <([^\\s>]+)>@", $request, $callbacks)) { subscribe($events[1], $events[2], $callbacks[1]); } elseif (preg_match("@SUBSCRIBE /upnp/event/(\\w+)/(\\w+)@", $request, $events) && preg_match("@SID: (\\w+)@", $request, $sid)) { unsubscribe($events[1], $events[2], $sid[1]); } fclose(STDOUT); fclose(STDIN); function subscribe($publisher, $path, $callback) { global $subscription_file; $key = "{$publisher} {$path}"; $id = md5($key); $subscriptions = file($subscription_file) ?: array(); $subscriptions = array_map(rtrim, $subscriptions); array_push($subscriptions, "{$key} {$callback}"); $subscriptions = array_unique($subscriptions); file_put_contents($subscription_file, join("\n", $subscriptions)); respond($id); } function unsubscribe($publisher, $path, $sid) { global $subscription_file; $record = "{$publisher} {$path}";
public function web_hook() { // $this->load->model('main'); // // add to database // $info = array( // 'first_name' => 'photo ', // 'last_name' => 'last ', // 'email' => 'e@g.com ', // 'originator_id' => '387 ', // 'type' => 27 // = photo client // ); /*********************************************** Sample code for handling MailChimp Webhooks - to write the logfile, your webserver must be able to write to the file in the wh_log() function below. This also assumes you use a key to secure the script and configure a URL like this in MailChimp: http://www.mydomain.com/webhook.php?key=EnterAKey! ***********************************************/ $this->load->helper('file'); /*********************************************** Helper Functions ***********************************************/ // web hook login MailChimp function wh_log($msg) { $file_data = date("Y-m-d H:i:s") . " | " . $msg . "\n"; if (write_file(FCPATH . '/assets/web_hook.log', $file_data, 'a') == FALSE) { echo $logfile; echo 'Unable to write the file'; } else { echo 'File written!'; } } function subscribe($data) { wh_log($data['email'] . ' just subscribed!'); } function unsubscribe($data) { wh_log($data['email'] . ' just unsubscribed!'); } function cleaned($data) { wh_log($data['email'] . ' was cleaned from your list!'); } function upemail($data) { wh_log($data['old_email'] . ' changed their email address to ' . $data['new_email'] . '!'); } function profile($data) { wh_log($data['email'] . ' updated their profile!'); } $my_key = '19776'; wh_log('==================[ Incoming Request ]=================='); wh_log("Full _REQUEST dump:\n" . print_r($_REQUEST, true)); if (!isset($_GET['key'])) { wh_log('No security key specified, ignoring request'); } elseif ($_GET['key'] != $my_key) { wh_log('Security key specified, but not correct:'); wh_log("\t" . 'Wanted: "' . $my_key . '", but received "' . $_GET['key'] . '"'); } else { //process the request wh_log('Processing a "' . $_POST['type'] . '" request...'); switch ($_POST['type']) { case 'subscribe': subscribe($_POST['data']); break; case 'unsubscribe': unsubscribe($_POST['data']); break; case 'cleaned': cleaned($_POST['data']); break; case 'upemail': upemail($_POST['data']); break; case 'profile': profile($_POST['data']); break; default: wh_log('Request type "' . $_POST['type'] . '" unknown, ignoring.'); } } wh_log('Finished processing request.'); }
$param["geo"] = "zip"; } elseif (isset($param["geonameid"])) { $param["geo"] = "geoname"; } $is_update = true; } } if (isset($param["unsubscribe"]) && $param["unsubscribe"]) { $default_unsubscribe = true; } form($param); } if (isset($param["modify"]) && $param["modify"]) { subscribe($param); } elseif (isset($param["unsubscribe"]) && $param["unsubscribe"]) { unsubscribe($param); } else { form($param); // form always writes footer and exits } echo html_footer_bootstrap3(); exit; function get_return_path($mailto) { return "shabbat-return+" . strtr($mailto, "@", "=") . "@hebcal.com"; } function echo_lead_text() { global $echoed_lead_text; if (!$echoed_lead_text) { ?>
if (empty($user_id)) { $user_id = $_SESSION["user_id"]; } switch ($action) { // case 'subscribe': echo "Action: " . $action . " title: " . $title;//subscribe($title); case 'subscribe': subscribe($title, $mysqli); break; case 'remove_user': remove_user($user_id, $mysqli); break; case 'remove_all_users': remove_user("", $mysqli); break; case 'unsubscribe': unsubscribe($title, $mysqli, $user_id); break; case 'query_series': db_query_series_json($mysqli, $title); break; case 'edit_profile': edit_user_profile($mysqli, $user_id); break; case 'update_profile': update_user_profile($mysqli, $user_id, $firstname, $lastname, $email); break; case 'remove_series': remove_series($mysqli, $title); break; case 'remove_all_series': remove_series($mysqli, "");
display_login_form($action); } echo "<p>Added to list</p>"; if (!empty($_POST['cList'])) { foreach ($_POST['cList'] as $item) { echo "<p>" . $item . "</p>"; subscribe($item, $_GET['id']); } } } if ($_POST['remove'] == 'Remove from List') { $action = ''; if (!check_admin_user()) { display_login_form($action); } if (!empty($_POST['cList'])) { foreach ($_POST['cList'] as $item) { echo "<p>" . $item . "</p>"; unsubscribe($item, $_GET['id']); } } } break; } } /********************************************************************** * Section 4: display footer *********************************************************************/ do_html_footer(); ?>
</fieldset> </form> </div> <p>Unsubscribe Sensors:</p> <div id="us_sensor_panel"> <form action="" method="post"> <fieldset> Enter Sensor ID: <input type="text" name="unsub_sensorid"> <input type="submit" name="unsubscribe_sensor" value="Unsubscribe"> </fieldset> </form> </div> <span style="color:green"> <?php subscribe($conn); unsubscribe($conn); ?> </span> </body> </html>
* 3 - Add comment (anonymously) * 11 - List patches * 12 - Patch details * 13 - Add patch * * @var integer */ $edit = empty($_REQUEST['edit']) || !(int) $_REQUEST['edit'] ? 0 : (int) $_REQUEST['edit']; if (isset($_GET['unsubscribe'])) { $unsubcribe = (int) $_GET['unsubscribe']; $hash = isset($_GET['t']) ? $_GET['t'] : false; SITE == 'pear' ? $redirect = 'pecl' : ($redirect = 'pear'); if (!$hash) { localRedirect('bug.php?id=' . $id); } unsubscribe($id, $hash); $_GET['thanks'] = 9; } // captcha is not necessary if the user is logged in if (isset($auth_user) && $auth_user && $auth_user->registered && isset($_SESSION['answer'])) { unset($_SESSION['answer']); } $trytoforce = isset($_POST['trytoforce']) ? (int) $_POST['trytoforce'] : false; // fetch info about the bug into $bug if ($dbh->getOne('SELECT handle FROM bugdb WHERE id=?', array($id))) { $query = 'SELECT b.id, b.package_name, b.bug_type, b.email, b.handle as bughandle, b.reporter_name, b.passwd, b.sdesc, b.ldesc, b.php_version, b.package_version, b.php_os, b.status, b.ts1, b.ts2, b.assign, UNIX_TIMESTAMP(b.ts1) AS submitted, users.registered, UNIX_TIMESTAMP(b.ts2) AS modified, COUNT(bug=b.id) AS votes,
function portal_set_newsletters($session, $subscribe_ids, $unsubscribe_ids) { global $beanList, $beanFiles; $error = new SoapError(); if (!portal_validate_authenticated($session)) { $error->set_error('invalid_session'); return array('result_count' => -1, 'entry_list' => array(), 'error' => $error->get_soap_array()); } require_once 'modules/Campaigns/utils.php'; $contact = new Contact(); $contact->retrieve($_SESSION['user_id']); if (!empty($contact->id)) { foreach ($subscribe_ids as $campaign_id) { subscribe($campaign_id, null, $contact, true); } foreach ($unsubscribe_ids as $campaign_id) { unsubscribe($campaign_id, $contact); } } return $error->get_soap_array(); }
// Init common variables $errors = array(); // Set edit mode $edit = isset($_REQUEST['edit']) ? (int) $_REQUEST['edit'] : 0; // Authenticate bugs_authenticate($user, $pw, $logged_in, $user_flags); $is_trusted_developer = $user_flags & BUGS_TRUSTED_DEV; $is_security_developer = $user_flags & (BUGS_TRUSTED_DEV | BUGS_SECURITY_DEV); // Handle unsubscription if (isset($_GET['unsubscribe'])) { $unsubcribe = (int) $_GET['unsubscribe']; $hash = isset($_GET['t']) ? $_GET['t'] : false; if (!$hash) { redirect("bug.php?id={$bug_id}"); } unsubscribe($bug_id, $hash); $_GET['thanks'] = 9; } // Subscription / Unsubscription if (isset($_POST['subscribe_to_bug']) || isset($_POST['unsubscribe_to_bug'])) { // Check if session answer is set, then compare it with the post captcha value. // If it's not the same, then it's an incorrect password. if (!$logged_in) { if (!isset($_SESSION['answer'])) { $errors[] = 'Please enable cookies so the Captcha system can work'; } elseif ($_POST['captcha'] != $_SESSION['answer']) { $errors[] = 'Incorrect Captcha'; } } if (empty($errors)) { if ($logged_in && !empty($auth_user->email)) {
if (!class_exists("Template")) { include "template.inc"; } $in_trail = 3; page_open(array("sess" => "Linktrail_Session", "auth" => "Linktrail_Auth", "perm" => "Linktrail_Perm", "user" => "Linktrail_User")); $auth->login_if($auth->auth["uid"] == "nobody"); $mytrail = get_node_info($PATH_INFO); if ($mytrail == -1) { $mytrail = get_node_info($PATH_INFO . "?"); } if (get_notification_method($auth->auth['uname'], $mytrail['id']) != -1) { $ft = SFT_CHSUBS; } else { $ft = SFT_SUBSCRIBE; } if ($action == "exec") { if (isset($unsubscribe)) { unsubscribe($auth->auth['uname'], $mytrail['id']); $str = ""; if ($HTTP_POST_VARS['reloadparent'] == "1") { $str = "?reloadparent=1"; } // die("Location: ".$sess->url($mytrail['path'].$str)); header("Location: " . $sess->url($mytrail['path'] . $str)); } else { doit(); } } else { form($HTTP_GET_VARS['reload_parent'] == "1"); } page_close();
} //all other actions require user to be logged in if (check_logged_in()) { switch ($action) { case 'account-settings': display_account_form(get_email(), get_real_name(get_email()), get_mimetype(get_email())); break; case 'show-other-lists': display_items('Unsubscribed Lists', get_unsubscribed_lists(get_email()), 'information', 'show-archive', 'subscribe'); break; case 'subscribe': subscribe(get_email(), $HTTP_GET_VARS['id']); display_items('Subscribed Lists', get_subscribed_lists(get_email()), 'information', 'show-archive', 'unsubscribe'); break; case 'unsubscribe': unsubscribe(get_email(), $HTTP_GET_VARS['id']); display_items('Subscribed Lists', get_subscribed_lists(get_email()), 'information', 'show-archive', 'unsubscribe'); break; case '': case 'show-my-lists': display_items('Subscribed Lists', get_subscribed_lists(get_email()), 'information', 'show-archive', 'unsubscribe'); break; case 'change-password': display_password_form(); break; case 'store-change-password': if (change_password(get_email(), $HTTP_POST_VARS['old_passwd'], $HTTP_POST_VARS['new_passwd'], $HTTP_POST_VARS['new_passwd2'])) { echo '<p>OK: Password changed.</p> <br /><br /><br /><br /><br /><br />'; } else { echo '<p>Sorry, your password could not be changed.</p>';
$result = mysql_query($sql, $con); echo $email . ' has been removed from the mailing list'; } mysql_close($con); } ?> <!DOCTYPE html> <html lang="en"> <head> <title>Unsubscribe </title> <meta name="description" content="Unsubscribe from Marty's mailing list" /> <?php include_once 'head.php'; ?> </head> <body> <?php include_once 'top.php'; ?> <div class="row"> <div class="hero-unit"> <h1>Unsubscribe</h1><hr/> <?php unsubscribe(); ?> </div></div> <?php include_once 'footer.php';
<?php /*input data action--> subscribe, unsubscribe for unsubsribe--> token(sent to the email), and email_id. for subscribe--> emails_id */ if (isset($_POST['action'])) { switch ($_POST['action']) { case 'unsubscribe': if (isset($_POST['token']) && isset($_POST['email'])) { $return = unsubscribe($_POST['email'], $_POST['token']); echo json_encode($return); } break; case 'subscribe': if (isset($_POST['email'])) { $return = subscribe($_POST['email']); echo json_encode($return); } break; } } function unsubscribe($email, $token) { require_once $_SERVER['DOCUMENT_ROOT'] . '/mailer/application/connect_db.php'; $return = array('status' => 1, 'error' => ''); $object = new connect_db(); $primary_key = 0; if ($object->email_exists($email)) { //echo 'email exists'; $primary_key = $object->get_primarykey($email);
$handled = true; $header_info = get_mail_header($mailbox_handle, $i); $to = $header_info->toaddress; $from = $header_info->fromaddress; $subject = $header_info->subject; if (handle_to_address($to) == $subscribe_email && in_array(handle_subject($subject), $subscription_lists)) { $subscription = subscribe($from, $subject); if ($subscription) { eZMail::extractEmail($from, $email, $name); $cli->output("Subscription created: " . $subscription->attribute('subscriptionlist_id') . "/" . $email); sendConfirmation($email, $subscription, true); } else { $handled = false; } } elseif (handle_to_address($to) == $unsubscribe_email && in_array(handle_subject($subject), $subscription_lists)) { $subscription = unsubscribe($from, $subject); if ($subscription) { eZMail::extractEmail($from, $email, $name); $cli->output("Subscription removed: " . $subscription->attribute('subscriptionlist_id') . "/" . $email); sendConfirmation($email, $subscription, false); } else { $handled = false; } } else { //echo "Not a un/subscribe email: ".$to. " \"".$subject."\""."\n"; $handled = false; } if ($handled) { $cli->output('Email (' . $i . ') removed from mailbox'); imap_delete($mailbox, $i); }
function manageSubscriptions($focus) { //Process Subscription Lists first //compare current list of subscriptions to original list and see if there are any additions $orig_subscription_arr = array(); $curr_subscription_arr = array(); //build array of original subscriptions if (isset($_REQUEST['orig_enabled_values']) && !empty($_REQUEST['orig_enabled_values'])) { $orig_subscription_arr = explode(",", $_REQUEST['orig_enabled_values']); $orig_subscription_arr = process_subscriptions($orig_subscription_arr); } //build array of current subscriptions if (isset($_REQUEST['enabled_subs']) && !empty($_REQUEST['enabled_subs'])) { $curr_subscription_arr = explode(",", $_REQUEST['enabled_subs']); $curr_subscription_arr = process_subscriptions($curr_subscription_arr); } //compare both arrays and find differences $i = 0; while ($i < count($curr_subscription_arr) / 2) { //if current subscription existed in original subscription list, do nothing if (in_array($curr_subscription_arr['campaign' . $i], $orig_subscription_arr)) { //nothing to process } else { //current subscription is new, so subscribe subscribe($curr_subscription_arr['campaign' . $i], $curr_subscription_arr['prospect_list' . $i], $focus); } $i = $i + 1; } //Now process UnSubscription Lists first //compare current list of subscriptions to original list and see if there are any additions $orig_unsubscription_arr = array(); $curr_unsubscription_arr = array(); //build array of original subscriptions if (isset($_REQUEST['orig_disabled_values']) && !empty($_REQUEST['orig_disabled_values'])) { $orig_unsubscription_arr = explode(",", $_REQUEST['orig_disabled_values']); $orig_unsubscription_arr = process_subscriptions($orig_unsubscription_arr); } //build array of current subscriptions if (isset($_REQUEST['disabled_subs']) && !empty($_REQUEST['disabled_subs'])) { $curr_unsubscription_arr = explode(",", $_REQUEST['disabled_subs']); $curr_unsubscription_arr = process_subscriptions($curr_unsubscription_arr); } //compare both arrays and find differences $i = 0; while ($i < count($curr_unsubscription_arr) / 2) { //if current subscription existed in original subscription list, do nothing if (in_array($curr_unsubscription_arr['campaign' . $i], $orig_unsubscription_arr)) { //nothing to process } else { //current subscription is new, so subscribe unsubscribe($curr_unsubscription_arr['campaign' . $i], $focus); } $i = $i + 1; } }
wh_log('==================[ Incoming Request ]=================='); wh_log("Full _REQUEST dump:\n" . print_r($_REQUEST, true)); if (!isset($_GET['key'])) { wh_log('No security key specified, ignoring request'); } elseif ($_GET['key'] != $my_key) { wh_log('Security key specified, but not correct:'); wh_log("\t" . 'Wanted: "' . $my_key . '", but received "' . $_GET['key'] . '"'); } else { //process the request wh_log('Processing a "' . $_POST['type'] . '" request...'); switch ($_POST['type']) { case 'subscribe': subscribe($_POST['data']); break; case 'unsubscribe': unsubscribe($_POST['data']); break; case 'cleaned': cleaned($_POST['data']); break; case 'upemail': upemail($_POST['data']); break; case 'profile': profile($_POST['data']); break; default: wh_log('Request type "' . $_POST['type'] . '" unknown, ignoring.'); } } wh_log('Finished processing request.');