Advertisement
irfanamir

index_siswa.php

Mar 24th, 2021
1,031
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.02 KB | None | 0 0
  1. <?php
  2. session_start();
  3. require_once("koneksi.php");
  4. // Jika sesi dari login belum dibuat maka akan kita kembalikan ke halaman login
  5. if(!isset($_SESSION['nisn'])){
  6.     header("location: login_siswa.php");
  7. }else{
  8.     // Jika sudah dibuatkan sesi maka akan kita masukkan kedalam variabel
  9.     $nisn = $_SESSION['nisn'];
  10. }
  11. $siswa = mysqli_query($db, "SELECT * FROM siswa
  12. JOIN kelas ON siswa.id_kelas=kelas.id_kelas
  13. WHERE nisn='$nisn'");
  14. $result = mysqli_fetch_assoc($siswa);
  15. $pembayaran = mysqli_query($db, "SELECT * FROM pembayaran
  16. JOIN petugas ON pembayaran.id_petugas = petugas.id_petugas
  17. JOIN spp ON pembayaran.id_spp = spp.id_spp
  18. WHERE nisn='$nisn'
  19. ORDER BY tgl_bayar");
  20. ?>
  21. <!DOCTYPE html>
  22. <html lang="en">
  23. <head>
  24.     <meta charset="UTF-8">
  25.     <title>Halaman Utama</title>
  26. </head>
  27. <body>
  28.     <h1>Selamat datang di Aplikasi Pembayaran SPP</h1>
  29.             <hr />
  30.     <a href="#biodata">Biodata Kamu</a> |
  31.     <a href="#history">History Pembayaran</a> |
  32.     <a href="logout.php">Logout</a>
  33.             <hr />
  34.     <h2>>> Hallo, <?= $result['nama']; ?></h2>
  35.     <h3>Biodata Kamu</h3>
  36.             <hr />
  37.     <table cellpadding="5" id="biodata">
  38.         <tr>
  39.             <td>NISN</td>
  40.             <td>:</td>
  41.             <td><?= $result['nisn']; ?></td>
  42.         </tr>
  43.         <tr>
  44.             <td>NIS</td>
  45.             <td>:</td>
  46.             <td><?= $result['nis']; ?></td>
  47.         </tr>
  48.         <tr>
  49.             <td>Nama</td>
  50.             <td>:</td>
  51.             <td><?= $result['nama']; ?></td>
  52.         </tr>
  53.         <tr>
  54.             <td>Kelas</td>
  55.             <td>:</td>
  56.             <td><?= $result['nama_kelas'] . " | " . $result['kompetensi_keahlian']; ?></td>
  57.         </tr>
  58.         <tr>
  59.             <td>Alamat</td>
  60.             <td>:</td>
  61.             <td><?= $result['alamat']; ?></td>
  62.         </tr>
  63.     </table>
  64.             <hr />
  65.     <p><h2>History Pembayaran Kamu</p></h2>
  66.     <table id="history" cellpadding="5" cellspacing="0" border="1">
  67.         <tr>
  68.             <td>No. </td>
  69.             <td>Dibayarkan kepada</td>
  70.             <td>Tgl. Pembayaran</td>
  71.             <td>Tahun | Nominal yang harus dibayar</td>
  72.             <td>Jumlah yang dibayarkan</td>
  73.             <td>Status</td>
  74.         </tr>
  75. <?php
  76. $no = 1;
  77. while($r = mysqli_fetch_assoc($pembayaran)){ ?>
  78.         <tr>
  79.             <td><?= $no; ?></td>
  80.             <td><?= $r['nama_petugas']; ?></td>
  81.             <td><?= $r['tgl_bayar'] . "/" . $r['bulan_dibayar'] . "/" . $r['tahun_dibayar']; ?></td>
  82.             <td><?= $r['tahun'] . " | Rp. " . $r['nominal']; ?></td>
  83.             <td><?= $r['jumlah_bayar']; ?></td>
  84.             <td>
  85. <?php
  86. // Jika jumlah bayar sesuai dengan yang harus dibayar maka Status LUNAS
  87. if($r['jumlah_bayar'] == $r['nominal']){ ?>
  88.                 <font style="color: darkgreen; font-weight: bold;">LUNAS</font>
  89. <?php }else{ ?>                             BELUM LUNAS <?php } ?> </td>
  90.         </tr>
  91.     <?php $no++; } ?>
  92.     </table>
  93.             <hr />
  94.     <?php require_once("footer.php"); ?>
  95. </body>
  96. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement