本文整理汇总了PHP中dba_affected_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP dba_affected_rows函数的具体用法?PHP dba_affected_rows怎么用?PHP dba_affected_rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dba_affected_rows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sms_autosend_hook_playsmsd
function sms_autosend_hook_playsmsd()
{
global $core_config;
$timenow = mktime();
$db_query = "SELECT uid,time_id," . _DB_PREF_ . "_featureAutosend.autosend_id, autosend_message,autosend_number,autosend_time\n\t\t\t\t\t\t\tFROM " . _DB_PREF_ . "_featureAutosend\n\t\t\t\t\t\t\tINNER JOIN " . _DB_PREF_ . "_featureAutosend_time\n\t\t\t\t\t\t\tON " . _DB_PREF_ . "_featureAutosend.autosend_id = " . _DB_PREF_ . "_featureAutosend_time.autosend_id\n\t\t\t\t\t\t\tWHERE UNIX_TIMESTAMP(" . _DB_PREF_ . "_featureAutosend_time.autosend_time) <= '{$timenow}'\n\t\t\t\t\t\t\tAND " . _DB_PREF_ . "_featureAutosend_time.sent='0'\n\t\t\t\t\t\t\tAND autosend_time != ''\n\t\t\t\t\t\t\tAND " . _DB_PREF_ . "_featureAutosend.autosend_enable='1'";
$db_result = dba_query($db_query);
while ($db_row = dba_fetch_array($db_result)) {
$message = $db_row['autosend_message'];
$c_uid = $db_row['uid'];
$username = uid2username($c_uid);
$sms_to = $db_row['autosend_number'];
// we are sending to this number
$autosend_id = $db_row['autosend_id'];
$time_id = $db_row['time_id'];
$unicode = 0;
if (function_exists('mb_detect_encoding')) {
$encoding = mb_detect_encoding($message, 'auto');
if ($encoding != 'ASCII') {
$unicode = 1;
}
}
list($ok, $to, $smslog_id) = sendsms_pv($username, $sms_to, $message, 'text', $unicode);
if ($ok[0]) {
$db_query = "UPDATE " . _DB_PREF_ . "_featureAutosend_time SET sent='1' WHERE time_id = '{$time_id}'";
$db_result = @dba_affected_rows($db_query);
}
}
}
示例2: simplebilling_hook_billing_finalize
function simplebilling_hook_billing_finalize($smslog_id)
{
$db_query = "UPDATE " . _DB_PREF_ . "_tblBilling SET status='1' WHERE smslog_id='{$smslog_id}'";
$db_result = dba_affected_rows($db_query);
logger_print("saving smslog_id:" . $smslog_id, 3, "simplebilling finalize");
return true;
}
示例3: simplerate_hook_rate_setusercredit
function simplerate_hook_rate_setusercredit($uid, $remaining = 0)
{
$ok = false;
logger_print("saving uid:" . $uid . " remaining:" . $remaining, 3, "simplerate setusercredit");
$db_query = "UPDATE " . _DB_PREF_ . "_tblUser SET c_timestamp=NOW(),credit='{$remaining}' WHERE uid='{$uid}'";
if ($db_result = @dba_affected_rows($db_query)) {
logger_print("saved uid:" . $uid . " remaining:" . $remaining, 3, "simplerate setusercredit");
$ok = true;
}
return $ok;
}
示例4: simplebilling_hook_billing_finalize
function simplebilling_hook_billing_finalize($smslog_id)
{
$ok = false;
logger_print("saving smslog_id:" . $smslog_id, 2, "simplebilling finalize");
$db_query = "UPDATE " . _DB_PREF_ . "_tblBilling SET status='1' WHERE smslog_id='{$smslog_id}'";
if ($db_result = dba_affected_rows($db_query)) {
logger_print("saved smslog_id:" . $smslog_id, 2, "simplebilling finalize");
$ok = true;
}
return $ok;
}
示例5: queuelog_delete_all
function queuelog_delete_all($queue)
{
global $user_config;
$ret = FALSE;
if ($user_config['status'] != 2) {
$user_query = "AND uid='" . $user_config['uid'] . "'";
}
$db_query = "DELETE FROM " . _DB_PREF_ . "_tblSMSOutgoing_queue WHERE (flag='0' OR flag='3') " . $user_query;
if ($db_result = dba_affected_rows($db_query)) {
$ret = TRUE;
}
return $ret;
}
示例6: logger_get_error_string
function logger_get_error_string($id, $nodel = false)
{
$ret_string = "";
$db_query = "SELECT error_string FROM " . _DB_PREF_ . "_tblErrorString WHERE id='{$id}'";
$db_result = dba_query($db_query);
if ($db_row = dba_fetch_array($db_result)) {
$ret_string = $db_row['error_string'];
if (!$nodel) {
$db_query = "DELETE FROM " . _DB_PREF_ . "_tblErrorString WHERE id='{$id}'";
$db_result = @dba_affected_rows($db_query);
}
}
return $ret_string;
}
示例7: setsmsdeliverystatus
function setsmsdeliverystatus($smslog_id, $uid, $p_status)
{
global $core_config;
// $p_status = 0 --> pending
// $p_status = 1 --> sent
// $p_status = 2 --> failed
// $p_status = 3 --> delivered
// logger_print("smslog_id:".$smslog_id." uid:".$uid." p_status:".$p_status, 2, "setsmsdeliverystatus");
$ok = false;
$db_query = "UPDATE " . _DB_PREF_ . "_tblSMSOutgoing SET c_timestamp='" . mktime() . "',p_update='" . core_get_datetime() . "',p_status='{$p_status}' WHERE smslog_id='{$smslog_id}' AND uid='{$uid}'";
if ($aff_id = @dba_affected_rows($db_query)) {
// logger_print("saved smslog_id:".$smslog_id, 2, "setsmsdeliverystatus");
$ok = true;
if ($p_status > 0) {
for ($c = 0; $c < count($core_config['featurelist']); $c++) {
core_hook($core_config['featurelist'][$c], 'setsmsdeliverystatus', array($smslog_id, $uid, $p_status));
}
}
}
return $ok;
}
示例8: switch
if ($gateway_module == $template_param[name]) {
$status_active = "(<font color=green><b>Active</b></font>)";
} else {
$status_active = "(<font color=red><b>Inactive</b></font>) (<a href=\"menu_admin.php?inc=gwmod_template&op=manage_activate\">click here to activate</a>)";
}
switch ($op) {
case "manage":
if ($err) {
$content = "<p><font color=red>{$err}</font><p>";
}
$content .= "\n\t\t <h2>Manage Gateway Module</h2>\n\t\t <p>\n\t\t <form action=menu_admin.php?inc=gwmod_template&op=manage_save method=post>\n\t\t <p>Gateway Name: <b>" . $template_param[name] . "</b> {$status_active}\n\t\t <p>Template Path: <input type=text size=40 maxlength=250 name=up_path value=\"" . $template_param[path] . "\"> (No trailing slash \"/\")\n\t\t <p>Note :<br>\n\t\t - When you put <b>/usr/local</b> above, the real path is <b>/usr/local/cache/smsd</b>\n\t\t <!-- <p><input type=checkbox name=up_trn {$checked}> Send SMS message without footer banner ({$username}) -->\n\t\t <p><input type=submit class=button value=Save>\n\t\t </form>\n\t\t";
echo $content;
break;
case "manage_save":
$up_path = $_POST[up_path];
$error_string = "No changes made!";
if ($up_path) {
$db_query = "\n\t\t\t\tUPDATE playsms_gwmodTemplate_config \n\t\t\t\tSET cfg_path='{$up_path}'\n\t\t\t ";
if (@dba_affected_rows($db_query)) {
$error_string = "Gateway module configurations has been saved";
}
}
header("Location: menu_admin.php?inc=gwmod_template&op=manage&err=" . urlencode($error_string));
break;
case "manage_activate":
$db_query = "UPDATE playsms_tblConfig_main SET cfg_gateway_module='template'";
$db_result = dba_query($db_query);
$error_string = "Gateway has been activated";
header("Location: menu_admin.php?inc=gwmod_template&op=manage&err=" . urlencode($error_string));
break;
}
示例9: _
$content .= "</table>\n\t\t\t\t<p><input type=submit class=button value=" . _('Add') . ">\n\t\t\t\t</form>\n\t\t\t";
echo $content;
break;
case "sms_autosend_add_yes":
$add_autosend_message = $_POST['add_autosend_message'];
$add_autosend_number = $_POST['add_autosend_number'];
$add_autosend_time = $_POST['add_autosend_time'];
if ($add_autosend_message && $add_autosend_number && $add_autosend_time) {
$db_query = "\n\t\t\t\t\t\t\t\t\tINSERT INTO " . _DB_PREF_ . "_featureAutosend (uid,autosend_message, autosend_number)\n\t\t\t\t\t\t\t\t\tVALUES ('{$uid}','{$add_autosend_message}','{$add_autosend_number}')\n\t\t\t\t\t\t\t\t\t";
if ($new_uid = @dba_insert_id($db_query)) {
foreach ($add_autosend_time as $value) {
$db_query = "\n\t\t\t\t\t\t\t\t\tINSERT INTO " . _DB_PREF_ . "_featureAutosend_time (autosend_id, autosend_time)\n\t\t\t\t\t\t\t\t\tVALUES ('{$new_uid}','{$value}')\n\t\t\t\t\t\t\t\t\t";
if ($value) {
$insert = dba_insert_id($db_query);
}
}
if ($insert) {
$error_string = _('SMS autosend has been added');
} else {
$db_query = "DELETE FROM " . _DB_PREF_ . "_featureAutosend WHERE autosend_id = '" . $db_row['autosend_id'] . "'";
$delete = @dba_affected_rows($db_query);
}
} else {
$error_string = _('Fail to add SMS autosend');
}
} else {
$error_string = _('You must fill all fields');
}
header("Location: index.php?app=menu&inc=feature_sms_autosend&op=sms_autosend_add&err=" . urlencode($error_string));
break;
}
示例10: credit_hook_rate_setusercredit
function credit_hook_rate_setusercredit($uid, $balance = 0)
{
$ok = false;
$balance = (double) $balance;
if ($balance > 0) {
_log("saving uid:" . $uid . " balance:" . $balance, 2, "credit_hook_rate_setusercredit");
$db_query = "UPDATE " . _DB_PREF_ . "_tblUser SET c_timestamp='" . mktime() . "',credit='{$balance}' WHERE uid='{$uid}'";
if ($db_result = @dba_affected_rows($db_query)) {
_log("saved uid:" . $uid . " balance:" . $balance, 2, "credit_hook_rate_setusercredit");
$ok = true;
}
}
return $ok;
}
示例11: sendsmsd
function sendsmsd($single_queue = '', $sendsmsd_limit = 0, $sendsmsd_offset = 0)
{
global $core_config;
if ($single_queue) {
$queue_sql = "AND queue_code='" . $single_queue . "'";
// logger_print("single queue queue_code:".$single_queue, 2, "sendsmsd");
}
$sendsmsd_limit = (int) $sendsmsd_limit;
if ($sendsmsd_limit > 0) {
$sql_limit = "LIMIT " . $sendsmsd_limit;
}
$sendsmsd_offset = (int) $sendsmsd_offset;
if ($sendsmsd_offset > 0) {
$sql_offset = "OFFSET " . $sendsmsd_offset;
}
$db_query = "SELECT * FROM " . _DB_PREF_ . "_tblSMSOutgoing_queue WHERE flag='0' " . $queue_sql . " " . $sql_limit . " " . $sql_offset;
// logger_print("q: ".$db_query, 3, "sendsmsd");
$db_result = dba_query($db_query);
while ($db_row = dba_fetch_array($db_result)) {
$c_queue_id = $db_row['id'];
$c_queue_code = $db_row['queue_code'];
$c_sender_id = addslashes(trim($db_row['sender_id']));
$c_footer = addslashes(trim($db_row['footer']));
$c_message = addslashes(trim($db_row['message']));
$c_uid = $db_row['uid'];
$c_gpid = $db_row['gpid'];
$c_sms_type = $db_row['sms_type'];
$c_unicode = $db_row['unicode'];
$c_sms_count = $db_row['sms_count'];
$c_schedule = $db_row['datetime_scheduled'];
$c_smsc = $db_row['smsc'];
$c_current = core_get_datetime();
// logger_print("delivery datetime qeueue:".$c_queue_code." scheduled:".$c_schedule." current:".$c_current, 3, "sendsmsd");
if (strtotime($c_current) >= strtotime($c_schedule)) {
logger_print("start processing queue_code:" . $c_queue_code . " sms_count:" . $c_sms_count . " uid:" . $c_uid . " gpid:" . $c_gpid . " sender_id:" . $c_sender_id, 2, "sendsmsd");
$counter = 0;
$db_query2 = "SELECT * FROM " . _DB_PREF_ . "_tblSMSOutgoing_queue_dst WHERE queue_id='{$c_queue_id}' AND flag='0'";
$db_result2 = dba_query($db_query2);
while ($db_row2 = dba_fetch_array($db_result2)) {
$counter++;
// queue_dst ID is SMS Log ID
$c_smslog_id = $db_row2['id'];
$c_dst = $db_row2['dst'];
$c_flag = 2;
$c_ok = false;
logger_print("sending queue_code:" . $c_queue_code . " smslog_id:" . $c_smslog_id . " to:" . $c_dst . " sms_count:" . $c_sms_count . " counter:" . $counter, 2, "sendsmsd");
$ret = sendsms_process($c_smslog_id, $c_sender_id, $c_footer, $c_dst, $c_message, $c_uid, $c_gpid, $c_sms_type, $c_unicode, $c_queue_code, $c_smsc);
$c_dst = $ret['to'];
if ($ret['status']) {
$c_ok = true;
$c_flag = 1;
}
logger_print("result queue_code:" . $c_queue_code . " to:" . $c_dst . " flag:" . $c_flag . " smslog_id:" . $c_smslog_id, 2, "sendsmsd");
$db_query3 = "UPDATE " . _DB_PREF_ . "_tblSMSOutgoing_queue_dst SET flag='{$c_flag}' WHERE id='{$c_smslog_id}'";
$db_result3 = dba_query($db_query3);
$ok[] = $c_ok;
$to[] = $c_dst;
$smslog_id[] = $c_smslog_id;
$queue[] = $c_queue_code;
$counts[] = $c_sms_count;
}
$db_query = "SELECT count(*) AS count FROM " . _DB_PREF_ . "_tblSMSOutgoing_queue_dst WHERE queue_id='{$c_queue_id}' AND NOT flag ='0'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
// destinations processed
$dst_processed = (int) ($db_row['count'] ? $db_row['count'] : 0);
// number of SMS processed
$sms_processed = $dst_processed * $c_sms_count;
// check whether SMS processed is >= stated SMS count in queue
// if YES then processing queue is finished
if ($sms_processed >= $c_sms_count) {
$dt = core_get_datetime();
$db_query5 = "UPDATE " . _DB_PREF_ . "_tblSMSOutgoing_queue SET flag='1', datetime_update='" . $dt . "' WHERE id='{$c_queue_id}'";
if ($db_result5 = dba_affected_rows($db_query5)) {
logger_print("finish processing queue_code:" . $c_queue_code . " uid:" . $c_uid . " sender_id:" . $c_sender_id . " sms_count:" . $c_sms_count, 2, "sendsmsd");
} else {
logger_print("fail to finalize process queue_code:" . $c_queue_code . " uid:" . $c_uid . " sender_id:" . $c_sender_id . " sms_processed:" . $sms_processed, 2, "sendsmsd");
}
} else {
logger_print("partially processing queue_code:" . $c_queue_code . " uid:" . $c_uid . " sender_id:" . $c_sender_id . " sms_count:" . $c_sms_count . " sms_processed:" . $sms_processed . " counter:" . $counter, 2, "sendsmsd");
}
}
}
return array($ok, $to, $smslog_id, $queue, $counts);
}
示例12: inboxgroup_catchalldel
function inboxgroup_catchalldel($rid, $uid)
{
$ret = false;
$db_query = "SELECT id FROM " . _DB_PREF_ . "_featureInboxgroup_catchall WHERE rid='{$rid}' AND uid='{$uid}'";
$db_result = dba_query($db_query);
if ($db_row = dba_fetch_array($db_result)) {
$db_query = "DELETE FROM " . _DB_PREF_ . "_featureInboxgroup_catchall WHERE rid='{$rid}' AND uid='{$uid}'";
$ret = dba_affected_rows($db_query);
}
return $ret;
}
示例13: credit_hook_rate_setusercredit
function credit_hook_rate_setusercredit($uid, $balance = 0)
{
$balance = (double) $balance;
$user = user_getdatabyuid($uid);
if ($user['uid']) {
if ($user['credit'] != $balance) {
_log("saving uid:" . $uid . " balance:" . $balance, 2, "credit_hook_rate_setusercredit");
$db_query = "UPDATE " . _DB_PREF_ . "_tblUser SET c_timestamp='" . mktime() . "',credit='{$balance}' WHERE flag_deleted='0' AND uid='{$uid}'";
if ($db_result = @dba_affected_rows($db_query)) {
_log("saved uid:" . $uid . " balance:" . $balance, 2, "credit_hook_rate_setusercredit");
return TRUE;
} else {
_log("unable to save uid:" . $uid . " balance:" . $balance, 2, "credit_hook_rate_setusercredit");
return FALSE;
}
} else {
_log("no changes uid:" . $uid . " balance:" . $balance, 2, "credit_hook_rate_setusercredit");
return TRUE;
}
} else {
_log("user does not exists uid:" . $uid . " balance:" . $balance, 2, "credit_hook_rate_setusercredit");
return FALSE;
}
}
示例14: sms_survey_questionsdel
function sms_survey_questionsdel($sid, $id)
{
$ret = false;
$db_query = "SELECT id FROM " . _DB_PREF_ . "_featureSurvey_questions WHERE sid='{$sid}' AND id='{$id}'";
$db_result = dba_query($db_query);
if ($db_row = dba_fetch_array($db_result)) {
$db_query1 = "DELETE FROM " . _DB_PREF_ . "_featureSurvey_questions WHERE sid='{$sid}' AND id='" . $db_row['id'] . "'";
$ret = dba_affected_rows($db_query1);
}
return $ret;
}
示例15: setsmsdeliverystatus
function setsmsdeliverystatus($smslog_id, $uid, $p_status)
{
global $core_config, $datetime_now;
// $p_status = 0 --> pending
// $p_status = 1 --> sent
// $p_status = 2 --> failed
// $p_status = 3 --> delivered
$ok = false;
$db_query = "UPDATE " . _DB_PREF_ . "_tblSMSOutgoing SET c_timestamp='" . mktime() . "',p_update='{$datetime_now}',p_status='{$p_status}' WHERE smslog_id='{$smslog_id}' AND uid='{$uid}'";
if ($aff_id = @dba_affected_rows($db_query)) {
$ok = true;
if ($p_status > 0) {
for ($c = 0; $c < count($core_config['toolslist']); $c++) {
x_hook($core_config['toolslist'][$c], 'setsmsdeliverystatus', array($smslog_id, $uid, $p_status));
}
for ($c = 0; $c < count($core_config['featurelist']); $c++) {
x_hook($core_config['featurelist'][$c], 'setsmsdeliverystatus', array($smslog_id, $uid, $p_status));
}
x_hook($gateway_module, 'setsmsdeliverystatus', array($smslog_id, $uid, $p_status));
}
}
return $ok;
}