Advertisement
GWibisono

Untitled

Feb 7th, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. include "config/koneksi.php";
  3. $seminar=$_POST['seminar'];
  4. $npm=$_POST['npm'];
  5. $judul=$_POST['judul'];
  6. $pembimbing1=$_POST['pembimbing1'];
  7. $pembimbing2=$_POST['pembimbing11'];
  8. $tgl1=$_POST['tanggal1'];
  9. $tgl2=$_POST['tanggal2'];
  10. $sql = mysql_query ("select count(npm) c from mahasiswa where npm ='$npm' and id_jurusan = '2'");
  11. $hasil = mysql_fetch_array ($sql);
  12.     if ($hasil ['c']==0)
  13.     {
  14.      echo "<script>
  15.                 alert ('NPM ini bukan mahasiswa diploma')
  16.                 window.location='tugas_akhir.php'
  17.                 </script>";
  18.     }
  19.         else if (($pembimbing1)==($pembimbing2))
  20.         {
  21.              echo "<script>
  22.                     alert ('Pembimbing tidak boleh sama')
  23.                     window.location='tugas_akhir.php'
  24.                     </script>";
  25.         }
  26.             else if(($tgl2)<($tgl1))   
  27.             {
  28.                 echo "<script>
  29.                         alert ('Harap periksa waktu')
  30.                         window.location='tugas_akhir.php'
  31.                         </script>";
  32.             }  
  33.                 else
  34.                     {
  35.                         $cekdata="select npm from tugas_akhir where npm='$npm'";
  36.                         $ada=mysql_query($cekdata)  or die(mysql_error());
  37.                        if(mysql_num_rows($ada)>0)
  38.                          { die("<script>
  39.                             alert ('Maaf, NPM ini sepertinya sudah ada di database')
  40.                             window.location='tugas_akhir.php'
  41.                             </script>");
  42.                         }
  43.                         else {
  44.                         $sql=mysql_query("insert into tugas_akhir (id_seminar,npm,judul ,nip1,nip2,tgl_ajukan_judul,tgl_lulus )
  45.                         values ('$seminar','$npm','$judul','$pembimbing1','$pembimbing2','$tgl1','$tgl2')");
  46.                         if ($sql)
  47.                             {
  48.                             echo "<script>
  49.                             alert ('Data tersimpan')
  50.                             window.location='lihat_tugas_akhir.php'
  51.                             </script>";
  52.                             }    
  53.                                 else
  54.                                 {
  55.                                 echo "<script>
  56.                                 alert ('Data gagal tersimpan')
  57.                                 window.location='lihat_tugas_akhir.php'
  58.                                 </script>";
  59.                                 }
  60.                                     }
  61.                     }
  62.                
  63.     ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement