本文整理汇总了PHP中unsubscribe函数的典型用法代码示例。如果您正苦于以下问题:PHP unsubscribe函数的具体用法?PHP unsubscribe怎么用?PHP unsubscribe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unsubscribe函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: response
/**
* 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;
}
示例2: switch
}
//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();
示例3: translate
} 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;
}
示例4: print_r
// 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);
示例5: clearOneTestsolveRequest
}
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.
示例6: count
// 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.
示例7: page_head
{
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;
}
}
?>
示例8: log_campaign_activity
}
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 "*";
示例9: stream_get_line
<?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}";
示例10: web_hook
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.');
}
示例11: elseif
$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) {
?>
示例12: switch
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, "");
示例13: display_login_form
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();
?>
示例14: subscribe
</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>
示例15: empty
* 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,