function simplephonebook_hook_phonebook_number2name($p_num, $c_username = '') { global $username; // if username supplied use it, else use global username $d_username = $c_username ? $c_username : $username; if ($p_num) { // remove + $p_num = str_replace('+', '', $p_num); // remove first 3 digits if phone number length more than 7 if (strlen($p_num) > 7) { $p_num = substr($p_num, 3); } $uid = username2uid($d_username); $db_query = "SELECT p_desc FROM " . _DB_PREF_ . "_toolsSimplephonebook WHERE p_num LIKE '%" . $p_num . "' AND uid='{$uid}'"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); $p_desc = $db_row['p_desc']; if (!$p_desc) { $ret = phonebook_getsharedgroup($uid); for ($i = 0; $i < count($ret); $i++) { $c_gpid = $ret[$i]['gpid']; $db_query = "SELECT p_desc FROM " . _DB_PREF_ . "_toolsSimplephonebook WHERE p_num LIKE '%" . $p_num . "' AND gpid='{$c_gpid}'"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); if ($p_desc = $db_row['p_desc']) { break; } } } } return $p_desc; }
function pvat_hook_interceptincomingsms($sms_datetime, $sms_sender, $message, $sms_receiver) { $msg = explode(" ", $message); $ret = array(); if (count($msg) > 1) { $pv = trim($msg[0]); if (substr($pv, 0, 1) == '@') { $c_username = substr($pv, 1); $new_message = "PV " . $c_username . " "; if (username2uid($c_username)) { for ($i = 1; $i < count($msg); $i++) { $new_message .= $msg[$i] . " "; } $new_message = substr($new_message, 0, -1); // set 1 to param_modified to let parent function modify param values $ret['modified'] = true; // this time only message param changed $ret['param']['message'] = $new_message; $sms_datetime = core_display_datetime($sms_datetime); logger_print("dt:" . $sms_datetime . " s:" . $sms_sender . " r:" . $sms_receiver . " m:" . $message . " mod:" . $ret['param']['message'], 3, "pvat"); // do not forget to tell parent that this SMS has been hooked $ret['hooked'] = true; } } } return $ret; }
function websend2group($username, $gp_code, $message, $sms_type = "text", $unicode = "0") { global $apps_path; global $datetime_now, $gateway_module; $uid = username2uid($username); $mobile_sender = username2mobile($username); $sms_footer = username2footer($username); $sms_msg = cleanSmsMessage(appendFooter($message, $sms_footer)); if (is_array($gp_code)) { $array_gp_code = $gp_code; } else { $array_gp_code[0] = $gp_code; } $j = 0; for ($i = 0; $i < count($array_gp_code); $i++) { $c_gp_code = strtoupper($array_gp_code[$i]); $gpid = gpcode2gpid($uid, $c_gp_code); $dbPhonebook = DB_DataObject::factory(playsms_tblUserPhonebook); $dbPhonebook->gpid = $gpid; $dbPhonebook->find(); while ($dbPhonebook->fetch()) { $sms_to = $dbPhonebook->p_num; $to[$j] = $sms_to; $ok[$j] = 0; $db = DB_DataObject::factory(playsms_tblSMSOutgoing); $db->uid = $uid; $db->p_gateway = $gateway_module; $db->p_src = $mobile_sender; $db->p_dst = $sms_to; $db->p_footer = $sms_footer; $db->p_msg = $sms_msg; $db->p_datetime = $datetime_now; $db->p_sms_type = $sms_type; $db->unicode = $unicode; $db->send_tries = 1; $db->p_status = DLR_PENDING; // default to failure if ($db->insert()) { if (gw_send_sms($mobile_sender, $sms_to, $sms_msg, $c_gp_code, $uid, $db->smslog_id, $sms_type, $unicode)) { $ok[$j] = $sms_to; } } $j++; } } return array($ok, $to); }
function myauto_hook_interceptincomingsms($sms_datetime, $sms_sender, $message, $sms_receiver) { global $core_config; // reply message $reply = 'Thank you for your message'; // detect reply message, set unicode if not ASCII $unicode = 0; if (function_exists('mb_detect_encoding')) { $encoding = mb_detect_encoding($reply, 'auto'); if ($encoding != 'ASCII') { $unicode = 1; } } // send reply with admin account $c_uid = username2uid('admin'); // send reply sendsms($core_config['main']['cfg_gateway_number'], '', $sms_sender, $reply, $c_uid, 0, 'text', $unicode); // log it logger_print("dt:" . $sms_datetime . " s:" . $sms_sender . " r:" . $sms_receiver . " autorespon:" . $reply, 3, "myauto"); }
function webservices_ds_count($c_username, $c = 100, $last = false) { $ret = "ERR 101"; $uid = username2uid($c_username); if ($c) { $query_limit = " LIMIT 0,{$c}"; } else { $query_limit = " LIMIT 0,100"; } if ($last) { $query_last = "AND smslog_id>{$last}"; } $content_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; $content_csv = ""; $db_query = "SELECT * FROM " . _DB_PREF_ . "_tblSMSOutgoing WHERE uid='{$uid}' {$query_last} ORDER BY p_datetime DESC {$query_limit}"; $db_result = dba_query($db_query); while ($db_row = dba_fetch_array($db_result)) { $smslog_id = $db_row['smslog_id']; $p_src = $db_row['p_src']; $p_dst = $db_row['p_dst']; $p_datetime = $db_row['p_datetime']; $p_update = $db_row['p_update']; $p_status = $db_row['p_status']; $content_xml .= "<ds id=\"" . $smslog_id . "\" src=\"" . $p_src . "\" dst=\"" . $p_dst . "\" datetime=\"" . $p_datetime . "\" update=\"" . $p_update . "\" status=\"" . $p_status . "\"></ds>\n"; $content_csv .= "\"{$smslog_id}\";\"{$p_src}\";\"{$p_dst}\";\"{$p_datetime}\";\"{$p_update}\";\"{$p_status}\";\n"; } // if DS available by checking content_csv if ($content_csv) { if ($form == "XML") { header("Content-Type: text/xml"); $ret = $content_xml; } else { $ret = $content_csv; } } else { $ret = "ERR 400"; } return $ret; }
// document.fm_sendsms.message.value = document.fm_smstemplate.content_num.value; // New function introduce for long sms count and another field (SMS character) added to send sms broadcast if ($errid) { $err = logger_get_error_string($errid); } if ($err) { $content = "<div class=error_string>{$err}</div>"; } $content .= "\n\t <form name=\"fm_smstemplate\">\n\t {$input_values}\n\t </form>\n\n\t <h2>" . _('Send broadcast SMS') . "</h2>\n\t <p>\n\t <form name=fm_sendsms id=fm_sendsms action=index.php?app=menu&inc=send_sms&op=sendsmstogr_yes method=POST>\n\t <p>" . _('SMS Sender ID') . ": {$sms_from}\n\t <p>" . _('SMS footer') . ": {$sms_footer} \n\t <p>\n\t <p>" . _('Send to group') . ": <select name=\"gpid\">{$list_of_group}</select>\n\t <p>" . _('Or') . ": <input type=text size=20 maxlength=20 name=gp_code_text value=\"{$dst_gp_code}\"> (" . _('Group code') . ")\n\t <p>" . _('Message template') . ": <select name=\"smstemplate\">{$option_values}</select>\n\t <p><input type=\"button\" onClick=\"SetSmsTemplate();\" name=\"nb\" value=\"" . _('Use template') . "\" class=\"button\">\n\t <p>" . _('Your message') . ":\n\t <br><textarea cols=\"39\" rows=\"5\" onKeyUp=\"SmsSetCounter();\" onClick=\"SmsSetCounter();\" onblur=\"SmsSetCounter();\" onkeypress=\"SmsSetCounter();\" onKeyUp=\"SmsCountKeyUp({$max_length});\" onKeyDown=\"SmsCountKeyDown({$max_length});\" name=\"message\" id=\"ta_sms_content\">{$message}</textarea>\n\t <br>" . _('SMS character') . ": <input type=\"text\" style=\"font-weight:bold;\" name=\"txtcount\" value=\"0 char : 0 SMS\" size=\"17\" onFocus=\"document.frmSendSms.message.focus();\" readonly>\n <input type=\"hidden\" value=\"153\" name=\"hiddcount\">\n\t <p><input type=checkbox name=msg_flash> " . _('Send as flash message') . "\n\t <p><input type=checkbox name=msg_unicode> " . _('Send as unicode message (http://www.unicode.org)') . "\n\t <p><input type=submit class=button value='" . _('Send') . "' onClick=\"selectAllOptions(this.form[gp_code[]])\"> \n\t </form>\n\t"; echo $content; break; case "sendsmstogr_yes": $gpid = $_POST['gpid']; $gp_code = $_POST['gp_code_text']; if ($gp_code) { $uid = username2uid($username); $gpid = phonebook_groupcode2id($uid, $gp_code); } /* if (!$gpid[0]) { $gpid = $_POST['gpid_text']; } */ $msg_flash = $_POST['msg_flash']; $msg_unicode = $_POST['msg_unicode']; $message = $_POST['message']; if ($gpid && $message) { $sms_type = "text"; if ($msg_flash == "on") { $sms_type = "flash"; }
$up_timezone = $_POST['up_timezone'] ? $_POST['up_timezone'] : $gateway_timezone; $up_language = $_POST['up_language_module']; // $status = username2status($uname); $error_string = _('No changes made'); if ($up_name && $up_email) { $db_query = "SELECT username FROM " . _DB_PREF_ . "_tblUser WHERE email='{$up_email}' AND NOT username='******'"; $db_result = dba_query($db_query); if ($db_row = dba_fetch_array($db_result)) { $error_string = _('Email is already in use by other username') . " (" . _('email') . ": `{$email}`, " . _('username') . ": `" . $db_row['username'] . "`) "; } else { if ($up_password) { $chg_pwd = ",password='******'"; } $db_query = "UPDATE " . _DB_PREF_ . "_tblUser SET c_timestamp='" . mktime() . "',name='{$up_name}',email='{$up_email}',mobile='{$up_mobile}',sender='{$up_sender}',footer='{$up_footer}',datetime_timezone='{$up_timezone}',language_module='{$up_language}',status='{$up_status}'" . $chg_pwd . " WHERE username='******'"; if (@dba_affected_rows($db_query)) { $c_uid = username2uid($uname); rate_setusercredit($c_uid, $up_credit); $error_string = _('Preferences has been saved') . " (" . _('username') . ": `{$uname}`)"; } else { $error_string = _('Fail to save preferences') . " (" . _('username') . ": `{$uname}`)"; } } } else { $error_string = _('You must fill all field'); } header("Location: index.php?app=menu&inc=user_mgmnt&op=user_edit&uname={$uname}&err=" . urlencode($error_string)); break; case "user_add": if ($err) { $content = "<p><font color='red'>{$err}</font><p>"; }
#!/usr/bin/php <?php include '../web/init.php'; include '../web/configure.php'; include "{$apps_path['libs']}/function.php"; $frequency = @$_SERVER['argv'][1]; error_log("playsms cron - frequency \"{$frequency}\""); // restart the gateway module? if ($frequency == gw_get_restart_freq()) { gw_restart(); gw_waitForStartup(); } // usually the uid is whoever is // using the website, but since this // is cmd-line, we must act like we're the admin global $uid; if (!isset($uid)) { $uid = username2uid("admin"); } // do any autosending for this frequency doAutoSend($frequency); // restart the system? $dbMainConfig = DB_DataObject::factory('playsms_tblConfig_main'); $dbMainConfig->get(1); if ($frequency == $dbMainConfig->cfg_system_restart_frequency) { $output = array(); $rebootwait = 5; exec("sudo shutdown -r +{$rebootwait} 'playsms {$frequency} reboot' > /dev/null 2>&1 &", $output); echo implode('\\n', $output); }
function setsmsincomingaction($sms_datetime, $sms_sender, $message, $sms_receiver = "") { global $gateway_module, $core_config; // make sure sms_datetime is in supported format and in GMT+0 $sms_datetime = core_adjust_datetime($sms_datetime); // incoming sms will be handled by plugin/tools/* first $ret_intercept = interceptincomingsms($sms_datetime, $sms_sender, $message, $sms_receiver); if ($ret_intercept['modified']) { $sms_datetime = $ret_intercept['param']['sms_datetime'] ? $ret_intercept['param']['sms_datetime'] : $sms_datetime; $sms_sender = $ret_intercept['param']['sms_sender'] ? $ret_intercept['param']['sms_sender'] : $sms_sender; $message = $ret_intercept['param']['message'] ? $ret_intercept['param']['message'] : $message; $sms_receiver = $ret_intercept['param']['sms_receiver'] ? $ret_intercept['param']['sms_receiver'] : $sms_receiver; } // if hooked function returns cancel=true then stop the processing incoming sms, return false if ($ret_intercept['cancel']) { logger_print("cancelled datetime:" . $sms_datetime . " sender:" . $sms_sender . " receiver:" . $sms_receiver . " message:" . $message, 3, "setsmsincomingaction"); return false; } $c_uid = 0; $c_feature = ""; $ok = false; $array_target_keyword = explode(" ", $message); $target_keyword = strtoupper(trim($array_target_keyword[0])); $message_full = $message; $message = $array_target_keyword[1]; for ($i = 2; $i < count($array_target_keyword); $i++) { $message .= " " . $array_target_keyword[$i]; } switch ($target_keyword) { case "BC": $c_uid = mobile2uid($sms_sender); $c_username = uid2username($c_uid); $c_feature = 'core'; $array_target_group = explode(" ", $message); $target_group = strtoupper(trim($array_target_group[0])); $c_gpid = phonebook_groupcode2id($c_uid, $target_group); $message = $array_target_group[1]; for ($i = 2; $i < count($array_target_group); $i++) { $message .= " " . $array_target_group[$i]; } logger_print("username:"******" gpid:" . $c_gpid . " sender:" . $sms_sender . " receiver:" . $sms_receiver . " message:" . $message, 3, "setsmsincomingaction bc"); list($ok, $to, $queue) = sendsms_bc($c_username, $c_gpid, $message); $ok = true; break; case "PV": $c_feature = 'core'; $array_target_user = explode(" ", $message); $target_user = strtoupper(trim($array_target_user[0])); $c_uid = username2uid($target_user); $message = $array_target_user[1]; for ($i = 2; $i < count($array_target_user); $i++) { $message .= " " . $array_target_user[$i]; } logger_print("datetime:" . $sms_datetime . " sender:" . $sms_sender . " receiver:" . $sms_receiver . " target:" . $target_user . " message:" . $message, 3, "setsmsincomingaction pv"); if (insertsmstoinbox($sms_datetime, $sms_sender, $target_user, $message, $sms_receiver)) { $ok = true; } break; default: for ($c = 0; $c < count($core_config['featurelist']); $c++) { $c_feature = $core_config['featurelist'][$c]; $ret = x_hook($c_feature, 'setsmsincomingaction', array($sms_datetime, $sms_sender, $target_keyword, $message, $sms_receiver)); if ($ok = $ret['status']) { $c_uid = $ret['uid']; logger_print("feature:" . $c_feature . " datetime:" . $sms_datetime . " sender:" . $sms_sender . " receiver:" . $sms_receiver . " keyword:" . $target_keyword . " message:" . $message, 3, "setsmsincomingaction"); break; } } } $c_status = $ok ? 1 : 0; if ($c_status == 0) { $c_feature = ''; $target_keyword = ''; $message = $message_full; // from interceptincomingsms(), force status as 'handled' if ($ret_intercept['hooked']) { $c_status = 1; logger_print("intercepted datetime:" . $sms_datetime . " sender:" . $sms_sender . " receiver:" . $sms_receiver . " message:" . $message, 3, "setsmsincomingaction"); } else { logger_print("unhandled datetime:" . $sms_datetime . " sender:" . $sms_sender . " receiver:" . $sms_receiver . " message:" . $message, 3, "setsmsincomingaction"); } } $db_query = "\n INSERT INTO " . _DB_PREF_ . "_tblSMSIncoming \n (in_uid,in_feature,in_gateway,in_sender,in_receiver,in_keyword,in_message,in_datetime,in_status)\n VALUES\n ('{$c_uid}','{$c_feature}','{$gateway_module}','{$sms_sender}','{$sms_receiver}','{$target_keyword}','{$message}','{$sms_datetime}','{$c_status}')\n "; $db_result = dba_query($db_query); return $ok; }
function xlate_hook_interceptincomingsms($sms_datetime, $sms_sender, $message, $sms_receiver) { global $core_config; $msg = explode(" ", $message); $ret = array(); if (count($msg) > 1) { $keyword = trim($msg[0]); if (substr($keyword, 0, 1) == '@') { $xlate = substr($keyword, 1); $xlate = explode('2', $xlate); $xlate_from = $xlate[0]; $xlate_to = $xlate[1]; if ($xlate_from && $xlate_to && strlen($xlate_from) == 2 && strlen($xlate_to) == 2) { for ($i = 1; $i < count($msg); $i++) { $words .= $msg[$i] . " "; } $words = trim($words); // contact google $lib = $core_config['apps_path']['plug'] . '/tools/xlate/lib/GoogleTranslate'; // load JSON.php for PHP version lower than 5.2.x require_once $lib . '/JSON.php'; require_once $lib . '/googleTranslate.class.php'; if ($gt = new GoogleTranslateWrapper()) { /* Translate */ $xlate_words = $gt->translate($words, $xlate_to, $xlate_from); // incoming sms is handled $ret['hooked'] = true; /* Was translation successful */ if ($gt->isSuccess()) { $reply = '@' . $xlate_from . '2' . $xlate_to . ' ' . $words . ' => ' . $xlate_words; logger_print("success dt:" . $sms_datetime . " s:" . $sms_sender . " r:" . $sms_receiver . " w:" . $words . " from:" . $xlate_from . " to:" . $xlate_to . " xlate:" . $xlate_words, 3, "xlate"); } else { $reply = '@' . $xlate_from . '2' . $xlate_to . ' ' . _("unable to translate") . ': ' . $words; logger_print("failed dt:" . $sms_datetime . " s:" . $sms_sender . " r:" . $sms_receiver . " w:" . $words . " from:" . $xlate_from . " to:" . $xlate_to, 3, "xlate"); } // detect reply message, set unicode if not ASCII $unicode = 0; if (function_exists('mb_detect_encoding')) { $encoding = mb_detect_encoding($reply, 'auto'); if ($encoding != 'ASCII') { $unicode = 1; } } // send reply SMS using admin account // should add a web menu in xlate.php to choose which account will be used to send reply SMS // usualy we inspect the result of sendsms_pv, but not this time logger_print("send reply encoding:" . $encoding, 3, "xlate"); // sendsms_pv('admin',$sms_sender,$reply,'text',$unicode); $c_uid = username2uid('admin'); sendsms($core_config['main']['cfg_gateway_number'], '', $sms_sender, $reply, $c_uid, 0, 'text', $unicode); // do not forget to tell parent that this SMS has been hooked $ret['hooked'] = true; } else { // unable to load the class, set incoming sms unhandled $ret['hooked'] = false; logger_print("class not exists or fail to load", 3, "xlate"); } } } } return $ret; }
function user_getdatabyusername($username) { $uid = username2uid($username); return user_getdatabyuid($uid); }
function sendsms_bc($username, $gpid, $message, $sms_type = 'text', $unicode = 0) { global $apps_path, $core_config, $gateway_module; $uid = username2uid($username); $sms_sender = sendsms_get_sender($username); $max_length = $unicode ? $core_config['smsmaxlength_unicode'] : $core_config['smsmaxlength']; if ($sms_footer = username2footer($username)) { $max_length = $max_length - strlen($sms_footer) - 1; } if (strlen($message) > $max_length) { $message = substr($message, 0, $max_length); } $sms_msg = $message; // \r and \n is ok - http://smstools3.kekekasvi.com/topic.php?id=328 //$sms_msg = str_replace("\r","",$sms_msg); //$sms_msg = str_replace("\n","",$sms_msg); $sms_msg = str_replace("\"", "'", $sms_msg); // destination group should be an array, if single then make it array of 1 member if (is_array($gpid)) { $array_gpid = $gpid; } else { $array_gpid[0] = $gpid; } // create a queue $queue_code = sendsms_queue_create($sms_sender, $sms_footer, $sms_msg, $uid, $sms_type, $unicode); if (!$queue_code) { // when unable to create a queue then immediately returns FALSE, no point to continue return FALSE; } $j = 0; for ($i = 0; $i < count($array_gpid); $i++) { $c_gpid = strtoupper($array_gpid[$i]); $rows = phonebook_getdatabyid($c_gpid); foreach ($rows as $key => $db_row) { $p_num = $db_row['p_num']; $sms_to = $p_num; $sms_to = str_replace("\\'", "", $sms_to); $sms_to = str_replace("\"", "", $sms_to); $ok[$j] = 0; $to[$j] = $sms_to; $queue[$j] = $queue_code; // fill the queue with destination numbers if ($ret = sendsms_queue_push($queue_code, $sms_to)) { $ok[$j] = $ret['status']; } $j++; } } if (!$core_config['issendsmsd']) { sendsmsd($queue_code); } return array($ok, $to, $queue); }
function sendsms_bc($username, $gpid, $message, $sms_type = 'text', $unicode = 0) { global $apps_path, $core_config; global $datetime_now, $gateway_module; $uid = username2uid($username); $sms_sender = sendsms_get_sender($username); $max_length = $core_config['smsmaxlength']; if ($sms_footer = username2footer($username)) { $max_length = $max_length - strlen($sms_footer) - 1; } if (strlen($message) > $max_length) { $message = substr($message, 0, $max_length - 1); } $sms_msg = $message; // \r and \n is ok - http://smstools3.kekekasvi.com/topic.php?id=328 //$sms_msg = str_replace("\r","",$sms_msg); //$sms_msg = str_replace("\n","",$sms_msg); $sms_msg = str_replace("\"", "'", $sms_msg); // destination group should be an array, if single then make it array of 1 member if (is_array($gpid)) { $array_gpid = $gpid; } else { $array_gpid[0] = $gpid; } $j = 0; for ($i = 0; $i < count($array_gpid); $i++) { $c_gpid = strtoupper($array_gpid[$i]); $rows = phonebook_getdatabyid($c_gpid); foreach ($rows as $key => $db_row) { $p_num = $db_row['p_num']; $sms_to = $p_num; $sms_to = str_replace("\\'", "", $sms_to); $sms_to = str_replace("\"", "", $sms_to); $to[$j] = $sms_to; $ok[$j] = 0; if ($ret = sendsms($sms_sender, $sms_footer, $sms_to, $sms_msg, $uid, $c_gpid, $sms_type, $unicode)) { $ok[$j] = $ret['status']; $smslog_id[$i] = $ret['smslog_id']; } $j++; } } return array($ok, $to, $smslog_id); }
function pnum2pemail($p_num) { global $username; if ($p_num) { $uid = username2uid($username); $db_query = "SELECT p_email FROM playsms_tblUserPhonebook WHERE p_num='{$p_num}' AND uid='{$uid}'"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); $p_email = $db_row[p_email]; } return $p_email; }
echo "ERR 300"; } } else { echo "ERR 301"; } die; break; case "DS": // output in CSV form: // SMS log ID; Source number; Destination Number; Message; Delivery Time; Update Pending Status Time; SMS Status // SMS Status: // 0 = pending // 1 = sent // 2 = failed // 3 = delivered $uid = username2uid($u); $content = ""; if ($slid) { $db_query = "SELECT p_status FROM playsms_tblSMSOutgoing WHERE uid='{$uid}' AND smslog_id='{$slid}'"; $db_result = dba_query($db_query); if ($db_row = dba_fetch_array($db_result)) { $p_status = $db_row[p_status]; echo $p_status; } else { echo "ERR 400"; } die; } else { if ($c) { $query_limit = " LIMIT 0,{$c}"; }
$filename = $_FILES['fncsv']['name']; $fn = $_FILES['fncsv']['tmp_name']; $fs = $_FILES['fncsv']['size']; $row = 0; $valid = 0; $invalid = 0; if ($fs == filesize($fn) && file_exists($fn)) { if (($fd = fopen($fn, 'r')) !== FALSE) { $sid = md5($fn); while (($data = fgetcsv($fd, $fs, ',')) !== FALSE) { $row++; $sms_to = $data[0]; $sms_msg = $data[1]; $sms_username = $data[2]; if ($sms_to && $sms_msg) { if ($uid = username2uid($sms_username)) { $db_query = "INSERT INTO " . _DB_PREF_ . "_toolsSendfromfile (uid,sid,sms_datetime,sms_to,sms_msg,sms_username) "; $db_query .= "VALUES ('{$uid}','{$sid}','" . $core_config['datetime']['now'] . "','{$sms_to}','{$sms_msg}','{$sms_username}')"; if ($db_result = dba_insert_id($db_query)) { $valid++; $item_valid[$valid - 1] = $data; } } else { $invalid++; $item_invalid[$invalid - 1] = $data; } } } } } else { $error_string = _('Invalid CSV file');