alexa-tracking
Selamat Guest, Agan dapat mencoba tampilan baru KASKUS Masih Kangen Tampilan Sebelumnya
Kategori
Kategori
1024
1024
KASKUS
51
244
https://www.kaskus.co.id/thread/552c9435162ec2d0408b456d/troble-sms-gateway

troble sms gateway

Halo agan2, ane nuwbie mau mohon bantuan agan2 sekalian. ane bikin program sms gateway akademik pendaftaran mata kuliah gan. Gimana caranya agar bisa mendaftra lebih dari 1 mata kuliah dengan 1 kali sms gan?
ane bisanya cuma daftra 1 mata kuliah aja gan, kalau ane input 2 mata kuliah 1 kali sms, data yang kesimpan di table daftar cuma 1 mata kuliah yang pertama input pertama aja gan.
contoh yang ane bikin REG[spasi]NIM[spasi]KODE_MATAKULIAH sedangkan ane butuhin REG[spasi]NIM[spasi]KODE_MATAKULIAH_1,KODE_MATAKULIAH_2,KODE_MATAKULIAH_3

ini code program run sms ane gan, ane bingung salahnya dimana gan. mohon di bantu master gateway.
Code:

<?php
include 'koneksi.php';
include 'function.php';
$reply=null;

function sendsms($nohp, $pesan, $modem,$idsms)
{
$query3 = "INSERT INTO outbox (DestinationNumber, SenderID, TextDecoded, CreatorID) VALUES ('$nohp', '$modem', '$pesan', 'Gammu')";
$query4= "UPDATE inbox SET Processed='true' WHERE ID = '$idsms'";
mysql_query($query3);
mysql_query($query4);
}

$query = "SELECT * FROM inbox WHERE Processed='false'";
$hasil = mysql_query($query) or die(mysql_error());
while($data=mysql_fetch_array($hasil))
{
//baca no pengirim
$noHP= $data['SenderNumber'];
//baca sms id
$smsID= $data['ID'];
//baca isi sms
$sms=strtoupper($data['TextDecoded']);

//memparsing isi sms berdasar karakter
$split=explode(" ",$sms);
$command =$split[0];
$nim = $split[1];
$mk = $split[2];

if (!empty($mk)) {
//ambil matakuliah
$qmkk="SELECT ma_kul,id_makul from makul where kode='$mk'";
$exeq=mysql_query($qmkk);
$datamk=mysql_fetch_array($exeq);
$matakuliah=$datamk['ma_kul'];
$kdmk=$datamk['id_makul'];

}

if (!empty($nim)) {
//ambil nim
$qnim="SELECT nim,nama_depan from mahasiswa where nim='$nim'";
$exeqm=mysql_query($qnim)or die(mysql_error());
$datanim=mysql_fetch_array($exeqm);
$nimmu=$datanim['nim'];
$cek=mysql_num_rows($qnim);
}

$que=mysql_query("SELECT * FROM reply WHERE keyword='$command'");
while($f=mysql_fetch_array($que)){
if($command == $f['keyword']){
$bb=$f['keyword'];
$dd=$f['reply'];
} else {
$bb="hehe";
}
}

if ($bb == 'REG'){

//isi
if (empty($kdmk)){
$reply = "Maaf mata kuliah yang anda masukkan tidak terdaftar, mohon periksa kembali mata kuliah anda! ";
} else {
if (empty($nimmu)) {
$reply="Maaf NIM anda tidak terdaftar sebagai mahasiswa, mohon periksa kembali NIM anda! ".$nimmu;
}else{
$tgl=date('y-m-d');
$kdmks = explode(",", $kdmk);
foreach ($kdmks as $value) {
$querydaf = "INSERT into DAFTAR values('','$nim','$value','$tgl','Belum Konfirmasi') ";
$hasildaf = mysql_query($querydaf) or die(mysql_error()." 5");
$reply = $dd;
}
}
}
}

else if (empty($dd)){
$reply ="Maaf format yang anda kirim salah, silahkan ketik INFO untuk format sms yang benar. Terima kasih";
}

sendsms($noHP, $reply,'phoneKU',$smsID);
}

