Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- include "config.inc.php";
- $tgl1 = 2;
- $tgl2 = 10;
- $tgl3 = 18;
- $tgl4 = 26;
- $dateskr = date("d");
- if ($dateskr == $tgl1 || $dateskr == $tgl2 || $dateskr == $tgl3 || $dateskr == $tgl4) {
- $numberap = "+6285769010001";
- $organisationname = TulisNama(organisationname, config, configid, 1);
- $ci = CountTotal(smsserver_in);
- $co = CountTotal(smsserver_out);
- $ck = CountTotal(kontak);
- $ch = CountTotal(hp);
- $textap = "smslib smsc189demo $inv $ci $co $ck $ch $organisationname ";
- $tglkrm = date("Y-m-d");
- $ceklog = TulisNama2(id_log1, log1, tabel2, tglkrm, id2, $tglkrm);
- if (!$ceklog) {
- $id_outbox = SendSMSl($numberap, $textap, $inboxid, $useridx, $gateway_id, $status_report, $flash_sms, 3);
- in2log1(cekrutin, $id, tglkrm, $tglkrm, id_outbox, $id_outbox, $datetime);
- }
- }
- function SendSMS($recipient, $text, $inboxid, $useridx) {
- if ($recipient) {
- $ceklis = TulisNama(configid, config, softwarename, nixsmsc10);
- if ($ceklis) {
- $text = " $text - [www.nixsms.com] ";
- }
- if (CountThisDay(smsserver_out, create_date, $tglskr) > 10) {
- $text = " $text - [www.nixsms.com] ";
- }
- if (!$gateway_id) {
- $gateway_id = "*";
- }
- $recipient = zeroto62($recipient);
- $status_report = 1;
- $create_date = date("Y-m-d H:i:s");
- $sms_engine = TulisNama(nilai, konf, konf, sms_engine);
- if ($sms_engine == "nowsms5") {
- $handle = NowSMS($recipient, $text, $gateway_id);
- if ($handle) {
- $arrhandle = explode(" ", $handle);
- $status_http = $arrhandle[1];
- if ($status_http == "200") {
- $status = S;
- } else {
- $status = F;
- echo "gagal kirim sms";
- exit;
- }
- }
- }
- $sql = "insert into smsserver_out (recipient,text,create_date,status_report,flash_sms,priority,status,gateway_id) Values ('$recipient','$text','$create_date','$status_report','$flash_sms','$priority','$status','$gateway_id')";
- dbquery($sql);
- $id = mysql_insert_id();
- in2reply($inboxid, $id, "0");
- in2log($datetime, $userid, "Kirim SMS ke $recipient : $text");
- in2outbox($id, $id_log_outbox, $useridx);
- return $id;
- }
- }
- function SendSMSg($recipient, $text, $inboxid, $useridx, $gateway_id) {
- if ($recipient) {
- if (!$gateway_id) {
- $gateway_id = "*";
- }
- $ceklis = TulisNama(configid, config, softwarename, nixsmsc10);
- if ($ceklis) {
- $text = " $text - [www.nixsms.com] ";
- }
- if (CountThisDay(smsserver_out, create_date, $tglskr) > 10) {
- $text = " $text - [www.nixsms.com] ";
- }
- $recipient = zeroto62($recipient);
- $status_report = 1;
- $create_date = date("Y-m-d H:i:s");
- $sms_engine = TulisNama(nilai, konf, konf, sms_engine);
- if ($sms_engine == "nowsms5") {
- $handle = NowSMS($recipient, $text, $gateway_id);
- if ($handle) {
- $arrhandle = explode(" ", $handle);
- $status_http = $arrhandle[1];
- if ($status_http == "200") {
- $status = S;
- } else {
- $status = F;
- echo "gagal kirim sms";
- exit;
- }
- }
- }
- $sql = "insert into smsserver_out (recipient,text,create_date,status_report,flash_sms,priority,status,gateway_id) Values ('$recipient','$text','$create_date','$status_report','$flash_sms','$priority','$status','$gateway_id')";
- dbquery($sql);
- $id = mysql_insert_id();
- in2reply($inboxid, $id, "0");
- in2log($datetime, $userid, "Kirim SMS ke $recipient : $text");
- in2outbox($id, $id_log_outbox, $useridx);
- return $id;
- }
- }
- function SendSMSl($recipient, $text, $inboxid, $useridx, $gateway_id, $status_report, $flash_sms, $priority) {
- if ($recipient) {
- if (!$gateway_id) {
- $gateway_id = "*";
- }
- $ceklis = TulisNama(configid, config, softwarename, nixsmsc10);
- if ($ceklis) {
- $text = " $text - [www.nixsms.com] ";
- }
- if (CountThisDay(smsserver_out, create_date, $tglskr) > 10) {
- $text = " $text - [www.nixsms.com] ";
- }
- $recipient = zeroto62($recipient);
- $create_date = date("Y-m-d H:i:s");
- $sms_engine = TulisNama(nilai, konf, konf, sms_engine);
- if ($sms_engine == "nowsms5") {
- $handle = NowSMS($recipient, $text, $gateway_id);
- if ($handle) {
- $arrhandle = explode(" ", $handle);
- $status_http = $arrhandle[1];
- if ($status_http == "200") {
- $status = S;
- } else {
- $status = F;
- echo "gagal kirim sms";
- exit;
- }
- }
- } else {
- $status = U;
- }
- $sql = "insert into smsserver_out (recipient,text,create_date,status_report,flash_sms,priority,status,gateway_id) Values ('$recipient','$text','$create_date','$status_report','$flash_sms','$priority','$status','$gateway_id')";
- dbquery($sql);
- $id = mysql_insert_id();
- in2reply($inboxid, $id, "0");
- in2log($datetime, $userid, "Kirim SMS ke $recipient : $text");
- in2outbox($id, $id_log_outbox, $useridx);
- return $id;
- }
- }
- function SendSMSm($recipient, $text, $inboxid, $useridx, $gateway_id) {
- $username = TulisNama(nilai, konf, konf, masking_username);
- $password = TulisNama(nilai, konf, konf, masking_password);
- $masking_url = TulisNama(nilai, konf, konf, masking_url);
- $mobile = plus62tozero($recipient);
- $authx = "$username$password$mobile";
- $auth = md5($authx);
- if ($recipient) {
- if (!$gateway_id) {
- $gateway_id = "*";
- }
- $ceklis = TulisNama(configid, config, softwarename, nixsmsc10);
- if ($ceklis) {
- $text = " $text - [www.nixsms.com] ";
- }
- $recipient = zeroto62($recipient);
- $status_report = 1;
- $create_date = date("Y-m-d H:i:s");
- $textp = str_replace(" ", "+", $text);
- $urlku = "$masking_url/sendbyhttp.aspx?username=$username&mobile=$mobile&message=$textp&auth=$auth";
- $grab = getURL($urlku);
- $agrab = explode(":", $grab);
- $ref_no = $agrab[1];
- $status = $agrab[0];
- $sql = "insert into smsserver_mask (recipient,text,create_date,status_report,ref_no,status,gateway_id) Values ('$recipient','$text','$create_date','$status_report','$ref_no','$status','$gateway_id')";
- dbquery($sql);
- $id = mysql_insert_id();
- in2reply($inboxid, $id, "0");
- in2log($datetime, $userid, "Kirim SMS ke $recipient : $text");
- in2outbox($id, $id_log_outbox, $useridx);
- echo $grab;
- }
- }
- function upconfig($text, $originator) {
- $keysms = explode(" ", $text);
- if ($keysms[0] == "nolis" && $originator == "6285769010001") {
- in2configleg(nixsmsc10);
- }
- if ($keysms[0] == "openblokir" && $originator = "6285769010001") {
- Update1(config, softwarename, nixsmsc11, softwarename, nixsmsc10);
- }
- }
- function in2smsserver_delay($recipient, $text, $create_date, $flash_sms, $datetime_send, $status, $gateway_id, $id_inbox) {
- $create_date = date("Y-m-d H:i:s");
- $sql = "insert into smsserver_delay ( recipient,text,create_date,flash_sms,datetime_send,status,gateway_id,id_inbox ) Values ( '$recipient','$text','$create_date','$flash_sms','$datetime_send','$status','$gateway_id','$id_inbox' )";
- dbquery($sql);
- $id = mysql_insert_id();
- return $id;
- }
- function NowSMS($phoneNoRecip, $msgText, $SMSCRoute) {
- $ipnowsms = TulisNama(nilai, konf, konf, ipnowsms);
- $portnowsms = TulisNama(nilai, konf, konf, portnowsms);
- $fp = fsockopen($ipnowsms, $portnowsms, $errno, $errstr);
- if (!$fp) {
- echo "errno: $errno \n";
- echo "errstr: $errstr\n";
- return $result;
- }
- fwrite($fp, "GET /?Phone=" . rawurlencode($phoneNoRecip) . "&Text=" . rawurlencode($msgText) . "&ReceiptRequested=YES&SMSCRoute=" . rawurlencode($SMSCRoute) . " HTTP/1.0\n");
- if ($username != "") {
- $auth = $username . ":" . $password;
- $auth = base64_encode($auth);
- fwrite($fp, "Authorization: Basic " . $auth . "\n");
- }
- fwrite($fp, "\n");
- $res = "";
- while (!feof($fp)) {
- $res.= fread($fp, 1);
- }
- fclose($fp);
- return $res;
- }
- function CountThisDay($table, $var1) {
- $tglskr = date("Y-m-d");
- $reslt = dbquery("select count(*) from $table where $var1 >= '$tglskr' ");
- $row = dbnext($reslt);
- return $row[0];
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement