本文整理汇总了PHP中Sql_Fetch_Row_Query函数的典型用法代码示例。如果您正苦于以下问题:PHP Sql_Fetch_Row_Query函数的具体用法?PHP Sql_Fetch_Row_Query怎么用?PHP Sql_Fetch_Row_Query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Sql_Fetch_Row_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: 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');
}
}
示例3: isSuperUser
function isSuperUser()
{
## for now mark webbler admins superuser
if (defined('WEBBLER') || defined('IN_WEBBLER')) {
return 1;
}
global $tables;
$issuperuser = 0;
# if (!isset($_SESSION["adminloggedin"])) return 0;
# if (!is_array($_SESSION["logindetails"])) return 0;
if (isset($_SESSION["logindetails"]["superuser"])) {
return $_SESSION["logindetails"]["superuser"];
}
if (isset($_SESSION["logindetails"]["id"])) {
if (is_object($GLOBALS["admin_auth"])) {
$issuperuser = $GLOBALS["admin_auth"]->isSuperUser($_SESSION["logindetails"]["id"]);
} else {
$req = Sql_Fetch_Row_Query(sprintf('select superuser from %s where id = %d', $tables["admin"], $_SESSION["logindetails"]["id"]));
$issuperuser = $req[0];
}
$_SESSION["logindetails"]["superuser"] = $issuperuser;
}
return $issuperuser;
}
示例4: array
$lists = array();
while ($row = Sql_Fetch_Row($req)) {
if ($allactive && $row[1] || $all) {
$lists[$row[0]] = $row[0];
}
}
}
unset($lists['all']);
unset($lists['allactive']);
if (isset($messagedata['excludelist']) && is_array($messagedata['excludelist']) && count($messagedata['excludelist'])) {
$exclude = sprintf(' and listuser.listid not in (%s)', implode(',', $messagedata['excludelist']));
} else {
$exclude = '';
}
$htmlcnt = Sql_Fetch_Row_Query(sprintf('select count(distinct userid) from %s listuser,%s user where user.htmlemail and user.id = listuser.userid and listuser.listid in (%s) %s', $GLOBALS['tables']['listuser'], $GLOBALS['tables']['user'], implode(',', array_keys($lists)), $exclude), 1);
$textcnt = Sql_Fetch_Row_Query(sprintf('select count(distinct userid) from %s listuser,%s user where !user.htmlemail and user.id = listuser.userid and listuser.listid in (%s) %s', $GLOBALS['tables']['listuser'], $GLOBALS['tables']['user'], implode(',', array_keys($lists)), $exclude), 1);
if ($htmlcnt[0] || $textcnt[0]) {
if (!isset($messagedata['textsize'])) {
$messagedata['textsize'] = 0;
}
if (!isset($messagedata['htmlsize'])) {
$messagedata['htmlsize'] = 0;
}
$send_content .= $GLOBALS['I18N']->get('Estimated size of mailout') . ': ' . formatBytes($htmlcnt[0] * $messagedata['htmlsize'] + $textcnt[0] * $messagedata['textsize']) . '<br/>';
## remember this to see how well the estimate was
Sql_Query(sprintf('replace into %s set name = "estimatedsize",id=%d,data = "%s"', $GLOBALS['tables']['messagedata'], $id, $htmlcnt[0] * $messagedata['htmlsize'] + $textcnt[0] * $messagedata['textsize']));
$send_content .= sprintf($GLOBALS['I18N']->get('About %d users to receive HTML and %s users to receive text version of email'), $htmlcnt[0], $textcnt[0]) . '<br/>';
Sql_Query(sprintf('replace into %s set name = "estimatedhtmlusers",id=%d,data = "%s"', $GLOBALS['tables']['messagedata'], $id, $htmlcnt[0]));
Sql_Query(sprintf('replace into %s set name = "estimatedtextusers",id=%d,data = "%s"', $GLOBALS['tables']['messagedata'], $id, $textcnt[0]));
}
}
示例5: saveUser
function saveUser($loginname,$data) {
# saves user to database
$id_req = Sql_Fetch_Row_Query("select id from user where email = \"$loginname\"");
if ($id_req[0]) {
$userid = $id_req[0];
while (list($key,$val) = each($data)) {
if (ereg("^attribute(\d+)",$key,$regs)) {
$attid = $regs[1];
}
dbg("Saving attribute $key, $attid, $val for $loginname, $userid");
if ($userid && $attid)
saveUserAttribute($userid,$key,$val);
}
}
return 1;
}
示例6: parseDelimitedData
$crit_data = parseDelimitedData($messagedata[sprintf('criterion%d', $i)]);
if ($crit_data["attribute"]) {
array_push($used_attributes, $crit_data["attribute"]);
$ls->addElement('<!--' . $crit_data["attribute"] . '-->' . $crit_data["attribute_name"]);
$ls->addColumn('<!--' . $crit_data["attribute"] . '-->' . $crit_data["attribute_name"], $GLOBALS['I18N']->get('operator'), $GLOBALS['I18N']->get($crit_data["operator"]));
$ls->addColumn('<!--' . $crit_data["attribute"] . '-->' . $crit_data["attribute_name"], $GLOBALS['I18N']->get('values'), $crit_data["values"]);
$ls->addColumn('<!--' . $crit_data["attribute"] . '-->' . $crit_data["attribute_name"], $GLOBALS['I18N']->get('remove'), PageLink2($delete_base . "&deleterule=" . $i, $GLOBALS['I18N']->get("remove")));
if (isset($_POST["criteria"][$i])) {
$attribute = $_POST["criteria"][$i];
} else {
$attribute = '';
}
## fix 6063
$crit_data["values"] = str_replace(" ", "", $crit_data["values"]);
# hmm, rather get is some other way, this is a bit unnecessary
$type = Sql_Fetch_Row_Query("select type from {$tables["attribute"]} where id = " . $crit_data["attribute"]);
$operator = $where_clause = $select_clause = "";
switch ($type[0]) {
case "checkboxgroup":
$or_clause = '';
if ($tc) {
$where_clause .= " {$mainoperator} ";
$select_clause .= " left join {$tables['user_attribute']} as table{$tc} on table0.userid = table{$tc}.userid ";
} else {
$select_clause = "table{$tc}.userid from {$tables['user_attribute']} as table{$tc} ";
}
$where_clause .= " ( table{$tc}.attributeid = " . $crit_data["attribute"] . " and (";
if ($crit_data["operator"] == "is") {
$operator = ' or ';
$compare = ' > ';
} else {
示例7: isSuperUser
function isSuperUser()
{
global $tables;
if (!isset($_SESSION["adminloggedin"])) {
return 0;
}
if (!is_array($_SESSION["logindetails"])) {
return 0;
}
if (isset($_SESSION["logindetails"]["superuser"])) {
return $_SESSION["logindetails"]["superuser"];
}
if ($GLOBALS["require_login"]) {
if (is_object($GLOBALS["admin_auth"])) {
$issuperuser = $GLOBALS["admin_auth"]->isSuperUser($_SESSION["logindetails"]["id"]);
} else {
$req = Sql_Fetch_Row_Query(sprintf('select superuser from %s where id = %d', $tables["admin"], $_SESSION["logindetails"]["id"]));
$issuperuser = $req[0];
}
$_SESSION["logindetails"]["superuser"] = $issuperuser;
return $issuperuser;
}
}
示例8: elseif
} elseif (is_file('config/config.php')) {
include 'config/config.php';
} else {
print "Error, cannot find config file\n";
exit;
}
require_once dirname(__FILE__) . '/admin/init.php';
$GLOBALS['database_module'] = basename($GLOBALS['database_module']);
$GLOBALS['language_module'] = basename($GLOBALS['language_module']);
require_once dirname(__FILE__) . '/admin/' . $GLOBALS['database_module'];
# load default english and language
include_once dirname(__FILE__) . '/texts/english.inc';
# Allow customisation per installation
if (is_file($_SERVER['DOCUMENT_ROOT'] . '/' . $GLOBALS['language_module'])) {
include_once $_SERVER['DOCUMENT_ROOT'] . '/' . $GLOBALS['language_module'];
}
include_once dirname(__FILE__) . '/admin/languages.php';
require_once dirname(__FILE__) . '/admin/defaultconfig.php';
require_once dirname(__FILE__) . '/admin/connect.php';
include_once dirname(__FILE__) . '/admin/lib.php';
if (!empty($_GET['u']) && !empty($_GET['m'])) {
$_GET['u'] = preg_replace('/\\W/', '', $_GET['u']);
$userid = Sql_Fetch_Row_Query(sprintf('select id from %s where uniqid = "%s"', $GLOBALS['tables']['user'], $_GET['u']));
if ($userid[0]) {
Sql_Query(sprintf('update %s set viewed = now() where messageid = %d and userid = %d and viewed is null', $GLOBALS['tables']['usermessage'], $_GET['m'], $userid[0]));
Sql_Query(sprintf('update %s set viewed = viewed + 1 where id = %d', $GLOBALS['tables']['message'], $_GET['m']));
}
}
@ob_end_clean();
header('Content-Type: image/png');
print base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAABGdBTUEAALGPC/xhBQAAAAZQTFRF////AAAAVcLTfgAAAAF0Uk5TAEDm2GYAAAABYktHRACIBR1IAAAACXBIWXMAAAsSAAALEgHS3X78AAAAB3RJTUUH0gQCEx05cqKA8gAAAApJREFUeJxjYAAAAAIAAUivpHEAAAAASUVORK5CYII=');
示例9: saveUser
function saveUser($loginname, $data)
{
dbg("Saving user {$loginname}");
# saves user to database
$id_req = Sql_Fetch_Row_Query("select id from user where email = \"{$loginname}\"");
if ($id_req[0]) {
$userid = $id_req[0];
while (list($key, $val) = each($data)) {
if (preg_match("/^attribute(\\d+)/", $key, $regs)) {
$attid = $regs[1];
}
# dbg("Saving attribute $key, $attid, $val for $loginname, $userid");
if ($userid && $attid) {
saveUserAttribute($userid, $key, $val);
}
}
}
return 1;
}
示例10: Sql_Fetch_Row_Query
## blacklist an email from commandline
if (!$GLOBALS['commandline']) {
print 'Error, this can only be called from commandline' . "\n";
exit;
}
$email = $date = $uid = '';
if (isset($cline['e'])) {
$email = $cline['e'];
}
if (isset($cline['u'])) {
$uid = $cline['u'];
}
if (isset($cline['d'])) {
$date = $cline['d'];
}
$emailQ = Sql_Fetch_Row_Query(sprintf('select email from %s where uniqid = "%s" or email = "%s" order by email desc', $GLOBALS['tables']['user'], sql_escape($uid), sql_escape($email)));
$emailDB = $emailQ[0];
if (empty($emailDB) && empty($email)) {
cl_output('FAIL');
exit;
}
if (isBlackListed($emailDB)) {
## do this anyway, just to be sure
Sql_Query(sprintf('update %s set blacklisted = 1 where email = "%s"', $GLOBALS['tables']['user'], $emailDB));
cl_output('OK');
exit;
}
if (!empty($emailDB)) {
## do this immediately
Sql_Query(sprintf('update %s set blacklisted = 1 where email = "%s"', $GLOBALS['tables']['user'], $emailDB));
addEmailToBlackList($emailDB, 'blacklisted due to spam complaints', $date);
示例11: RSSOptions
function RSSOptions($data,$userid = 0) {
global $rssfrequencies,$tables;
if ($userid) {
$current = Sql_Fetch_Row_Query("select rssfrequency from {$tables["user"]} where id = $userid");
$default = $current[0];
}
if (!$default || !in_array($default,array_keys($rssfrequencies))) {
$default = $data["rssdefault"];
}
$html = "\n<table>";
$html .= '<tr><td>'.$data["rssintro"].'</td></tr>';
$html .= '<tr><td>';
$options = explode(",",$data["rss"]);
if (!in_array($data["rssdefault"],$options)) {
array_push($options,$data["rssdefault"]);
}
foreach ($options as $freq) {
$html .= sprintf('<input type=radio name="rssfrequency" value="%s" %s> %s ',
$freq,$freq == $default ? "checked":"",$rssfrequencies[$freq]);
}
$html .= '</td></tr></table>';
if ($data["rssintro"])
return $html;
}
示例12: output
} else {
output($GLOBALS['I18N']->get('Warning, disabling exclusion of done users, too many found'));
logEvent($GLOBALS['I18N']->get('Warning, disabling exclusion of done users, too many found'));
}
# also exclude unconfirmed users, otherwise they'll block the process
# will give quite different statistics than when used web based
# $req = Sql_Query("select id from {$tables["user"]} where !confirmed");
# while ($row = Sql_Fetch_Row($req)) {
# array_push($doneusers,$row[0]);
# }
if (sizeof($doneusers))
$exclusion = " and listuser.userid not in (".join(",",$doneusers).")";
*/
if (USE_LIST_EXCLUDE) {
$excluded_lists = Sql_Fetch_Row_Query(sprintf('select data from %s where name = "excludelist" and id = %d', $GLOBALS["tables"]["messagedata"], $messageid));
if (strlen($excluded_lists[0])) {
$req = Sql_Query(sprintf('select listuser.userid from %s as listuser where listid in (%s)', $GLOBALS["tables"]["listuser"], $excluded_lists[0]));
while ($row = Sql_Fetch_Row($req)) {
array_push($skipusers, $row[0]);
}
$query .= sprintf(' and listuser.listid not in (%s)', $excluded_lists[0]);
}
if (sizeof($skipusers)) {
$exclusion .= " and listuser.userid not in (" . join(",", $skipusers) . ")";
}
}
$userconfirmed = ' and user.confirmed and !user.blacklisted ';
/*
## 8478
$query = sprintf('select distinct user.id from
示例13: min
$safemode = 0;
if (ini_get('safe_mode')) {
# keep an eye on timeouts
$safemode = 1;
$counters['num_per_batch'] = min(100, $counters['num_per_batch']);
print $GLOBALS['I18N']->get('Running in safe mode') . '<br/>';
}
$original_num_per_batch = $counters['num_per_batch'];
if ($counters['num_per_batch'] && $batch_period) {
# check how many were sent in the last batch period and take off that
# amount from this batch
/*
processQueueOutput(sprintf('select count(*) from %s where entered > date_sub(now(),interval %d second) and status = "sent"',
$tables["usermessage"],$batch_period));
*/
$recently_sent = Sql_Fetch_Row_Query(sprintf('select count(*) from %s where entered > date_sub(now(),interval %d second) and status = "sent"', $tables['usermessage'], $batch_period));
cl_output('Recently sent : ' . $recently_sent[0]);
$counters['num_per_batch'] -= $recently_sent[0];
# if this ends up being 0 or less, don't send anything at all
if ($counters['num_per_batch'] == 0) {
$counters['num_per_batch'] = -1;
}
}
# output some stuff to make sure it's not buffered in the browser
for ($i = 0; $i < 10000; ++$i) {
print ' ';
if ($i % 100 == 0) {
print "\n";
}
}
print '<style type="text/css" src="css/app.css"></style>';
示例14: verifyToken
function verifyToken()
{
if (empty($_POST['formtoken'])) {
return false;
}
## @@@TODO for now ignore the error. This will cause a block on editing admins if the table doesn't exist.
$req = Sql_Fetch_Row_Query(sprintf('select id from %s where adminid = %d and value = "%s" and expires > now()', $GLOBALS['tables']['admintoken'], $_SESSION['logindetails']['id'], sql_escape($_POST['formtoken'])), 1);
if (empty($req[0])) {
return false;
}
Sql_Query(sprintf('delete from %s where id = %d', $GLOBALS['tables']['admintoken'], $req[0]), 1);
Sql_Query(sprintf('delete from %s where expires < now()', $GLOBALS['tables']['admintoken']), 1);
return true;
}
示例15: elseif
}
} elseif (isset($_POST['tagaction']) && is_array($_POST['tag'])) {
ksort($_POST['tag']);
if (isset($_POST['tagaction']['delete'])) {
while (list($k, $id) = each($_POST['tag'])) {
# check for dependencies
$id = sprintf('%d', $id);
if ($formtable_exists) {
$req = Sql_Query("select * from formfield where attribute = {$id}");
$candelete = !Sql_Affected_Rows();
} else {
$candelete = 1;
}
if ($candelete) {
print s('deleting') . " {$id}<br/>";
$row = Sql_Fetch_Row_Query("select tablename,type from {$tables['attribute']} where id = {$id}");
Sql_Query("drop table if exists {$table_prefix}" . "listattr_{$row['0']}");
Sql_Query("delete from {$tables['attribute']} where id = {$id}");
# delete all user attributes as well
Sql_Query("delete from {$tables['user_attribute']} where attributeid = {$id}");
} else {
print Error($GLOBALS['I18N']->get('Cannot delete attribute, it is being used by the following forms:') . '<br/>');
while ($row = Sql_Fetch_Array($req)) {
print PageLink2('editelements&id=' . $row['form'] . '&option="edit_elements"&pi="formbuilder"', 'form ' . $row['form'] . '') . "<br/>\n";
}
}
}
} elseif (isset($_POST['tagaction']['merge'])) {
$first = array_shift($_POST['tag']);
$firstdata = Sql_Fetch_Array_Query(sprintf('select * from %s where id = %d', $tables['attribute'], $first));
$first = $firstdata['id'];