Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo "<meta http-equiv='refresh' content='2; url=sms_ipk.php'>";
- ?>
- <h1> Ketik: </h1>
- <h4> NIM(spasi)IPK </h4>
- <h4> 201201(spasi) IPK </h4>
- <?php
- mysql_connect("localhost","root","root");
- mysql_select_db("smsd");
- $sql = mysql_query("select * from inbox where Processed='false'");
- while ($data = mysql_fetch_array($sql)) {
- $keyword = strtoupper($data[TextDecoded]);
- $oke = mysql_query("select * from mahasiswa where hp='".$data['SenderNumber']."'");
- $cari = mysql_num_rows($oke);
- $explode = explode(" ",$keyword);
- $ex2 = $explode[0];
- $ipk=mysql_query("SELECT sks,nilai FROM nilai, makul WHERE nilai.kd_makul = makul.kd_makul and mahasiswa.nim=nilai.nim
- AND nilai.nim = '$ex2'");
- $ketemu = mysql_num_rows($ipk);
- if ($cari == 0) {
- $pesan = "No Anda tidak terdaftar, daftarkan nomor handphone Anda ke bagian Administrator Sistem untuk mendapatkan informasi nilai melalui SMS.";
- $masuk = mysql_query("insert into outbox (InsertIntoDB,SendingDateTime,DestinationNumber,TextDecoded,SendingTimeOut,DeliveryReport,CreatorID)
- values (sysdate(),sysdate(),'".$data['SenderNumber']."','$pesan',sysdate(),'yes','system')");
- if ($masuk) {
- $ubah = mysql_query("update inbox set Processed='true' where ID='".$data['ID']."'");
- }
- }
- else if ($ketemu == 0) {
- $pesan = "Nilai yang Anda minta belum ada / Keyword Anda salah.";
- $masuk = mysql_query("insert into outbox (InsertIntoDB,SendingDateTime,DestinationNumber,TextDecoded,SendingTimeOut,DeliveryReport,CreatorID)
- values (sysdate(),sysdate(),'".$data['SenderNumber']."','$pesan',sysdate(),'yes','system')");
- if ($masuk) {
- $ubah = mysql_query("update inbox set Processed='true' where ID='".$data['ID']."'");
- }
- }
- else {
- while($data=mysql_fetch_array($ipk)){
- $tot_sks+=$data['sks'];
- $tot_m+=$data['sks']*$data['nilai'];
- }
- $ipk=$tot_m/$tot_sks;
- $pesan = "nim : $ex2, IPK : $ipk";
- $masuk = mysql_query("insert into outbox (InsertIntoDB,SendingDateTime,DestinationNumber,TextDecoded,SendingTimeOut,DeliveryReport,CreatorID)
- values (sysdate(),sysdate(),'".$data['SenderNumber']."','$pesan',sysdate(),'yes','system')");
- if ($masuk) {
- mysql_query("DELETE FROM inbox WHERE ID='".$data['ID']."'");
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement