本文整理汇总了PHP中dba_query函数的典型用法代码示例。如果您正苦于以下问题:PHP dba_query函数的具体用法?PHP dba_query怎么用?PHP dba_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dba_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sms_command_handle
function sms_command_handle($sms_datetime, $sms_sender, $command_keyword, $command_param = '')
{
global $datetime_now, $plugin_config;
$ok = false;
$db_query = "SELECT command_exec,uid,command_return_as_reply FROM " . _DB_PREF_ . "_featureCommand WHERE command_keyword='{$command_keyword}'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
$command_exec = $db_row['command_exec'];
$sms_datetime = core_display_datetime($sms_datetime);
$command_exec = str_replace("{SMSDATETIME}", "\"{$sms_datetime}\"", $command_exec);
$command_exec = str_replace("{SMSSENDER}", "\"{$sms_sender}\"", $command_exec);
$command_exec = str_replace("{COMMANDKEYWORD}", "\"{$command_keyword}\"", $command_exec);
$command_exec = str_replace("{COMMANDPARAM}", "\"{$command_param}\"", $command_exec);
$command_exec = $plugin_config['feature']['sms_command']['bin'] . "/" . $command_exec;
$command_output = shell_exec(stripslashes($command_exec));
$username = uid2username($db_row['uid']);
if ($db_row['command_return_as_reply'] == 1) {
sendsms_pv($username, $sms_sender, $command_output, 'text', 0);
}
$db_query = "\n\tINSERT INTO " . _DB_PREF_ . "_featureCommand_log\n\t(sms_sender,command_log_datetime,command_log_keyword,command_log_exec) \n\tVALUES\n\t('{$sms_sender}','{$datetime_now}','{$command_keyword}','{$command_exec}')\n ";
if ($new_id = @dba_insert_id($db_query)) {
$ok = true;
}
return $ok;
}
示例2: 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);
}
}
}
示例3: sms_custom_handle
function sms_custom_handle($sms_datetime, $sms_sender, $custom_keyword, $custom_param = '')
{
global $datetime_now;
$ok = false;
$db_query = "SELECT custom_url FROM " . _DB_PREF_ . "_featureCustom WHERE custom_keyword='{$custom_keyword}'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
$custom_url = $db_row['custom_url'];
$sms_datetime = core_display_datetime($sms_datetime);
$custom_url = str_replace("{SMSDATETIME}", urlencode($sms_datetime), $custom_url);
$custom_url = str_replace("{SMSSENDER}", urlencode($sms_sender), $custom_url);
$custom_url = str_replace("{CUSTOMKEYWORD}", urlencode($custom_keyword), $custom_url);
$custom_url = str_replace("{CUSTOMPARAM}", urlencode($custom_param), $custom_url);
$url = parse_url($custom_url);
if (!$url['port']) {
$url['port'] = 80;
}
// fixme anton -deprecated when using PHP5
//$connection = fsockopen($url['host'],$url['port'],&$error_number,&$error_description,60);
$connection = fsockopen($url['host'], $url['port'], $error_number, $error_description, 60);
if ($connection) {
socket_set_blocking($connection, false);
fputs($connection, "GET {$custom_url} HTTP/1.0\r\n\r\n");
$db_query = "\n\t INSERT INTO " . _DB_PREF_ . "_featureCustom_log\n\t (sms_sender,custom_log_datetime,custom_log_keyword,custom_log_url) \n\t VALUES\n\t ('{$sms_sender}','{$datetime_now}','{$custom_keyword}','{$custom_url}')\n\t";
if ($new_id = @dba_insert_id($db_query)) {
$ok = true;
}
}
return $ok;
}
示例4: sms_autoreply_handle
function sms_autoreply_handle($c_uid, $sms_datetime, $sms_sender, $sms_receiver, $autoreply_id, $autoreply_keyword, $autoreply_param = '', $smsc = '', $raw_message = '')
{
$ok = false;
$autoreply_keyword = strtoupper(trim($autoreply_keyword));
$autoreply_param = strtoupper(trim($autoreply_param));
$autoreply_request = $autoreply_keyword . " " . $autoreply_param;
$array_autoreply_request = preg_split('/[\\s]+/', $autoreply_request);
for ($i = 0; $i < count($array_autoreply_request); $i++) {
$autoreply_part[$i] = trim($array_autoreply_request[$i]);
$tmp_autoreply_request .= trim($array_autoreply_request[$i]) . " ";
}
$autoreply_request = trim($tmp_autoreply_request);
for ($i = 1; $i < 7; $i++) {
$autoreply_scenario_param_list .= "autoreply_scenario_param{$i}='" . $autoreply_part[$i] . "' AND ";
}
$db_query = "\n\t\tSELECT autoreply_scenario_result FROM " . _DB_PREF_ . "_featureAutoreply_scenario \n\t\tWHERE autoreply_id='{$autoreply_id}' AND {$autoreply_scenario_param_list} 1=1";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
if ($autoreply_scenario_result = $db_row['autoreply_scenario_result']) {
$ok = false;
$c_username = user_uid2username($c_uid);
$unicode = core_detect_unicode($autoreply_scenario_result);
$autoreply_scenario_result = addslashes($autoreply_scenario_result);
list($ok, $to, $smslog_id, $queue) = sendsms_helper($c_username, $sms_sender, $autoreply_scenario_result, 'text', $unicode, $smsc);
$ok = $ok[0];
}
return $ok;
}
示例5: outgoing_prefix2smsc
function outgoing_prefix2smsc($prefix, $uid = 0)
{
$prefix = (string) substr($prefix, 0, 8);
$uid = (int) $uid ? (int) $uid : 0;
$db_query = "SELECT smsc FROM " . _DB_PREF_ . "_featureOutgoing WHERE prefix='{$prefix}' AND uid='{$uid}'";
$db_result = dba_query($db_query);
while ($db_row = dba_fetch_array($db_result)) {
$smsc[] = $db_row['smsc'];
}
// _log('prefix: ' . $prefix . ' uid:' . $uid . ' debug:' . print_r($smsc, 1), 3, 'outgoing_hook_sendsms_intercept');
return $smsc;
}
示例6: msgtemplate_hook_sendsms_get_template
function msgtemplate_hook_sendsms_get_template()
{
$ret = array();
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureMsgtemplate WHERE uid='" . $_SESSION['uid'] . "' ORDER BY t_title ASC";
$db_result = dba_query($db_query);
$i = 0;
while ($db_row = dba_fetch_array($db_result)) {
$ret[$i]['text'] = $db_row['t_text'];
$ret[$i]['title'] = $db_row['t_title'];
$i++;
}
return $ret;
}
示例7: autorespond_hook_recvsms_intercept_after
function autorespond_hook_recvsms_intercept_after($sms_datetime, $sms_sender, $message, $sms_receiver, $feature, $status, $uid, $smsc)
{
$ret = array();
$hooked = FALSE;
// process only when the previous feature is not 'incoming'
if ($feature != 'incoming' && $status) {
return $ret;
}
if ($message) {
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureAutorespond WHERE flag_deleted='0'";
$db_result = dba_query($db_query);
while ($db_row = dba_fetch_array($db_result)) {
$continue = TRUE;
// only check sms receiver if set
if ($db_row['sms_receiver']) {
if ($sms_receiver != $db_row['sms_receiver']) {
$continue = FALSE;
}
}
if ($continue) {
// match SMS with regex
if (preg_match($db_row['regex'], $message)) {
// match found, send respond
$c_uid = $db_row['uid'];
$c_username = user_uid2username($c_uid);
$c_message = $db_row['message'];
if (core_detect_unicode($c_message)) {
$unicode = 1;
}
$smsc = gateway_decide_smsc($smsc, $db_row['smsc']);
_log("match found dt:" . $sms_datetime . " s:" . $sms_sender . " r:" . $sms_receiver . " uid:" . $c_uid . " username:" . $c_username . " service:[" . $db_row['service_name'] . "] regex:[" . $db_row['regex'] . "] m:[" . $message . "] smsc:" . $smsc, 3, "autorespond");
sendsms_helper($c_username, $sms_sender, $c_message, 'text', $unicode, $smsc);
// log it
$hooked = TRUE;
// found then stop
break;
}
}
}
}
if ($c_uid && $hooked) {
_log("hooked dt:" . $sms_datetime . " s:" . $sms_sender . " r:" . $sms_receiver . " uid:" . $c_uid . " username:" . $c_username . " service:[" . $db_row['service_name'] . "] regex:[" . $db_row['regex'] . "] m:[" . $message . "] smsc:" . $smsc, 3, "autorespond");
$ret['modified'] = TRUE;
$ret['param']['feature'] = 'autorespond';
$ret['param']['status'] = 1;
$ret['uid'] = $c_uid;
$ret['hooked'] = $hooked;
}
return $ret;
}
示例8: queuelog_countall
function queuelog_countall()
{
global $user_config;
$ret = 0;
if ($user_config['status'] != 2) {
$user_query = "AND uid='" . $user_config['uid'] . "'";
}
$db_query = "SELECT count(*) AS count FROM " . _DB_PREF_ . "_tblSMSOutgoing_queue WHERE (flag='0' OR flag='3') " . $user_query;
$db_result = dba_query($db_query);
if ($db_row = dba_fetch_array($db_result)) {
$ret = $db_row['count'];
}
return $ret;
}
示例9: 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;
}
示例10: getsmsstatus
function getsmsstatus()
{
$smsc = core_smsc_get();
$smsc_data = gateway_get_smscbyname($smsc);
$gateway = $smsc_data['gateway'];
$db_query = "SELECT * FROM " . _DB_PREF_ . "_tblSMSOutgoing WHERE p_status='0' AND p_gateway='{$smsc}'";
$db_result = dba_query($db_query);
while ($db_row = dba_fetch_array($db_result)) {
$uid = $db_row['uid'];
$smslog_id = $db_row['smslog_id'];
$p_datetime = $db_row['p_datetime'];
$p_update = $db_row['p_update'];
$gpid = $db_row['p_gpid'];
core_hook($gateway, 'getsmsstatus', array($gpid, $uid, $smslog_id, $p_datetime, $p_update));
}
}
示例11: simplebilling_hook_billing_getdata
function simplebilling_hook_billing_getdata($smslog_id)
{
$ret = array();
logger_print("smslog_id:" . $smslog_id, 3, "simplebilling getdata");
$db_query = "SELECT id,rate,credit,status FROM " . _DB_PREF_ . "_tblBilling WHERE smslog_id='{$smslog_id}'";
$db_result = dba_query($db_query);
if ($db_row = dba_fetch_array($db_result)) {
$id = $db_row['id'];
$post_datetime = $db_row['post_datetime'];
$rate = $db_row['rate'];
$credit = $db_row['credit'];
$status = $db_row['status'];
$ret = array('id' => $id, 'smslog_id' => $smslog_id, 'post_datetime' => $post_datetime, 'status' => $status, 'rate' => $rate, 'credit' => $credit);
}
return $ret;
}
示例12: setuserlang
/**
* Set the language for the user, if it's no defined just leave it with the default
* @param string $var_username Username
* @return boolean TRUE if valid
*/
function setuserlang($username = "")
{
global $language_module;
$db_query = "SELECT `language_module` FROM " . _DB_PREF_ . "_tblUser WHERE username='{$username}'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
if (isset($db_row['language_module'])) {
$language_module = $db_row['language_module'];
}
if (defined('LC_MESSAGES')) {
// linux
setlocale(LC_MESSAGES, $language_module, $language_module . '.utf8', $language_module . '.utf-8', $language_module . '.UTF8', $language_module . '.UTF-8');
} else {
// windows
putenv("LC_ALL={$language_module}");
}
}
示例13: core_setuserlang
/**
* Set the language for the user, if it's no defined just leave it with the default
* @param string $var_username Username
* @return boolean TRUE if valid
*/
function core_setuserlang($username = "")
{
global $core_config;
$c_lang_module = core_lang_get();
$db_query = "SELECT language_module FROM " . _DB_PREF_ . "_tblUser WHERE username='{$username}'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
if (trim($db_row['language_module'])) {
$c_lang_module = $db_row['language_module'];
}
if (defined('LC_MESSAGES')) {
// linux
setlocale(LC_MESSAGES, $c_lang_module, $c_lang_module . '.utf8', $c_lang_module . '.utf-8', $c_lang_module . '.UTF8', $c_lang_module . '.UTF-8');
} else {
// windows
putenv('LC_ALL={' . $c_lang_module . '}');
}
}
示例14: simplebilling_hook_billing_getdata_by_uid
function simplebilling_hook_billing_getdata_by_uid($uid)
{
$ret = array();
// logger_print("uid:".$uid, 2, "simplebilling summary");
$db_query = "SELECT * FROM " . _DB_PREF_ . "_tblBilling AS A, " . _DB_PREF_ . "_tblUser AS B, " . _DB_PREF_ . "_tblSMSOutgoing AS C " . "WHERE B.flag_deleted='0' AND A.smslog_id=C.smslog_id AND B.uid=C.uid AND A.status='1' AND B.uid='{$uid}'";
$db_result = dba_query($db_query);
while ($db_row = dba_fetch_array($db_result)) {
$id = $db_row['id'];
$smslog_id = $db_row['smslog_id'];
$post_datetime = $db_row['post_datetime'];
$rate = $db_row['rate'];
$credit = $db_row['credit'];
$count = $db_row['count'];
$charge = $db_row['charge'];
$ret[] = array('id' => $id, 'smslog_id' => $smslog_id, 'post_datetime' => $post_datetime, 'rate' => $rate, 'credit' => $credit, 'count' => $count, 'charge' => $charge);
}
return $ret;
}
示例15: sms_quiz_handle
function sms_quiz_handle($c_uid, $sms_datetime, $sms_sender, $quiz_keyword, $quiz_param = '')
{
global $core_config, $datetime_now;
$ok = false;
$username = uid2username($c_uid);
$sms_to = $sms_sender;
// we are replying to this sender
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureQuiz WHERE quiz_keyword='{$quiz_keyword}'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
if ($db_row['quiz_enable'] == 1) {
if ($db_row['quiz_answer'] == strtoupper($quiz_param)) {
$message = $db_row['quiz_msg_correct'];
} else {
$message = $db_row['quiz_msg_incorrect'];
}
$quiz_id = $db_row['quiz_id'];
$answer = strtoupper($quiz_param);
$db_query = "INSERT INTO " . _DB_PREF_ . "_featureQuiz_log (quiz_id,quiz_answer,quiz_sender,in_datetime) VALUES ('{$quiz_id}','{$answer}','{$sms_to}','{$datetime_now}')";
if ($logged = @dba_insert_id($db_query)) {
//list($ok,$to,$smslog_id) = sendsms_pv($username, $sms_to, $message);
$unicode = 0;
if (function_exists('mb_detect_encoding')) {
$encoding = mb_detect_encoding($message, 'auto');
if ($encoding != 'ASCII') {
$unicode = 1;
}
}
$ret = sendsms($core_config['main']['cfg_gateway_number'], '', $sms_to, $message, $c_uid, 0, 'text', $unicode);
// $ok = $ok[0];
$ok = $ret['status'];
}
} else {
if ($db_row['quiz_keyword'] == $quiz_keyword) {
// returns true even if its logged as correct/incorrect answer
// this situation happens when user answers a disabled quiz
// returning false will make this SMS as unhandled SMS
$ok = true;
}
}
return $ok;
}