本文整理汇总了PHP中dba_insert_id函数的典型用法代码示例。如果您正苦于以下问题:PHP dba_insert_id函数的具体用法?PHP dba_insert_id怎么用?PHP dba_insert_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dba_insert_id函数的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_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;
}
示例3: sms_board_handle
function sms_board_handle($c_uid, $sms_datetime, $sms_sender, $sms_receiver, $board_keyword, $board_param = '')
{
global $web_title, $email_service, $email_footer, $gateway_module, $datetime_now;
$ok = false;
if ($sms_sender && $board_keyword && $board_param) {
// masked sender sets here
$masked_sender = substr_replace($sms_sender, 'xxxx', -4);
$db_query = "\n\t INSERT INTO " . _DB_PREF_ . "_featureBoard_log \n\t (in_gateway,in_sender,in_masked,in_keyword,in_msg,in_datetime) \n\t VALUES ('{$gateway_module}','{$sms_sender}','{$masked_sender}','{$board_keyword}','{$board_param}','{$datetime_now}')\n\t";
if ($cek_ok = @dba_insert_id($db_query)) {
$db_query1 = "SELECT board_forward_email FROM " . _DB_PREF_ . "_featureBoard WHERE board_keyword='{$board_keyword}'";
$db_result1 = dba_query($db_query1);
$db_row1 = dba_fetch_array($db_result1);
$email = $db_row1['board_forward_email'];
if ($email) {
// get name from c_uid's phonebook
$c_username = uid2username($c_uid);
$c_name = phonebook_number2name($sms_sender, $c_username);
$sms_sender = $c_name ? $c_name . ' <' . $sms_sender . '>' : $sms_sender;
$subject = "[SMSGW-" . $board_keyword . "] " . _('from') . " {$sms_sender}";
$body = _('Forward WebSMS') . " ({$web_title})\n\n";
$body .= _('Date and time') . ": {$sms_datetime}\n";
$body .= _('Sender') . ": {$sms_sender}\n";
$body .= _('Receiver') . ": {$sms_receiver}\n";
$body .= _('Keyword') . ": {$board_keyword}\n\n";
$body .= _('Message') . ":\n{$board_param}\n\n";
$body .= $email_footer . "\n\n";
sendmail($email_service, $email, $subject, $body);
}
$ok = true;
}
}
return $ok;
}
示例4: sms_quiz_handle
function sms_quiz_handle($list, $sms_datetime, $sms_sender, $quiz_keyword, $quiz_param = '', $sms_receiver = '', $smsc = '', $raw_message = '')
{
global $core_config;
$ok = false;
$sms_to = $sms_sender;
// we are replying to this sender
$quiz_keyword = strtoupper(trim($quiz_keyword));
$quiz_param = strtoupper(trim($quiz_param));
if (($quiz_enable = $list['quiz_enable']) && $quiz_param) {
if (strtoupper($list['quiz_answer']) == $quiz_param) {
$message = $list['quiz_msg_correct'];
} else {
$message = $list['quiz_msg_incorrect'];
}
$quiz_id = $list['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}','" . core_get_datetime() . "')";
if ($logged = @dba_insert_id($db_query)) {
if ($message && ($username = user_uid2username($list['uid']))) {
$unicode = core_detect_unicode($message);
$message = addslashes($message);
list($ok, $to, $smslog_id, $queue) = sendsms_helper($username, $sms_to, $message, 'text', $unicode, $smsc);
}
$ok = true;
}
}
return $ok;
}
示例5: nexmo_hook_sendsms
function nexmo_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $plugin_config;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "nexmo_hook_sendsms");
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$sms_sender = stripslashes($sms_sender);
if ($plugin_config['nexmo']['module_sender']) {
$sms_sender = $plugin_config['nexmo']['module_sender'];
}
$sms_footer = stripslashes($sms_footer);
$sms_msg = stripslashes($sms_msg);
$ok = false;
if ($sms_footer) {
$sms_msg = $sms_msg . $sms_footer;
}
if ($sms_sender && $sms_to && $sms_msg) {
$unicode = "";
if ($unicode) {
if (function_exists('mb_convert_encoding')) {
// $sms_msg = mb_convert_encoding($sms_msg, "UCS-2BE", "auto");
$sms_msg = mb_convert_encoding($sms_msg, "UCS-2", "auto");
$unicode = "&type=unicode";
// added at the of query string if unicode
}
}
$query_string = "api_key=" . $plugin_config['nexmo']['api_key'] . "&api_secret=" . $plugin_config['nexmo']['api_secret'] . "&to=" . urlencode($sms_to) . "&from=" . urlencode($sms_sender) . "&text=" . urlencode($sms_msg) . $unicode . "&status-report-req=1&client-ref=" . $smslog_id;
$url = $plugin_config['nexmo']['url'] . "?" . $query_string;
_log("url:[" . $url . "]", 3, "nexmo outgoing");
// fixme anton
// rate limit to 1 second per submit - nexmo rule
sleep(1);
$resp = json_decode(file_get_contents($url), true);
if ($resp['message-count']) {
$c_status = $resp['messages'][0]['status'];
$c_message_id = $resp['messages'][0]['message-id'];
$c_network = $resp['messages'][0]['network'];
$c_error_text = $resp['messages'][0]['error-text'];
_log("sent smslog_id:" . $smslog_id . " message_id:" . $c_message_id . " status:" . $c_status . " error:" . $c_error_text, 2, "nexmo outgoing");
$db_query = "\n\t\t\t\tINSERT INTO " . _DB_PREF_ . "_gatewayNexmo (local_smslog_id,remote_smslog_id,status,network,error_text)\n\t\t\t\tVALUES ('{$smslog_id}','{$c_message_id}','{$c_status}','{$c_network}','{$c_error_text}')";
$id = @dba_insert_id($db_query);
if ($id && $c_status == 0) {
$ok = true;
$p_status = 1;
dlr($smslog_id, $uid, $p_status);
}
} else {
// even when the response is not what we expected we still print it out for debug purposes
$resp = str_replace("\n", " ", $resp);
$resp = str_replace("\r", " ", $resp);
_log("failed smslog_id:" . $smslog_id . " resp:" . $resp, 2, "nexmo outgoing");
}
}
if (!$ok) {
$p_status = 2;
dlr($smslog_id, $uid, $p_status);
}
return $ok;
}
示例6: simplebilling_hook_billing_post
function simplebilling_hook_billing_post($smslog_id, $rate, $credit, $count, $charge)
{
$ok = false;
logger_print("saving smslog_id:" . $smslog_id . " rate:" . $rate . " credit:" . $credit . " count:" . $count . " charge:" . $charge, 2, "simplebilling post");
$db_query = "INSERT INTO " . _DB_PREF_ . "_tblBilling (post_datetime,smslog_id,rate,credit,count,charge,status) VALUES ('" . core_get_datetime() . "','{$smslog_id}','{$rate}','{$credit}','{$count}','{$charge}','0')";
if ($id = @dba_insert_id($db_query)) {
logger_print("saved smslog_id:" . $smslog_id . " id:" . $id, 2, "simplebilling post");
$ok = true;
}
return $ok;
}
示例7: simplebilling_hook_billing_post
function simplebilling_hook_billing_post($smslog_id, $rate, $credit)
{
global $datetime_now;
$ok = false;
logger_print("saving smslog_id:" . $smslog_id . " rate:" . $rate . " credit:" . $credit, 3, "simplebilling post");
$db_query = "INSERT INTO " . _DB_PREF_ . "_tblBilling (post_datetime,smslog_id,rate,credit,status) VALUES ('{$datetime_now}','{$smslog_id}','{$rate}','{$credit}','0')";
if ($db_result = @dba_insert_id($db_query)) {
logger_print("saved smslog_id:" . $smslog_id, 3, "simplebilling post");
$ok = true;
}
return $ok;
}
示例8: uplink_hook_sendsms
function uplink_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
// global $plugin_config; // global all variables needed, eg: varibles from config.php
// ...
// ...
// return true or false
// return $ok;
global $plugin_config;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "uplink_hook_sendsms");
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$sms_sender = stripslashes($sms_sender);
if ($plugin_config['uplink']['module_sender']) {
$sms_sender = $plugin_config['uplink']['module_sender'];
}
$sms_footer = $sms_footer ? $sms_footer : stripslashes($sms_footer);
$sms_msg = stripslashes($sms_msg) . $sms_footer;
$ok = false;
if ($sms_to && $sms_msg) {
$unicode = trim($unicode) ? 1 : 0;
$nofooter = $plugin_config['uplink']['try_disable_footer'] ? 1 : 0;
$ws = new Playsms\Webservices();
$ws->url = $plugin_config['uplink']['master'] . '/index.php?app=ws';
$ws->username = $plugin_config['uplink']['username'];
$ws->token = $plugin_config['uplink']['token'];
$ws->to = $sms_to;
$ws->from = $sms_sender;
$ws->msg = $sms_msg;
$ws->unicode = $unicode;
$ws->nofooter = $nofooter;
$ws->sendSms();
// _log('url:'.$ws->getWebservicesUrl(), 3, 'uplink sendsms');
if ($ws->getStatus()) {
$response = $ws->getData();
$db_query = "\n\t\t\t\tINSERT INTO " . _DB_PREF_ . "_gatewayUplink (up_local_smslog_id,up_remote_smslog_id,up_status,up_remote_queue_code,up_dst)\n\t\t\t\tVALUES ('{$smslog_id}','" . $response->smslog_id . "','0','" . $response->queue . "','{$sms_to}')";
if ($up_id = @dba_insert_id($db_query)) {
$ok = true;
}
_log('sendsms success. smslog_id:' . $smslog_id . ' remote_smslog_id:' . $response->smslog_id . ' remote_queue:' . $response->queue, 3, 'uplink sendsms');
} else {
_log('sendsms failed. error:' . $ws->getError() . ' error_string:' . $ws->getErrorString(), 3, 'uplink sendsms');
}
}
if ($ok && ($response->smslog_id || $response->queue)) {
$p_status = 0;
} else {
$p_status = 2;
}
dlr($smslog_id, $uid, $p_status);
return $ok;
}
示例9: gw_send_sms
function gw_send_sms($mobile_sender, $sms_sender, $sms_to, $sms_msg, $gp_code = "", $uid = "", $smslog_id = "", $flash = false)
{
// global $uplink_param; // global all variables needed, eg: varibles from config.php
// ...
// ...
// return true or false
// return $ok;
global $uplink_param;
global $gateway_number;
$ok = false;
if ($gateway_number) {
$sms_from = $gateway_number;
} else {
$sms_from = $mobile_sender;
}
if ($sms_sender) {
$sms_msg = $sms_msg . $sms_sender;
}
$sms_type = 2;
// text
if ($flash) {
$sms_type = 1;
// flash
}
if ($sms_to && $sms_msg) {
$query_string = "ws.php?u=" . $uplink_param[username] . "&p=" . $uplink_param[password] . "&ta=pv&to=" . urlencode($sms_to) . "&from=" . urlencode($sms_from) . "&type={$sms_type}&msg=" . urlencode($sms_msg);
$url = $uplink_param[master] . "/" . $query_string;
$fd = @implode('', file($url));
if ($fd) {
$response = explode(" ", $fd);
if ($response[0] == "OK") {
$remote_slid = $response[1];
if ($remote_slid) {
$db_query = "\n\t\t\tINSERT INTO phpgw_sms_gwmodUplink (up_local_slid,up_remote_slid,up_status)\n\t\t\tVALUES ('{$smslog_id}','{$remote_slid}','0')\n\t\t ";
$up_id = @dba_insert_id($db_query);
if ($up_id) {
$ok = true;
}
}
}
}
}
if (!$ok) {
$p_status = 2;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
}
return $ok;
}
示例10: 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;
}
示例11: sms_autoreply_handle
function sms_autoreply_handle($sms_datetime, $sms_sender, $c_uid, $autoreply_id, $autoreply_keyword, $autoreply_param = '')
{
global $datetime_now;
$ok = false;
$autoreply_request = $autoreply_keyword . " " . $autoreply_param;
$array_autoreply_request = explode(" ", $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\tSELECT autoreply_scenario_result FROM " . _DB_PREF_ . "_featureAutoreply_scenario \n\tWHERE autoreply_id='{$autoreply_id}' AND {$autoreply_scenario_param_list} 1=1\n ";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
if ($autoreply_scenario_result = $db_row['autoreply_scenario_result']) {
$db_query = "\n\t INSERT INTO " . _DB_PREF_ . "_featureAutoreply_log\n\t (sms_sender,autoreply_log_datetime,autoreply_log_keyword,autoreply_log_request) \n\t VALUES\n\t ('{$sms_sender}','{$datetime_now}','{$autoreply_keyword}','{$autoreply_request}')\n\t";
if ($new_id = @dba_insert_id($db_query)) {
$ok = true;
}
}
if ($ok) {
$ok = false;
$c_username = uid2username($c_uid);
//list($ok,$to,$smslog_id) = sendsms_pv($c_username,$sms_sender,$autoreply_scenario_result);
//$ok = $ok[0];
$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($c_username, $sms_sender, $autoreply_scenario_result, 'text', $unicode);
$ok = $ok[0];
}
return $ok;
}
示例12: sms_board_handle
function sms_board_handle($c_uid, $sms_datetime, $sms_sender, $sms_receiver, $board_keyword, $board_param = '', $smsc = '', $raw_message = '')
{
global $core_config;
$ok = false;
$board_keyword = strtoupper(trim($board_keyword));
$board_param = trim($board_param);
if ($sms_sender && $board_keyword && $board_param) {
// masked sender sets here
$masked_sender = substr_replace($sms_sender, 'xxxx', -4);
$db_query = "\n\t\t\tINSERT INTO " . _DB_PREF_ . "_featureBoard_log\n\t\t\t(in_gateway,in_sender,in_masked,in_keyword,in_msg,in_datetime)\n\t\t\tVALUES ('{$smsc}','{$sms_sender}','{$masked_sender}','{$board_keyword}','{$board_param}','" . core_get_datetime() . "')";
if ($cek_ok = @dba_insert_id($db_query)) {
$db_query1 = "SELECT board_forward_email FROM " . _DB_PREF_ . "_featureBoard WHERE board_keyword='{$board_keyword}'";
$db_result1 = dba_query($db_query1);
$db_row1 = dba_fetch_array($db_result1);
$email = $db_row1['board_forward_email'];
if ($email) {
// get name from c_uid's phonebook
$c_name = phonebook_number2name($c_uid, $sms_sender);
$sms_sender = $c_name ? $c_name . ' <' . $sms_sender . '>' : $sms_sender;
$sms_datetime = core_display_datetime($sms_datetime);
$subject = "[" . $board_keyword . "] " . _('SMS board from') . " {$sms_sender}";
$body = $core_config['main']['web_title'] . "\n";
// fixme anton - ran by playsmsd, no http address, disabled for now looking for solution
// $body.= $core_config['http_path']['base'] . "\n\n";
$body .= _('Date and time') . ": {$sms_datetime}\n";
$body .= _('Sender') . ": {$sms_sender}\n";
$body .= _('Receiver') . ": {$sms_receiver}\n";
$body .= _('SMS board keyword') . ": {$board_keyword}\n\n";
$body .= _('Message') . ":\n{$board_param}\n\n";
$body .= $core_config['main']['email_footer'] . "\n\n";
$body = stripslashes($body);
$email_data = array('mail_from_name' => $core_config['main']['web_title'], 'mail_from' => $core_config['main']['email_service'], 'mail_to' => $email, 'mail_subject' => $subject, 'mail_body' => $body);
sendmail($email_data);
}
$ok = true;
}
}
return $ok;
}
示例13: 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,uid,custom_return_as_reply 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);
$username = uid2username($db_row['uid']);
$debug = dba_query("INSERT INTO " . _DB_PREF_ . "_toolsDebug (value)VALUES('{$username}')");
$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);
//fixme Edward, change to file_get_contents
$returns = file_get_contents($custom_url);
if ($returns) {
//fixme Edward, change to file_get_contents
//socket_set_blocking($connection, false);
//fputs($connection, "GET $custom_url HTTP/1.0\r\n\r\n");
$username = uid2username($db_row['uid']);
if ($db_row['custom_return_as_reply'] == 1) {
sendsms_pv($username, $sms_sender, $returns, 'text', 0);
}
$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;
}
示例14: jasmin_hook_sendsms
function jasmin_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $plugin_config;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "jasmin_hook_sendsms");
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$sms_sender = stripslashes($sms_sender);
if ($plugin_config['jasmin']['module_sender']) {
$sms_sender = $plugin_config['jasmin']['module_sender'];
}
$sms_footer = stripslashes($sms_footer);
$sms_msg = stripslashes($sms_msg);
$ok = false;
if ($sms_footer) {
$sms_msg = $sms_msg . $sms_footer;
}
if ($sms_sender && $sms_to && $sms_msg) {
$unicode_query_string = '';
if ($unicode) {
if (function_exists('mb_convert_encoding')) {
// $sms_msg = mb_convert_encoding($sms_msg, "UCS-2BE", "auto");
$sms_msg = mb_convert_encoding($sms_msg, "UCS-2", "auto");
// $sms_msg = mb_convert_encoding($sms_msg, "UTF-8", "auto");
$unicode_query_string = "&coding=8";
// added at the of query string if unicode
}
}
$query_string = "username=" . urlencode($plugin_config['jasmin']['api_username']) . "&password=" . urlencode($plugin_config['jasmin']['api_password']) . "&to=" . urlencode($sms_to) . "&from=" . urlencode($sms_sender) . "&content=" . urlencode($sms_msg) . $unicode_query_string;
$query_string .= "&dlr=yes&dlr-level=2&dlr-url=" . urlencode($plugin_config['jasmin']['callback_url']);
$url = $plugin_config['jasmin']['url'] . "?" . $query_string;
_log("send url:[" . $url . "]", 3, "jasmin_hook_sendsms");
// new way
$opts = array('http' => array('method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\nContent-Length: " . strlen($query_string) . "\r\nConnection: close\r\n", 'content' => $query_string));
$context = stream_context_create($opts);
$response = file_get_contents($plugin_config['jasmin']['url'], FALSE, $context);
// Success "07033084-5cfd-4812-90a4-e4d24ffb6e3d"
// Error "No route found"
$resp = explode(' ', $response, 2);
if ($resp[0] == 'Success') {
$c_message_id = $resp[1];
$c_message_id = str_replace('"', '', $c_message_id);
_log("sent smslog_id:" . $smslog_id . " message_id:" . $c_message_id . " smsc:" . $smsc, 2, "jasmin_hook_sendsms");
$db_query = "\n\t\t\t\tINSERT INTO " . _DB_PREF_ . "_gatewayJasmin_log (local_smslog_id, remote_smslog_id)\n\t\t\t\tVALUES ('{$smslog_id}', '{$c_message_id}')";
$id = @dba_insert_id($db_query);
if ($id) {
$ok = true;
$p_status = 1;
dlr($smslog_id, $uid, $p_status);
}
} else {
// even when the response is not what we expected we still print it out for debug purposes
if ($resp[0] == 'Error') {
$resp = $resp[1];
} else {
$resp = $response;
}
_log("failed smslog_id:" . $smslog_id . " resp:[" . $resp . "] smsc:" . $smsc, 2, "jasmin_hook_sendsms");
}
}
if (!$ok) {
$p_status = 2;
dlr($smslog_id, $uid, $p_status);
}
return $ok;
}
示例15: _
$j++;
}
$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));