本文整理汇总了PHP中Sql_Fetch_Array_Query函数的典型用法代码示例。如果您正苦于以下问题:PHP Sql_Fetch_Array_Query函数的具体用法?PHP Sql_Fetch_Array_Query怎么用?PHP Sql_Fetch_Array_Query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Sql_Fetch_Array_Query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mergeUser
function mergeUser($userid)
{
$duplicate = Sql_Fetch_Array_Query("select * from {$GLOBALS["tables"]["user"]} where id = {$userid}");
printf('<br/>%s', $duplicate["email"]);
if (preg_match("/^duplicate[^ ]* (.*)/", $duplicate["email"], $regs)) {
print "-> " . $regs[1];
$email = $regs[1];
} elseif (preg_match("/^([^ ]+@[^ ]+) \\(\\d+\\)/", $duplicate["email"], $regs)) {
print "-> " . $regs[1];
$email = $regs[1];
} else {
$email = "";
}
if ($email) {
$orig = Sql_Fetch_Row_Query(sprintf('select id from %s where email = "%s"', $GLOBALS["tables"]["user"], $email));
if ($orig[0]) {
print " " . $GLOBALS['I18N']->get("user found");
$umreq = Sql_Query("select * from {$GLOBALS["tables"]["usermessage"]} where userid = " . $duplicate["id"]);
while ($um = Sql_Fetch_Array($umreq)) {
Sql_Query(sprintf('update %s set userid = %d, entered = "%s" where userid = %d and entered = "%s"', $GLOBALS["tables"]["usermessage"], $orig[0], $um["entered"], $duplicate["id"], $um["entered"]));
}
$bncreq = Sql_Query("select * from {$GLOBALS["tables"]["user_message_bounce"]} where user = " . $duplicate["id"]);
while ($bnc = Sql_Fetch_Array($bncreq)) {
Sql_Query(sprintf('update %s set user = %d, time = "%s" where user = %d and time = "%s"', $GLOBALS["tables"]["user_message_bounce"], $orig[0], $bnc["time"], $duplicate["id"], $bnc["time"]));
}
Sql_Query("delete from {$GLOBALS["tables"]["listuser"]} where userid = " . $duplicate["id"]);
} else {
print " " . $GLOBALS['I18N']->get("no user found");
}
flush();
} else {
print "-> " . $GLOBALS['I18N']->get("unable to find original email");
}
}
示例2: groupName
function groupName($id)
{
if (!$id) {
return;
}
$data = Sql_Fetch_Array_Query("select * from groups where id = {$id}");
return $data["name"];
}
示例3: mergeUser
function mergeUser($userid)
{
$duplicate = Sql_Fetch_Array_Query("select * from {$GLOBALS['tables']['user']} where id = {$userid}");
printf('<br/>%s', $duplicate['email']);
if (preg_match('/^duplicate[^ ]* (.*)/', $duplicate['email'], $regs)) {
print '-> ' . $regs[1];
$email = $regs[1];
} elseif (preg_match("/^([^ ]+@[^ ]+) \\(\\d+\\)/", $duplicate['email'], $regs)) {
print '-> ' . $regs[1];
$email = $regs[1];
} else {
$email = '';
}
if ($email) {
$orig = Sql_Fetch_Row_Query(sprintf('select id from %s where email = "%s"', $GLOBALS['tables']['user'], $email));
if ($orig[0]) {
print ' ' . $GLOBALS['I18N']->get('user found');
$umreq = Sql_Query("select * from {$GLOBALS['tables']['usermessage']} where userid = " . $duplicate['id']);
while ($um = Sql_Fetch_Array($umreq)) {
Sql_Query(sprintf('update %s set userid = %d, entered = "%s" where userid = %d and entered = "%s"', $GLOBALS['tables']['usermessage'], $orig[0], $um['entered'], $duplicate['id'], $um['entered']), 1);
}
$bncreq = Sql_Query("select * from {$GLOBALS['tables']['user_message_bounce']} where user = " . $duplicate['id']);
while ($bnc = Sql_Fetch_Array($bncreq)) {
Sql_Query(sprintf('update %s set user = %d, time = "%s" where user = %d and time = "%s"', $GLOBALS['tables']['user_message_bounce'], $orig[0], $bnc['time'], $duplicate['id'], $bnc['time']), 1);
}
Sql_Query("delete from {$GLOBALS['tables']['listuser']} where userid = " . $duplicate['id']);
Sql_Query("delete from {$GLOBALS['tables']['user_message_bounce']} where user = " . $duplicate['id']);
Sql_Query("delete from {$GLOBALS['tables']['usermessage']} where userid = " . $duplicate['id']);
if (MERGE_DUPLICATES_DELETE_DUPLICATE) {
deleteUser($duplicate['id']);
}
} else {
print ' ' . $GLOBALS['I18N']->get('no user found');
# so it must be save to rename the original to the actual email
Sql_Query(sprintf('update %s set email = "%s" where id = %d', $GLOBALS['tables']['user'], $email, $userid));
}
flush();
} else {
print '-> ' . $GLOBALS['I18N']->get('unable to find original email');
}
}
示例4: resendConfirm
function resendConfirm($id)
{
global $tables, $envelope, $prepend;
$userdata = Sql_Fetch_Array_Query("select * from {$tables["user"]} where id = {$id}");
$lists_req = Sql_Query(sprintf('select %s.name from %s,%s where
%s.listid = %s.id and %s.userid = %d', $tables["list"], $tables["list"], $tables["listuser"], $tables["listuser"], $tables["list"], $tables["listuser"], $id));
while ($row = Sql_Fetch_Row($lists_req)) {
$lists .= ' * ' . $row[0] . "\n";
}
if ($userdata["subscribepage"]) {
$subscribemessage = ereg_replace('\\[LISTS\\]', $lists, getUserConfig("subscribemessage:" . $userdata["subscribepage"], $id));
$subject = getConfig("subscribesubject:" . $userdata["subscribepage"]);
} else {
$subscribemessage = ereg_replace('\\[LISTS\\]', $lists, getUserConfig("subscribemessage", $id));
$subject = getConfig("subscribesubject");
}
logEvent("Resending confirmation request to " . $userdata["email"]);
if (!TEST) {
return sendMail($userdata["email"], $subject, $prepend . $subscribemessage, system_messageheaders($userdata["email"]), $envelope);
}
}
示例5: repeatMessage
function repeatMessage($msgid)
{
# if (!USE_REPETITION && !USE_rss) return;
$data = loadMessageData($msgid);
## do not repeat when it has already been done
if ($data['repeatinterval'] == 0 || !empty($data['repeatedid'])) {
return;
}
# calculate the future embargo, a multiple of repeatinterval minutes after the current embargo
$msgdata = Sql_Fetch_Array_Query(sprintf('SELECT *,
embargo +
INTERVAL (FLOOR(TIMESTAMPDIFF(MINUTE, embargo, GREATEST(embargo, NOW())) / repeatinterval) + 1) * repeatinterval MINUTE AS newembargo
FROM %s
WHERE id = %d AND now() < repeatuntil', $GLOBALS['tables']['message'], $msgid));
if (!$msgdata) {
logEvent("Message {$msgid} not repeated due to reaching the repeatuntil date");
return;
}
# check whether the new embargo is not on an exclusion
if (isset($GLOBALS['repeat_exclude']) && is_array($GLOBALS['repeat_exclude'])) {
$loopcnt = 0;
while (excludedDateForRepetition($msgdata['newembargo'])) {
if (++$loopcnt > 15) {
logEvent("Unable to find new embargo date too many exclusions? for message {$msgid}");
return;
}
$result = Sql_Fetch_Array_Query(sprintf("SELECT '%s' + INTERVAL repeatinterval MINUTE AS newembargo\n FROM %s\n WHERE id = %d", $msgdata['newembargo'], $GLOBALS['tables']['message'], $msgid));
$msgdata['newembargo'] = $result['newembargo'];
}
}
# copy the new message
Sql_Query(sprintf('
insert into %s (entered) values(now())', $GLOBALS['tables']['message']));
$newid = Sql_Insert_id();
require dirname(__FILE__) . '/structure.php';
if (!is_array($DBstruct['message'])) {
logEvent("Error including structure when trying to duplicate message {$msgid}");
return;
}
foreach ($DBstruct['message'] as $column => $rec) {
if ($column != 'id' && $column != 'entered' && $column != 'sendstart') {
Sql_Query(sprintf('update %s set %s = "%s" where id = %d', $GLOBALS['tables']['message'], $column, addslashes($msgdata[$column]), $newid));
}
}
$req = Sql_Query(sprintf("SELECT *\n FROM %s\n WHERE id = %d AND name NOT IN ('id')", $GLOBALS['tables']['messagedata'], $msgid));
while ($row = Sql_Fetch_Array($req)) {
setMessageData($newid, $row['name'], $row['data']);
}
Sql_Query(sprintf('update %s set embargo = "%s",status = "submitted",sent = "" where id = %d', $GLOBALS['tables']['message'], $msgdata['newembargo'], $newid));
list($e['year'], $e['month'], $e['day'], $e['hour'], $e['minute'], $e['second']) = sscanf($msgdata['newembargo'], '%04d-%02d-%02d %02d:%02d:%02d');
unset($e['second']);
setMessageData($newid, 'embargo', $e);
foreach (array('processed', 'astext', 'ashtml', 'astextandhtml', 'aspdf', 'astextandpdf', 'viewed', 'bouncecount') as $item) {
Sql_Query(sprintf('update %s set %s = 0 where id = %d', $GLOBALS['tables']['message'], $item, $newid));
}
# lists
$req = Sql_Query(sprintf('select listid from %s where messageid = %d', $GLOBALS['tables']['listmessage'], $msgid));
while ($row = Sql_Fetch_Row($req)) {
Sql_Query(sprintf('insert into %s (messageid,listid,entered) values(%d,%d,now())', $GLOBALS['tables']['listmessage'], $newid, $row[0]));
}
# attachments
$req = Sql_Query(sprintf('select * from %s,%s where %s.messageid = %d and %s.attachmentid = %s.id', $GLOBALS['tables']['message_attachment'], $GLOBALS['tables']['attachment'], $GLOBALS['tables']['message_attachment'], $msgid, $GLOBALS['tables']['message_attachment'], $GLOBALS['tables']['attachment']));
while ($row = Sql_Fetch_Array($req)) {
if (is_file($row['remotefile'])) {
# if the "remote file" is actually local, we want to refresh the attachment, so we set
# filename to nothing
$row['filename'] = '';
}
Sql_Query(sprintf('insert into %s (filename,remotefile,mimetype,description,size)
values("%s","%s","%s","%s",%d)', $GLOBALS['tables']['attachment'], addslashes($row['filename']), addslashes($row['remotefile']), addslashes($row['mimetype']), addslashes($row['description']), $row['size']));
$attid = Sql_Insert_id();
Sql_Query(sprintf('insert into %s (messageid,attachmentid) values(%d,%d)', $GLOBALS['tables']['message_attachment'], $newid, $attid));
}
logEvent("Message {$msgid} was successfully rescheduled as message {$newid}");
## remember we duplicated, in order to avoid doing it again (eg when requeuing)
setMessageData($msgid, 'repeatedid', $newid);
if (getConfig('pqchoice') == 'phplistdotcom') {
activateRemoteQueue();
}
}
示例6: ucfirst
print '<li><a href="#messages">' . ucfirst($GLOBALS['I18N']->get('Campaigns')) . '</a></li>';
if (count($bounces)) {
print '<li><a href="#bounces">' . ucfirst($GLOBALS['I18N']->get('Bounces')) . '</a></li>';
}
print '<li><a href="#subscription">' . ucfirst($GLOBALS['I18N']->get('Subscription')) . '</a></li>';
print '</ul>';
print '<div id="messages">';
print $ls->display();
print '</div>';
print '<div id="bounces">';
print $bouncels->display();
print '</div>';
print '<div id="subscription">';
if (isBlackListed($user['email'])) {
print '<h3>' . $GLOBALS['I18N']->get('subscriber is blacklisted since') . ' ';
$blacklist_info = Sql_Fetch_Array_Query(sprintf('select * from %s where email = "%s"', $tables['user_blacklist'], $user['email']));
print $blacklist_info['added'] . '</h3><br/>';
print '';
$isSpamReport = false;
$ls = new WebblerListing($GLOBALS['I18N']->get('Blacklist info'));
$req = Sql_Query(sprintf('select * from %s where email = "%s"', $tables['user_blacklist_data'], $user['email']));
while ($row = Sql_Fetch_Array($req)) {
$ls->addElement($row['name']);
$isSpamReport = $isSpamReport || $row['data'] == 'blacklisted due to spam complaints';
$ls->addColumn($row['name'], $GLOBALS['I18N']->get('value'), stripslashes($row['data']));
}
$ls->addElement('<!-- remove -->');
if (!$isSpamReport) {
$button = new ConfirmButton(htmlspecialchars($GLOBALS['I18N']->get('are you sure you want to delete this subscriber from the blacklist')) . '?\\n' . htmlspecialchars($GLOBALS['I18N']->get('it should only be done with explicit permission from this subscriber')), PageURL2("userhistory&unblacklist={$user['id']}&id={$user['id']}", 'button', s('remove subscriber from blacklist')), s('remove subscriber from blacklist'));
$ls->addRow('<!-- remove -->', s('remove'), $button->show());
} else {
示例7: Sql_query
} else {
Sql_query(sprintf('update %s set clicked = clicked + 1, latestclick = now() where forwardid = %d and messageid = %d', $GLOBALS['tables']['linktrack_ml'], $fwdid, $messageid));
}
if ($msgtype == 'H') {
Sql_query(sprintf('update %s set htmlclicked = htmlclicked + 1 where forwardid = %d and messageid = %d', $GLOBALS['tables']['linktrack_ml'], $fwdid, $messageid));
$trackingcode = 'utm_source=phplist' . $messageid . '&utm_medium=email&utm_content=HTML&utm_campaign=' . urlencode($messagedata['subject']);
} elseif ($msgtype == 'T') {
Sql_query(sprintf('update %s set textclicked = textclicked + 1 where forwardid = %d and messageid = %d', $GLOBALS['tables']['linktrack_ml'], $fwdid, $messageid));
$trackingcode = 'utm_source=phplist' . $messageid . '&utm_medium=email&utm_content=text&utm_campaign=' . urlencode($messagedata['subject']);
}
$viewed = Sql_Fetch_Row_query(sprintf('select viewed from %s where messageid = %d and userid = %d', $GLOBALS['tables']['usermessage'], $messageid, $userid));
if (!$viewed[0]) {
Sql_Query(sprintf('update %s set viewed = now() where messageid = %d and userid = %d', $GLOBALS['tables']['usermessage'], $messageid, $userid));
Sql_Query(sprintf('update %s set viewed = viewed + 1 where id = %d', $GLOBALS['tables']['message'], $messageid));
}
$uml = Sql_Fetch_Array_Query(sprintf('select * from %s where messageid = %d and forwardid = %d and userid = %d', $GLOBALS['tables']['linktrack_uml_click'], $messageid, $fwdid, $userid));
if (empty($uml['firstclick'])) {
Sql_query(sprintf('insert into %s set firstclick = now(), forwardid = %d, messageid = %d, userid = %d', $GLOBALS['tables']['linktrack_uml_click'], $fwdid, $messageid, $userid));
}
Sql_query(sprintf('update %s set clicked = clicked + 1, latestclick = now() where forwardid = %d and messageid = %d and userid = %d', $GLOBALS['tables']['linktrack_uml_click'], $fwdid, $messageid, $userid));
if ($msgtype == 'H') {
Sql_query(sprintf('update %s set htmlclicked = htmlclicked + 1 where forwardid = %d and messageid = %d and userid = %d', $GLOBALS['tables']['linktrack_uml_click'], $fwdid, $messageid, $userid));
} elseif ($msgtype == 'T') {
Sql_query(sprintf('update %s set textclicked = textclicked + 1 where forwardid = %d and messageid = %d and userid = %d', $GLOBALS['tables']['linktrack_uml_click'], $fwdid, $messageid, $userid));
}
$url = $linkdata['url'];
if ($linkdata['personalise']) {
$uid = Sql_Fetch_Row_Query(sprintf('select uniqid from %s where id = %d', $GLOBALS['tables']['user'], $userid));
if ($uid[0]) {
if (strpos($url, '?')) {
$url .= '&uid=' . $uid[0];
示例8: ucfirst
print '<li><a href="#messages">' . ucfirst($GLOBALS['I18N']->get('Campaigns')) . '</a></li>';
if (count($bounces)) {
print '<li><a href="#bounces">' . ucfirst($GLOBALS['I18N']->get('Bounces')) . '</a></li>';
}
print '<li><a href="#subscription">' . ucfirst($GLOBALS['I18N']->get('Subscription')) . '</a></li>';
print '</ul>';
print '<div id="messages">';
print $ls->display();
print '</div>';
print '<div id="bounces">';
print $bouncels->display();
print '</div>';
print '<div id="subscription">';
if (isBlackListed($user["email"])) {
print "<h3>" . $GLOBALS['I18N']->get('subscriber is blacklisted since') . " ";
$blacklist_info = Sql_Fetch_Array_Query(sprintf('select * from %s where email = "%s"', $tables["user_blacklist"], $user["email"]));
print $blacklist_info["added"] . "</h3><br/>";
print '';
$isSpamReport = false;
$ls = new WebblerListing($GLOBALS['I18N']->get('Blacklist info'));
$req = Sql_Query(sprintf('select * from %s where email = "%s"', $tables["user_blacklist_data"], $user["email"]));
while ($row = Sql_Fetch_Array($req)) {
$ls->addElement($row["name"]);
$isSpamReport = $isSpamReport || $row['data'] == 'blacklisted due to spam complaints';
$ls->addColumn($row["name"], $GLOBALS['I18N']->get('value'), stripslashes($row["data"]));
}
$ls->addElement('<!-- remove -->');
if (!$isSpamReport) {
$button = new ConfirmButton(htmlspecialchars($GLOBALS['I18N']->get('are you sure you want to delete this subscriber from the blacklist')) . "?\\n" . htmlspecialchars($GLOBALS['I18N']->get('it should only be done with explicit permission from this subscriber')), PageURL2("userhistory&unblacklist={$user["id"]}&id={$user["id"]}", "button", s('remove subscriber from blacklist')), s('remove subscriber from blacklist'));
$ls->addRow('<!-- remove -->', s('remove'), $button->show());
} else {
示例9: ob_end_clean
return;
break;
}
$download = !empty($_GET['dl']);
$downloadContent = '';
if ($download) {
ob_end_clean();
# header("Content-type: text/plain");
header('Content-type: text/csv');
header('Content-disposition: attachment; filename="phpList click statistics.csv"');
ob_start();
}
#$limit = ' limit 100';
$ls = new WebblerListing($GLOBALS['I18N']->get('Click statistics'));
if ($fwdid) {
$urldata = Sql_Fetch_Array_Query(sprintf('select url from %s where id = %d', $GLOBALS['tables']['linktrack_forward'], $fwdid));
}
if ($msgid) {
# $messagedata = Sql_Fetch_Array_query("SELECT * FROM {$tables['message']} where id = $msgid $subselect");
$messagedata = loadMessageData($msgid);
}
if ($userid) {
$userdata = Sql_Fetch_Array_query("SELECT * FROM {$tables['user']} where id = {$userid} {$subselect}");
}
if ($fwdid && $msgid) {
print '<h3>' . $GLOBALS['I18N']->get('Subscriber clicks for a URL in a campaign');
print ' ' . strtolower(PageLink2('uclicks&id=' . $fwdid, $urldata['url']));
print '</h3>';
$downloadContent = s('Subscribers who clicked on URL "%s" in the campaign with subject "%s", sent %s', $urldata['url'], $messagedata['subject'], $messagedata['sent']) . PHP_EOL;
print '<table class="userclicksDetails">';
if ($messagedata['subject'] != $messagedata['campaigntitle']) {
示例10: parseCline
$cline = parseCline();
reset($cline);
if (!$cline || !is_array($cline) || !$cline["s"] || !$cline["l"]) {
clineUsage("-s subject -l list [-f from] < message");
exit;
}
$listnames = explode(" ", $cline["l"]);
$listids = array();
foreach ($listnames as $listname) {
if (!is_numeric($listname)) {
$listid = Sql_Fetch_Array_Query(sprintf('select * from %s where name = "%s"', $tables["list"], $listname));
if ($listid["id"]) {
$listids[$listid["id"]] = $listname;
}
} else {
$listid = Sql_Fetch_Array_Query(sprintf('select * from %s where id = %d', $tables["list"], $listname));
if ($listid["id"]) {
$listids[$listid["id"]] = $listid["name"];
}
}
}
$_POST["targetlist"] = array();
foreach ($listids as $key => $val) {
$_POST["targetlist"][$key] = "signup";
$lists .= '"' . $val . '"' . " ";
}
if ($cline["f"]) {
$_POST["from"] = $cline["f"];
} else {
$_POST["from"] = getConfig("message_from_name") . ' ' . getConfig("message_from_address");
}
示例11: ob_end_clean
print '</p>';
if ($_GET['type'] == 'dl') {
ob_end_clean();
Header("Content-type: text/plain");
$filename = 'Bounces on ' . listName($listid);
header("Content-disposition: attachment; filename=\"{$filename}\"");
}
$currentlist = 0;
$ls = new WebblerListing('');
while ($row = Sql_Fetch_Array($req)) {
if ($currentlist != $row['listid']) {
if ($_GET['type'] != 'dl') {
print $ls->display();
}
$currentlist = $row['listid'];
flush();
$ls = new WebblerListing(listName($row['listid']));
}
$userdata = Sql_Fetch_Array_Query(sprintf('select * from %s where id = %d', $GLOBALS['tables']['user'], $row['userid']));
if ($_GET['type'] == 'dl') {
print $userdata['email'] . "\n";
}
$ls->addElement($row['userid'], PageUrl2('user&id=' . $row['userid']));
$ls->addColumn($row['userid'], $GLOBALS['I18N']->get('email'), $userdata['email']);
$ls->addColumn($row['userid'], $GLOBALS['I18N']->get('# bounces'), $row['numbounces']);
}
if ($_GET['type'] != 'dl') {
print $ls->display();
} else {
exit;
}
示例12: array
}
$find = $_SESSION["userlistfilter"]["find"];
$findby = $_SESSION["userlistfilter"]["findby"];
if (!$findby) {
$findby = "email";
}
# hmm interesting, if they select a findby but not a find, use the Sql wildcard:
if ($findby && !$find) {
# this is very slow, so instead erase the findby
# $find = '%';
$findby = '';
}
$system_findby = array("email", "foreignkey");
if ($findby && $find && !in_array($findby, $system_findby)) {
$find_url = '&find=' . urlencode($find) . "&findby=" . urlencode($findby);
$findatt = Sql_Fetch_Array_Query("select id,tablename,type,name from {$tables["attribute"]} where id = {$findby}");
switch ($findatt["type"]) {
case "textline":
case "hidden":
$findtables = ',' . $tables["user_attribute"];
$findbyselect = sprintf(' %s.userid = %s.id and
%s.attributeid = %d and %s.value like "%%%s%%"', $tables["user_attribute"], $tables["user"], $tables["user_attribute"], $findby, $tables["user_attribute"], $find);
$findfield = $tables["user_attribute"] . ".value as display, " . $tables["user"] . ".bouncecount";
$findfieldname = $findatt["name"];
break;
case "select":
case "radio":
$findtables = ',' . $tables["user_attribute"] . ',' . $table_prefix . 'listattr_' . $findatt["tablename"];
$findbyselect = sprintf(' %s.userid = %s.id and
%s.attributeid = %d and %s.value = %s.id and
%s.name like "%%%s%%"', $tables["user_attribute"], $tables["user"], $tables["user_attribute"], $findby, $tables["user_attribute"], $table_prefix . 'listattr_' . $findatt["tablename"], $table_prefix . 'listattr_' . $findatt["tablename"], $find);
示例13: while
while ($row = Sql_Fetch_Array($req)) {
$alive = checkLock($process_id);
if ($alive) {
keepLock($process_id);
} else {
bounceProcessError($GLOBALS['I18N']->get("Process Killed by other process"));
}
# cl_output(memory_get_usage());
# outputProcessBounce('User '.$row['user']);
$rule = matchBounceRules($row['header'] . "\n\n" . $row['data'], $bouncerules);
# outputProcessBounce('Action '.$rule['action']);
# outputProcessBounce('Rule'.$rule['id']);
$userdata = array();
if ($rule && is_array($rule)) {
if ($row['user']) {
$userdata = Sql_Fetch_Array_Query("select * from {$tables["user"]} where id = " . $row['user']);
}
$report_linkroot = $GLOBALS['admin_scheme'] . '://' . $GLOBALS['website'] . $GLOBALS['adminpages'];
Sql_Query(sprintf('update %s set count = count + 1 where id = %d', $GLOBALS['tables']['bounceregex'], $rule['id']));
Sql_Query(sprintf('insert ignore into %s (regex,bounce) values(%d,%d)', $GLOBALS['tables']['bounceregex_bounce'], $rule['id'], $row['bounce']));
switch ($rule['action']) {
case 'deleteuser':
logEvent('User ' . $userdata['email'] . ' deleted by bounce rule ' . PageLink2('bouncerule&id=' . $rule['id'], $rule['id']));
$advanced_report .= 'User ' . $userdata['email'] . ' deleted by bounce rule ' . $rule['id'] . "\n";
$advanced_report .= 'User: ' . $report_linkroot . '/?page=user&id=' . $userdata['id'] . "\n";
$advanced_report .= 'Rule: ' . $report_linkroot . '/?page=bouncerule&id=' . $rule['id'] . "\n";
deleteUser($row['user']);
break;
case 'unconfirmuser':
logEvent('User ' . $userdata['email'] . ' unconfirmed by bounce rule ' . PageLink2('bouncerule&id=' . $rule['id'], $rule['id']));
Sql_Query(sprintf('update %s set confirmed = 0 where id = %d', $GLOBALS['tables']['user'], $row['user']));
示例14: Sql_Query
$hash = '';
$id = 0;
}
if (isset($_POST['save']) && $_POST['save']) {
Sql_Query(sprintf('update %s set regex = "%s",action="%s", comment="%s",status = "%s" where id= %d', $GLOBALS['tables']['bounceregex'], trim($_POST['regex']), sql_escape($_POST['action']), sql_escape($_POST['comment']), sql_escape($_POST['status']), $_GET['id']), 1);
$num = Sql_Affected_Rows();
if ($num < 0) {
print $GLOBALS['I18N']->get('Updating the regular expression of this rule caused an Sql conflict<br/>This is probably because there is already a rule like that. Do you want to delete this rule instead?');
print '<p>' . PageLink2('bouncerules&del=' . $id, $GLOBALS['I18N']->get('Yes')) . ' ';
print PageLink2('bouncerules', $GLOBALS['I18N']->get('No')) . '</p>';
return;
}
Redirect('bouncerules' . $hash);
}
print '<p>' . PageLink2('bouncerules' . $hash, $GLOBALS['I18N']->get('back to list of bounce rules')) . '</p>';
$data = Sql_Fetch_Array_Query(sprintf('select * from %s where id = %d', $GLOBALS['tables']['bounceregex'], $id));
print '<form method=post>';
print '<table>';
printf('<tr><td>%s</td><td><input type=text name="regex" size=30 value="%s"></td></tr>', $GLOBALS['I18N']->get('Regular Expression'), htmlspecialchars($data['regex']));
printf('<tr><td>%s</td><td>%s</td></tr>', $GLOBALS['I18N']->get('Created By'), adminName($data['admin']));
printf('<tr><td>%s</td><td><select name="action">', $GLOBALS['I18N']->get('Action'));
foreach ($GLOBALS['bounceruleactions'] as $action => $desc) {
printf('<option value="%s" %s>%s</option>', $action, $data['action'] == $action ? 'selected' : '', $desc);
}
print '</select></td></tr>';
printf('<tr><td>%s</td><td><select name="status">', $GLOBALS['I18N']->get('Status'));
printf('<option value="none">[%s]</option>', $GLOBALS['I18N']->get('Select Status'));
foreach (array('active', 'candidate') as $type) {
printf('<option value="%s" %s>%s</option>', $type, $data['status'] == $type ? 'selected' : '', $GLOBALS['I18N']->get($type));
}
print '</select></td></tr>';
示例15: loadUser
function loadUser($loginname = '')
{
if (!Sql_Table_exists('user')) {
return;
}
initialiseUserSession();
if (!$loginname) {
if ($_SESSION['userloggedin'] != '' && $_SESSION['username'] != '') {
$loginname = $_SESSION['username'];
} else {
return '';
}
}
$att_req = Sql_Query(sprintf('select attribute.id,
%s.name,%s.type,
%s.value,%s.tablename from %s,%s,%s
where %s.userid = %s.id and %s.email = "%s" and %s.id = %s.attributeid', 'attribute', 'attribute', 'user_attribute', 'attribute', 'user', 'user_attribute', 'attribute', 'user_attribute', 'user', 'user', addslashes($loginname), 'attribute', 'user_attribute'));
while ($att = Sql_fetch_array($att_req)) {
# if (!defined($_SESSION["userdata"]["attribute".$att["id"]])) {
$_SESSION['userdata']['attribute' . $att['id']] = array('name' => $att['name'], 'value' => $att['value'], 'type' => $att['type'], 'attid' => $att['id'], 'displayvalue' => $att['value']);
switch ($att['type']) {
case 'textline':
case 'hidden':
$_SESSION['userdata']['attribute' . $att['id']]['displayvalue'] = $att['value'];
break;
case 'creditcardno':
$_SESSION['userdata']['attribute' . $att['id']]['displayvalue'] = obscureCreditCard($att['value']);
break;
case 'select':
$_SESSION['userdata']['attribute' . $att['id']]['displayvalue'] = AttributeValue($att['tablename'], $att['value']);
break;
case 'date':
$_SESSION['userdata']['attribute' . $att['id']]['displayvalue'] = formatDate($att['value']);
break;
}
# }
}
$d_req = Sql_Fetch_Array_Query("select * from user where email = \"{$loginname}\"");
$_SESSION['userid'] = $d_req['id'];
foreach (array('email', 'disabled', 'confirmed', 'htmlemail', 'uniqid', 'password', 'foreignkey') as $field) {
# if (!defined($_SESSION["userdata"][$field])) {
$_SESSION['userdata'][$field] = array('name' => $field, 'value' => $d_req[$field], 'type' => 'static', 'displayvalue' => $d_req[$field]);
# }
}
$_SESSION['usergroups'] = userGroups($loginname);
if (is_array($GLOBALS['config']['usergreeting'])) {
$_SESSION['usergreeting'] = '';
foreach ($GLOBALS['config']['usergreeting'] as $att) {
$_SESSION['usergreeting'] .= $_SESSION['userdata'][$att]['displayvalue'] . ' ';
}
$_SESSION['usergreeting'] = rtrim($_SESSION['usergreeting']);
}
dbg('done loading user');
return 1;
}