本文整理汇总了PHP中Sql_Num_Rows函数的典型用法代码示例。如果您正苦于以下问题:PHP Sql_Num_Rows函数的具体用法?PHP Sql_Num_Rows怎么用?PHP Sql_Num_Rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Sql_Num_Rows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
// $formatting_content .= '/>';
foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
$plugins_sendformats = $plugin->sendFormats();
if (is_array($plugins_sendformats) && sizeof($plugins_sendformats)) {
foreach ($plugins_sendformats as $val => $desc) {
$val = preg_replace("/\\W/", '', strtolower(trim($val)));
if ($val[0] != '_') {
## allow a plugin to add a format that is not actually displayed
$formatting_content .= sprintf('%s <input type="radio" name="sendformat" value="%s" %s />', $desc, $val, $messagedata["sendformat"] == $val ? 'checked="checked"' : '');
}
}
}
}
$formatting_content .= '</div>';
$req = Sql_Query("select id,title from {$tables["template"]} order by listorder");
if (Sql_Num_Rows($req)) {
$formatting_content .= '<div class="field"><label for="template">' . $GLOBALS['I18N']->get("Use Template") . Help("usetemplate") . '</label>' . '
<select name="template"><option value="0">-- ' . $GLOBALS['I18N']->get("select one") . '</option>';
$req = Sql_Query("select id,title from {$tables["template"]} order by listorder");
while ($row = Sql_Fetch_Array($req)) {
if ($row["title"]) {
$formatting_content .= sprintf('<option value="%d" %s>%s</option>', $row["id"], $row["id"] == $messagedata["template"] ? 'selected="selected"' : '', $row["title"]);
}
}
$formatting_content .= '</select></div>';
}
$formatting_content .= '</div>';
#0013076: different content when forwarding 'to a friend'
$maincontent .= '<div id="messagecontent" class="field"><label for="message">' . s("Compose Message") . Help("message") . '</label> ';
$forwardcontent .= '<div id="messagecontent" class="field"><label for="forwardmessage">' . s("Compose Message") . Help("forwardmessage") . '</label> ';
if (!empty($GLOBALS['editorplugin'])) {
示例2: Sql_Query
if ($_GET['delete'] == 'alldraft') {
$req = Sql_Query(sprintf('select id from %s where status = "draft" %s', $GLOBALS['tables']['message'], $ownership));
while ($row = Sql_Fetch_Row($req)) {
deleteMessage($row[0]);
}
$_SESSION['action_result'] = $GLOBALS['I18N']->get('All draft campaigns deleted');
print Info($GLOBALS['I18N']->get('campaigns deleted'));
} else {
verifyCsrfGetToken();
deleteMessage(sprintf('%d', $_GET['delete']));
print Info($GLOBALS['I18N']->get('campaign deleted'));
$_SESSION['action_result'] = $GLOBALS['I18N']->get('Campaign deleted');
}
}
$req = Sql_Query(sprintf('select id,entered,subject,unix_timestamp(now()) - unix_timestamp(entered) as age from %s where status = "draft" %s order by entered desc', $GLOBALS['tables']['message'], $ownership));
$numdraft = Sql_Num_Rows($req);
if ($numdraft > 0 && !isset($_GET['id']) && !isset($_GET['new'])) {
print '<p>' . PageLinkActionButton('send&new=1', $I18N->get('start a new message'), '', '', s('Start a new campaign')) . '</p>';
print '<p><h3>' . $I18N->get('Choose an existing draft message to work on') . '</h3></p><br/>';
$ls = new WebblerListing($I18N->get('Draft messages'));
$ls->noShader();
while ($row = Sql_Fetch_Array($req)) {
$element = '<!--' . $row['id'] . '-->' . $row['subject'];
$ls->addElement($element, PageUrl2('send&id=' . $row['id']));
$ls->setClass($element, 'row1');
# $ls->addColumn($element,$I18N->get('edit'),PageLink2('send&id='.$row['id'],$I18N->get('edit')));
$ls->addColumn($element, $I18N->get('entered'), $row['entered']);
$ls->addColumn($element, $I18N->get('age'), secs2time($row['age']));
$ls->addRow($element, '', '<a class="del" href="' . PageUrl2('send&delete=' . $row['id']) . '" title="' . $I18N->get('del') . '">' . $I18N->get('del') . '</a>');
}
$ls->addButton($I18N->get('delete all'), PageUrl2('send&delete=alldraft'));
示例3: saveImageData
private function saveImageData($msgdata = array())
{
$imgtbl = $GLOBALS['tables']['inlineImagePlugin_image'];
$msgtbl = $GLOBALS['tables']['inlineImagePlugin_msg'];
$id = $msgdata['id'];
$msg = $msgdata['message'];
$query = sprintf("select * from %s where id=%d", $msgtbl, $id);
// Merge the message and template to check the images
// Make sure that we have all parts of the message that may contain images
if ($msgdata["template"]) {
$template = $this->loadTemplate($msgdata["template"]);
if (strpos($template, "[CONTENT]")) {
$msg = str_replace("[CONTENT]", $msg, $template);
}
}
if (strpos($msg, "[FOOTER]") !== false) {
$msg = str_ireplace("[FOOTER]", $msgdata["footer"], $msg);
} else {
// Phplist always adds a footer.
$msg .= $msgdata["footer"];
}
// We're not constructing the message, just collecting inline image files
// Remove old data connecting this message with its images.We save the new data
// below. We don't bother clearing old images from the
// directory here, because they will eventually be deleted anyway, as we clean
// older files from the database
if (Sql_Num_Rows(Sql_Query($query)) > 0) {
$query = sprintf("delete from %s where id=%d", $msgtbl, $id);
Sql_Query($query);
}
// Collect the inline image tags
preg_match_all('#<img[^<>]+\\Winline(?:\\W.*(?:/)?)?>#Ui', $msg, $match);
//Store everything needed for rapid processing of messages
foreach ($match[0] as $val) {
$src = $this->getAttribute($val, "src");
$fcontents = file_get_contents($src);
$hsh = sha1($fcontents);
// Use a checksum to distinguish different files with same name
$filename = basename($src);
$query = sprintf("select imgid, cid, local_name from %s where file_name='%s' and cksum='%s'", $imgtbl, $filename, $hsh);
if (!($row = Sql_Fetch_Row_Query($query))) {
$localfile = $this->getTempFilename($filename);
// File name in image directory
file_put_contents($localfile, $fcontents);
$type = $this->getMimeType(pathInfo($src, PATHINFO_EXTENSION), $localfile);
$cid = md5(uniqid(rand(), true));
$query_i = sprintf("insert into %s (file_name, cksum, local_name, type, cid) values ('%s', '%s', '%s', '%s', '%s')", $imgtbl, sql_escape($filename), sql_escape($hsh), sql_escape($localfile), sql_escape($type), sql_escape($cid));
Sql_Query($query_i);
$row = Sql_Fetch_Row_Query($query);
} else {
if (!file_exists($row[2])) {
// We've had the image before, but it has
// been stored in the plugin only as a temporary file
// which may have been deleted
$localfile = $this->getTempFilename($filename);
file_put_contents($localfile, $fcontents);
$query_u = sprintf("update %s set local_name='%s' where imgid=%d", $imgtbl, $localfile, $row[0]);
Sql_Query($query_u);
$row = Sql_Fetch_Row_Query($query);
} else {
// The image exists in the image directory
touch($row[2]);
// Flag that image file was recently used
}
}
// Associate the image with the message
// Any previous entries for this message ID have been deleted when we test
// if a test message is OK or when we check if the message can be queued.
$srcstr = $this->getAttribute($val, "src", 0);
$imgtag = str_replace($srcstr, 'src="cid:' . $row[1] . '"', $val);
$query_m = sprintf("insert into %s values (%d, %d, '%s','%s')", $msgtbl, $id, $row[0], sql_escape($val), sql_escape($imgtag));
Sql_Query($query_m);
}
}
示例4: getPageLock
function getPageLock($force = 0)
{
global $tables;
$thispage = $GLOBALS['page'];
if ($thispage == 'pageaction') {
$thispage = $_GET['action'];
}
$thispage = preg_replace('/\\W/', '', $thispage);
# cl_output('getting pagelock '.$thispage);
# ob_end_flush();
if ($GLOBALS['commandline'] && $thispage == 'processqueue') {
if (is_object($GLOBALS['MC'])) {
## multi-send requires a valid memcached setup
$max = MAX_SENDPROCESSES;
} else {
$max = 1;
}
} else {
$max = 1;
}
## allow killing other processes
if ($force) {
Sql_query('delete from ' . $tables['sendprocess'] . ' where page = "' . sql_escape($thispage) . '"');
}
$running_req = Sql_query(sprintf('select now() - modified as age,id from %s where page = "%s" and alive order by started desc', $tables['sendprocess'], sql_escape($thispage)));
$count = Sql_Num_Rows($running_req);
$running_res = Sql_Fetch_Assoc($running_req);
$waited = 0;
# while ($running_res['age'] && $count >= $max) { # a process is already running
while ($count >= $max) {
# don't check age, as it may be 0
# cl_output('running process: '.$running_res['age'].' '.$max);
if ($running_res['age'] > 600) {
# some sql queries can take quite a while
#cl_output($running_res['id'].' is old '.$running_res['age']);
# process has been inactive for too long, kill it
Sql_query("update {$tables['sendprocess']} set alive = 0 where id = " . $running_res['id']);
} elseif ((int) $count >= (int) $max) {
# cl_output (sprintf($GLOBALS['I18N']->get('A process for this page is already running and it was still alive %s seconds ago'),$running_res['age']));
output(s('A process for this page is already running and it was still alive %d seconds ago', $running_res['age']), 0);
sleep(1);
# to log the messages in the correct order
if ($GLOBALS['commandline']) {
cl_output(s('A process for this page is already running and it was still alive %d seconds ago', $running_res['age']), 0);
cl_output($GLOBALS['I18N']->get('Running commandline, quitting. We\'ll find out what to do in the next run.'));
exit;
}
output($GLOBALS['I18N']->get('Sleeping for 20 seconds, aborting will quit'), 0);
flush();
$abort = ignore_user_abort(0);
sleep(20);
}
++$waited;
if ($waited > 10) {
# we have waited 10 cycles, abort and quit script
output($GLOBALS['I18N']->get('We have been waiting too long, I guess the other process is still going ok'), 0);
return false;
}
$running_req = Sql_query('select now() - modified,id from ' . $tables['sendprocess'] . " where page = \"{$thispage}\" and alive order by started desc");
$count = Sql_Num_Rows($running_req);
$running_res = Sql_Fetch_row($running_req);
}
if (!empty($GLOBALS['commandline'])) {
$processIdentifier = SENDPROCESS_SERVERNAME . ':' . getmypid();
} else {
$processIdentifier = $_SERVER['REMOTE_ADDR'];
}
$res = Sql_query('insert into ' . $tables['sendprocess'] . ' (started,page,alive,ipaddress) values(now(),"' . $thispage . '",1,"' . $processIdentifier . '")');
$send_process_id = Sql_Insert_Id();
$abort = ignore_user_abort(1);
# cl_output('Got pagelock '.$send_process_id );
return $send_process_id;
}
示例5: Sql_Query
$result = Sql_Query($query);
}
$buttons = new ButtonGroup(new Button(PageURL2('bounces'), s('delete')));
$buttons->addButton(new ConfirmButton($GLOBALS['I18N']->get('are you sure you want to delete all unidentified bounces older than 2 months') . '?', PageURL2("{$baseurl}&action=deleteunidentified"), $GLOBALS['I18N']->get('delete all unidentified (> 2 months old)')));
$buttons->addButton(new ConfirmButton($GLOBALS['I18N']->get('are you sure you want to delete all bounces older than 2 months') . '?', PageURL2("{$baseurl}&action=deleteprocessed"), $GLOBALS['I18N']->get('delete all processed (> 2 months old)')));
$buttons->addButton(new ConfirmButton($GLOBALS['I18N']->get('are you sure you want to delete all bounces') . '?', PageURL2("{$baseurl}&action=deleteall"), $GLOBALS['I18N']->get('Delete all')));
print "<div class='actions'>\n";
print "<div class='minitabs'>\n";
print $tabs->display();
print "</div>\n";
print PageLinkButton('listbounces', $GLOBALS['I18N']->get('view bounces by list'));
if (ALLOW_DELETEBOUNCE) {
print '<div class="fright">' . $buttons->show() . '</div>';
}
print "</div><!-- .actions div-->\n";
if (!Sql_Num_Rows($result)) {
switch ($status) {
case 'unidentified':
print '<p class="information">' . s('no unidentified bounces available') . '</p>';
break;
case 'processed':
print '<p class="information">' . s('no processed bounces available') . '</p>';
break;
}
}
$ls = new WebblerListing(s($status) . ' ' . s('bounces'));
$ls->usePanel($paging);
while ($bounce = Sql_fetch_array($result)) {
#@@@ not sure about these ones - bounced list message
$element = $bounce['id'];
$ls->addElement($element, PageUrl2('bounce&type=' . $status . '&id=' . $bounce['id']));
示例6: sprintf
$subselectimp = " where id = 0";
break;
}
}
if (isset($_GET['list'])) {
$id = sprintf('%d', $_GET['list']);
if (!empty($subselectimp)) {
$subselectimp .= ' and id = ' . $id;
} else {
$subselectimp .= ' where id = ' . $id;
}
}
#print PageLinkDialog('addlist',$GLOBALS['I18N']->get('Add a new list'));
print FormStart(' enctype="multipart/form-data" name="import"');
$result = Sql_query("SELECT id,name FROM " . $tables["list"] . "{$subselectimp} ORDER BY listorder");
$total = Sql_Num_Rows($result);
$c = 0;
if ($total == 1) {
$row = Sql_fetch_array($result);
$content .= sprintf('<input type="hidden" name="listname[%d]" value="%s"><input type="hidden" name="importlists[%d]" value="%d">' . $GLOBALS['I18N']->get('Adding subscribers') . ' <b>%s</b>', $c, stripslashes($row["name"]), $c, $row["id"], stripslashes($row["name"]));
} else {
$content .= '<p>' . $GLOBALS['I18N']->get('Select the lists to add the emails to') . '</p>';
$content .= ListSelectHTML($selected_lists, 'importlists', $subselectimp);
}
$content .= '<p class="information">' . $GLOBALS['I18N']->get('Please enter the emails to import, one per line, in the box below and click "Import Emails"');
#$GLOBALS['I18N']->get('<b>Warning</b>: the emails you import will not be checked on validity. You can do this later on the "reconcile subscribers" page.');
$content .= '</p>';
$content .= '<div class="field"><input type="checkbox" name="checkvalidity" value="1" checked="checked" /> ' . $GLOBALS['I18N']->get('Check to skip emails that are not valid') . '</div>';
$content .= '<div class="field"><input type="submit" name="doimport" value="' . $GLOBALS['I18N']->get('Import emails') . '" ></div>';
$content .= '<div class="field"><textarea name="importcontent" rows="10" cols="40"></textarea></div>';
$panel = new UIPanel('', $content);
示例7: Sql_Query
Sql_Query("drop table {$table_prefix}" . "adminattr_{$row['0']}");
}
Sql_Query("delete from {$tables['adminattribute']} where id = {$id}");
# delete all admin attributes as well
Sql_Query("delete from {$tables['admin_attribute']} where adminattributeid = {$id}");
}
}
}
?>
<?php
print formStart();
$res = Sql_Query("select * from {$tables['adminattribute']} order by listorder");
if (Sql_Num_Rows()) {
print $GLOBALS['I18N']->get('ExistingAttr');
} else {
print $GLOBALS['I18N']->get('NoAttrYet');
}
while ($row = Sql_Fetch_array($res)) {
?>
<table border=1>
<tr><td colspan=2><?php
echo $GLOBALS['I18N']->get('Attribute') . $row["id"];
?>
</td><td colspan=2><?php
echo $GLOBALS['I18N']->get('Delete');
?>
<input type="checkbox" name="delete[<?php
echo $row["id"];
示例8: reset
$some = 1;
}
reset($import_attribute);
foreach ($import_attribute as $item) {
if (!empty($data['values'][$item["index"]])) {
$attribute_index = $item["record"];
$value = $data['values'][$item["index"]];
# check whether this is a textline or a selectable item
$att = Sql_Fetch_Row_Query("select type,tablename,name from " . $tables["adminattribute"] . " where id = {$attribute_index}");
switch ($att[0]) {
case "select":
case "radio":
$query = "select id from {$table_prefix}adminattr_{$att['1']} where name = ?";
$val = Sql_Query_Params($query, array($value));
# if we don't have this value add it '
if (!Sql_Num_Rows($val)) {
$tn = $table_prefix . 'adminattr_' . $att[1];
Sql_Query_Params("insert into {$tn} (name) values (?)", array($value));
Warn($GLOBALS['I18N']->get("Value") . " {$value} " . $GLOBALS['I18N']->get("added to attribute") . " {$att['2']}");
$att_value = Sql_Insert_Id($tn, 'id');
} else {
$d = Sql_Fetch_Row($val);
$att_value = $d[0];
}
break;
case "checkbox":
if ($value) {
$val = Sql_Fetch_Row_Query("select id from {$table_prefix}" . "adminattr_{$att['1']} where name = \"Checked\"");
} else {
$val = Sql_Fetch_Row_Query("select id from {$table_prefix}" . "adminattr_{$att['1']} where name = \"Unchecked\"");
}
示例9: switch
$start = 0;
}
if (isset($_GET["tab"]) && $_GET["tab"] == 'unconfirmed') {
$confirmedSelection = ' (!u.confirmed or u.blacklisted)';
$pagingKeep = 'tab=unconfirmed';
} else {
$pagingKeep = 'tab=confirmed';
$confirmedSelection = ' u.confirmed and !u.blacklisted';
}
switch ($access) {
case "owner":
$subselect = " where owner = " . $_SESSION["logindetails"]["id"];
if ($id) {
$query = "select id from " . $tables['list'] . $subselect . " and id = ?";
$rs = Sql_Query_Params($query, array($id));
if (!Sql_Num_Rows($rs)) {
Fatal_Error($GLOBALS['I18N']->get("You do not have enough priviliges to view this page"));
return;
}
}
break;
case "all":
case "view":
$subselect = "";
break;
case "none":
default:
if ($id) {
Fatal_Error($GLOBALS['I18N']->get("You do not have enough priviliges to view this page"));
return;
}
示例10: mysql_real_escape_string
$cgw_req_directory = mysql_real_escape_string(htmlspecialchars($_REQUEST['bwp_info_CgwReqDirectory']));
$app_id = mysql_real_escape_string(htmlspecialchars($_REQUEST['bwp_info__AppId']));
$app_password = mysql_real_escape_string(htmlspecialchars($_REQUEST['bwp_info__AppPassword']));
$cgw_server_ip = mysql_real_escape_string(htmlspecialchars($_REQUEST['bwp_info_CgwServerIp']));
$cgw_server_port = mysql_real_escape_string(htmlspecialchars($_REQUEST['bwp_info_CgwServerPort']));
$uri = mysql_real_escape_string(htmlspecialchars($_REQUEST['bwp_info__Uri']));
$cgw_hostname = mysql_real_escape_string(htmlspecialchars($_REQUEST['bwp_info__CgwHostname']));
$self_care_ip = mysql_real_escape_string(htmlspecialchars($_REQUEST['bwp_info__SelfCareIp']));
$accept_port = mysql_real_escape_string(htmlspecialchars($_REQUEST['bwp_info_AcceptPort']));
$nfqueue_number = mysql_real_escape_string(htmlspecialchars($_REQUEST['bwp_info__NfqueueNumber']));
$log_level = mysql_real_escape_string(htmlspecialchars($_REQUEST['bwp_info_LogLevel']));
}
}
$select_qry = "SELECT * FROM tbl_bwp_config";
$res_select = Sql_exec($cn, $select_qry);
if (Sql_Num_Rows($res_select) > 0) {
$qry = "update tbl_bwp_config\n\t\tset device_id='{$device_id}', device_ip = '{$device_ip}', idle_user_time = '{$idle_user_time}', data_log_directory = '{$data_log_directory}', user_log_directory= '{$user_log_directory}', nfqueue_num = '{$nfqueue_number}', bwp_enable = '{$bwp_enable}', subnet_mask='{$subnet_mask}', cdr_interval='{$cdr_interval}',cdr_log_directory='{$cdr_log_directory}',log_level='{$log_level}',cgw_enable='{$cgw_enable}',cgw_data_limit='{$cgw_data_limit}',cgw_log_directory='{$cgw_log_directory}',cgw_req_directory='{$cgw_req_directory}',app_id='{$app_id}',cgw_ip='{$cgw_server_ip}',cgw_port='{$cgw_server_port}',cgw_uri='{$uri}',cgw_host_name='{$cgw_hostname}',self_care_ip='{$self_care_ip}',accept_port='{$accept_port}'";
} else {
$qry = "insert into tbl_bwp_config(`device_id`,`device_ip`,`idle_user_time`,`data_log_directory`,`user_log_directory`,`nfqueue_num`,`bwp_enable`,subnet_mask,cdr_interval,cdr_log_directory,log_level,cgw_enable,cgw_data_limit,cgw_log_directory,cgw_req_directory,app_id,cgw_ip,cgw_port,cgw_uri,cgw_host_name,self_care_ip,accept_port) ";
$qry .= " values ('{$device_id}','{$device_ip}','{$idle_user_time}','{$data_log_directory}','{$user_log_directory}','{$nfqueue_number}','{$bwp_enable}','{$subnet_mask}','{$cdr_interval}', '{$cdr_log_directory}','{$log_level}','{$cgw_enable}','{$cgw_data_limit}','{$cgw_log_directory}','{$cgw_req_directory}','{$app_id}','{$cgw_server_ip}','{$cgw_server_port}','{$uri}','{$cgw_hostname}','{$self_care_ip}','{$accept_port}')";
}
//echo $qry;
try {
$res = Sql_exec($cn, $qry);
if ($action != "delete") {
if ($action == "update") {
$options['page_name'] = "Bandwidth Profiler Configuration";
$options['action_type'] = $action;
$options['table'] = "tbl_bwp_config";
$options['id_value'] = $action_id;
setHistory($options);
示例11: Sql_query
?>
<p><?php
echo $GLOBALS["I18N"]->get("Add new") . " " . $data["name"] . ', ' . $GLOBALS["I18N"]->get("one per line");
?>
</p>
<textarea name="itemlist" rows="20" cols="50"></textarea>
<input class="submit" type="submit" name="addnew" value="<?php
echo $GLOBALS["I18N"]->get("Add new") . " " . $data["name"];
?>
" /><br />
<hr />
<?php
}
$rs = Sql_query("select * from {$table} order by listorder, name");
$num = Sql_Num_Rows($rs);
if ($num < 100 && $num > 25) {
printf('<input class="submit" type="submit" name="action" value="%s" /><br /><br />', $GLOBALS["I18N"]->get("Change order"));
}
while ($row = Sql_Fetch_array($rs)) {
printf('<div class="row-value"><span class="delete"><a href="javascript:deleteRec(\'%s\');">' . $GLOBALS['I18N']->get('delete') . '</a></span>', PageURL2("editattributes", "", "id={$id}&delete=" . $row["id"]));
if ($num < 100) {
printf(' <input type="text" name="listorder[%d]" value="%s" size="5" class="listorder" />', $row["id"], $row["listorder"]);
}
printf(' %s %s </div>', $row["name"], $row["name"] == $data["default_value"] ? '(' . $GLOBALS['I18N']->get('default') . ')' : "");
}
if ($num && $num < 100) {
printf('<br /><input class="submit" type="submit" name="action" value="%s" />', $GLOBALS["I18N"]->get("Change order"));
}
?>
</form>
示例12: session_start
<?php
session_start();
include_once "../lib/common.php";
$user_id = $_SESSION["USER_ID"];
$cn = connectDB();
$qry = "SELECT \n\t\t\t\ta.id,\n\t\t\t\tb.name, \n\t\t\t\ta.service_id, \n\t\t\t\ta.display_no, \n\t\t\t\ta.original_no, \n\t\t\t\ta.schedule_date, \n\t\t\t\ta.prompt_location,\n\t\t\t\t(SELECT NAME FROM tbl_obd_server_config WHERE id=a.id_operator_distribution) as distribution_list,\n\t\t\t\ta.status\n \t\tFROM tbl_obd_instance_list a \n\t\tINNER JOIN \n\t\ttbl_obd_server_config b \n\t\tON a.server_id=b.id \n\t\tWHERE a.user_id='{$user_id}'";
$result = Sql_exec($cn, $qry);
if (!$result) {
echo "err+" . $qry . " in line " . __LINE__ . " of file" . __FILE__;
exit;
}
if (Sql_Num_Rows($result) > 0) {
$data = array();
$i = 0;
while ($row = Sql_fetch_array($result)) {
$j = 0;
$data[$i][$j++] = Sql_Result($row, "id");
$data[$i][$j++] = Sql_Result($row, "name");
$data[$i][$j++] = Sql_Result($row, "service_id");
$data[$i][$j++] = Sql_Result($row, "display_no");
$data[$i][$j++] = Sql_Result($row, "original_no");
$data[$i][$j++] = Sql_Result($row, "schedule_date");
$data[$i][$j++] = Sql_Result($row, "prompt_location");
$data[$i][$j++] = Sql_Result($row, "distribution_list");
if (Sql_Result($row, "status") == 0) {
$data[$i][$j++] = "Open";
} elseif (Sql_Result($row, "status") == 1) {
$data[$i][$j++] = "Cancelled";
} else {
$data[$i][$j++] = "Closed";
示例13: mysql_real_escape_string
$service_id = mysql_real_escape_string(htmlspecialchars($_REQUEST['service_id']));
$status = mysql_real_escape_string(htmlspecialchars($_REQUEST['status']));
if (isset($action) && $action != "" && $action == "download") {
$qry = "SELECT * FROM tbl_obd_server_config WHERE id='{$server_id}'";
$res = Sql_exec($cn, $qry);
$dt = Sql_fetch_array($res);
$dbtype = $dt['db_type'];
$Server = $dt['db_server'];
$UserID = $dt['db_user'];
$Password = $dt['db_password'];
$Database = $dt['db_name'];
ClosedDBConnection($cn);
$remoteConnection = connectDB();
$query = "SELECT MSISDN FROM outdialque WHERE UserId='{$service_id}' AND OutDialStatus='{$status}'";
$res = Sql_exec($remoteConnection, $query);
if (Sql_Num_Rows($res) > 0) {
$data = array();
$title = array();
while ($dt = Sql_fetch_array($res)) {
$one_row = array("msisdn" => $dt["MSISDN"]);
array_push($data, $one_row);
}
$filename = $service_id . "_" . $status . "_" . date("Y/m/d-H:i:s");
export_csv_file($title, $data, $filename, ",");
} else {
echo 1;
}
ClosedDBConnection($remoteConnection);
} else {
if (isset($action) && $action != "" && $action == "stop") {
$cn = connectDB();
示例14: header
<?php
header('Access-Control-Allow-Origin: *');
require_once "../lib/common.php";
$cn = connectDB();
$data = "";
$count = 0;
$client_id = $_REQUEST['client_id'];
$select_rules = "select * from bwc_ruleinfo where is_active='active' and clientId='{$client_id}'";
$rs_rules = Sql_exec($cn, $select_rules);
if ($rs_rules) {
$count = Sql_Num_Rows($rs_rules);
}
ClosedDBConnection($cn);
echo $count;
示例15: ob_start
}
ob_start();
}
if (!$id) {
print '<p>' . $GLOBALS['I18N']->get('Select Message to view') . '</p>';
if (empty($start)) {
print '<div class="actions">' . PageLinkButton('statsoverview&dl=true', $GLOBALS['I18N']->get('Download as CSV file')) . '</div>';
}
$timerange = ' and msg.entered > date_sub(current_timestamp,interval 12 month)';
#$timerange = '';
$query = sprintf('select msg.owner,msg.id as messageid,count(um.viewed) as views,
count(um.status) as total,subject,date_format(sent,"%%e %%b %%Y") as sent,
bouncecount as bounced from %s um,%s msg where um.messageid = msg.id and um.status = "sent" %s %s %s
group by msg.id order by msg.entered desc', $GLOBALS['tables']['usermessage'], $GLOBALS['tables']['message'], $subselect, $timerange, $ownership);
$req = Sql_Query($query);
$total = Sql_Num_Rows($req);
if ($total > 10 && !$download) {
#print Paging(PageUrl2('statsoverview'),$start,$total,10);
$paging = simplePaging('statsoverview', $start, $total, 10);
$query .= $limit;
$req = Sql_Query($query);
}
if (!Sql_Affected_Rows()) {
print '<p class="information">' . $GLOBALS['I18N']->get('There are currently no messages to view') . '</p>';
}
$ls = new WebblerListing($GLOBALS['I18N']->get('Campaigns in the last year'));
$ls->usePanel($paging);
while ($row = Sql_Fetch_Array($req)) {
$element = '<!--' . $row['messageid'] . '-->' . shortenTextDisplay($row['subject'], 30);
$fwded = Sql_Fetch_Row_Query(sprintf('select count(id) from %s where message = %d', $GLOBALS['tables']['user_message_forward'], $row['messageid']));
$ls->addElement($element, PageURL2('statsoverview&id=' . $row['messageid']));