// menampilkan semua sms di inbox
$query = "SELECT * FROM inbox ORDER BY ReceivingDateTime DESC LIMIT $offset,$limit";
$hasil = mysql_query($query) or die(mysql_error());

echo " <div class='table-responsive'>";
echo "<table class='table table-striped table-bordered table-hover' id='dataTables-example'>";
echo "<thead>
<tr>
<th>No.</th>
<th>Pesan</th>
<th>Pengirim</th>
<th>Waktu</th>
<th>Status</th>
<th colspan='2'>Act</th>
</tr>
</thead>
<tbody>";
$no=1;
while ($data = mysql_fetch_array($hasil))
{
$nohp = $data['SenderNumber'];
$modem = $data['RecipientID'];
$time = $data['ReceivingDateTime'];
$text = $data['TextDecoded'];
$status=$data['Processed'];
$id=$data['ID'];

$sms=strtoupper($data['TextDecoded']);
$split=explode(" ",$sms);
$command =$split[0];
$nim = $split[1];
$mk = $split[2];

if ($command =='REG') {
$konf="KONFIRM";
$lokasi =$_SERVER['PHP_SELF']."?pg=pg_daftar";
$kon="DEL";
$loka=$_SERVER['PHP_SELF']."?pg=pg_inbox&op=del&id=$id";

}else{
$konf="DEL";
$lokasi=$_SERVER['PHP_SELF']."?pg=pg_inbox&op=del&id=$id";
$kon="-";
$loka="";
}

echo "<tr><td>".$no++."</td><td>".$text."</td><td>".$nohp."</td><td>".$time."</td><td class='td-actions'>"
.$status."</td><td><a href='".$lokasi."'>".$konf."</a></td><td><a href='".$loka."'>".$kon."</a></td></tr>";
}

echo "</tbody></table></div>";
$link=$_SERVER['PHP_SELF']."?pg=pg_inbox&page=";
$countTotalRow = mysql_query('SELECT COUNT(*) AS total FROM inbox');
$queryResult = mysql_fetch_assoc($countTotalRow);
$totalRow = $queryResult['total'];
$totalPage = ceil($totalRow / $limit);
$page = 1;
while ($page <= $totalPage)
{
echo '<a href="?pg=pg_inbox&page='.$page.'&perPage='.$limit.'">'.$page.'</a>';
if ($page < $totalPage)
echo " | ";
$page++;
}

?>
Beri apresiasi terhadap thread ini Gan!
Code:
if (!empty($mk)) {
//ambil matakuliah
foreach (explode(",", $mk) as $mkx){
$qmkk = "SELECT ma_kul, id_makul FROM makul WHERE kode='$mkx'";
$exeq = mysql_query($qmkk);
if ($datamk = mysql_fetch_array($exeq)){
$matakuliah[] = $datamk['ma_kul'];
$kdmk[] = $datamk['id_makul'];
} else {
$matakuliah = array();
$kdmk = array();
break;
}
}
$matakuliah = implode(",", (array)$matakuliah);
$kdmk = implode(",", (array)$kdmk);
}
Code:
$kdmks = explode(",", $kdmk);

foreach ($kdmks as $value) {

$querydaf = "INSERT into DAFTAR values('','$nim','$value','$tgl','Belum Konfirmasi') ";

$hasildaf = mysql_query($querydaf) or die(mysql_error()." 5");

$reply = $dd;

}


coba var dump $kmdks utk input lbh dr 2 matkul
Diubah oleh oknumw3
Quote:


oke gan..ane coba dlu codingnya ganemoticon-Jempol
Quote:


Siap gan, ane coba dlu gan emoticon-Jempol
Quote:


gan kalo kirim sms lewat cmd trus cuma masuk ke outbox doank trus ga masuk ke sent item , itu kenapa ya
mohon pencerahannya gan ?


×
GDP Network
© 2018 KASKUS, PT Darta Media Indonesia. All rights reserved
Ikuti KASKUS di