Guest User

simpan

a guest
Feb 7th, 2014
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1.  
  2. <?php
  3. include "config/koneksi.php";
  4. $seminar=$_POST['seminar'];
  5. $npm=$_POST['npm'];
  6. $judul=$_POST['judul'];
  7. $pembimbing1=$_POST['pembimbing1'];
  8. $pembimbing2=$_POST['pembimbing11'];
  9. $tgl1=$_POST['tanggal1'];
  10. $tgl2=$_POST['tanggal2'];
  11. $sql = mysql_query ("select * from mahasiswa where npm ='$npm' and id_jurusan = '2'");
  12. $hasil = mysql_fetch_array ($sql);
  13. if ($npm == $hasil ['npm'])
  14. {
  15. echo "<script>
  16. alert ('NPM ini bukan mahasiswa diploma')
  17. window.location='tugas_akhir.php'
  18. </script>";
  19. }
  20. else if (($pembimbing1)==($pembimbing2))
  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