Evaluasi Akhir Semester PWEB A 2021
Nama : Jonathan Leonardo Hasiholan Simanjuntak
NRP : 05111940000150
Kelas : Pweb A
Dokumen PDF EAS :
Nomor 3 :
Implementasikan aplikasi. Boleh dikerjakan secara kelompok, didokumentasikan, dan dibuat video demo/ presentasinya di youtube. Semua hasil pekerjaan disatukan di blognya masing-masing.
Jawaban :
Pengerjaan secara mandiri.
Fitur yang dikembangkan : Student - Submission Assignment.
Video demo penjelasan pengerjaan program :
Berikut adalah tampilan table - table yang digunakan pada database :
Tampilan akhir menu - menu dari aplikasi :
Berikut adalah kumpulan source - code dari web application yang saya buat :
- config.phpThis file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
<?php $server = "localhost"; $user = "root"; $password = ""; $nama_database = "eas_pweb"; $db = mysqli_connect($server, $user, $password, $nama_database); if (!$db) { die("Gagal terhubung dengan database: " . mysqli_connect_error()); } - form-detail.phpThis file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
<?php include("config.php"); session_start(); if($_SESSION['status']!="login"){ header("location: index.php"); } if (!isset($_GET['id'])) { header('Location: list-tugas.php'); } $id = $_GET['id']; $sql = "Select * from assignment Where id=$id"; $query = mysqli_query($db, $sql); $tugas = mysqli_fetch_assoc($query); if (mysqli_num_rows($query) < 1) { die("Data tidak ditemukan..."); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Detail Pengumpulan Assignment | SMK Coding</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <link rel="stylesheet" href="css/style.css"> </head> <body> <header> <span style="display: inline;"> <a href="menu.php"><img src="images/smk-coding.png" alt="gambar"></a> <a href="logout.php"> <button type="button" class="btn btn-danger btn-sm float-right" style="margin-top: 2%; margin-right: 3%;">Log Out</button></a> </span> </header> <div class=" formContainer" style="margin-top: 80px; margin-bottom: 80px"> <h1 style="margin-bottom: 40px;">Detail Submission</h1> <div class="container"> <div id="formMahasiswa"> <table class="table table-borderless custab"> <tr> <td style="width: 25%"><label for="nama">Waktu Submission</label></td> <td style="width: 2%"> : </td> <td style=""><?php echo $tugas['waktu']?></td> </tr> <tr> <td style="width: 25%"><label for="nama">Nama Siswa</label></td> <td style="width: 2%"> : </td> <td style=""><?php echo $_SESSION['nama']?></td> </tr> <tr> <td style="width: 25%"><label for="nama">Nomor Induk Siswa</label></td> <td style="width: 2%"> : </td> <td style=""><?php echo $_SESSION['nis']?></td> </tr> <tr> <td style="width: 25%"><label for="nama">Judul Tugas</label></td> <td style="width: 2%"> : </td> <td style=""><?php echo $tugas['judul']?></td> </tr> <tr> <td style="width: 25%"><label for="nama">Kelas</label></td> <td style="width: 2%"> : </td> <td style=""><?php $kelasID = $tugas['kelas']; $sql0 = "Select * from kelas Where id=$kelasID"; $query0 = mysqli_query($db, $sql0); $kelas = mysqli_fetch_assoc($query0); echo $kelas['nama_kelas']; ?> </td> </tr> <tr> <td style="width: 25%"><label for="nama">Upload Dokumen</label></td> <td style="width: 2%"> : </td> <td style=""><?php if($tugas['dokumen'] != NULL){ $info = pathinfo($tugas['dokumen']); if ($info['extension'] == "pdf"){ echo "<iframe src='document/".$tugas['dokumen']."' width='560' height='480' allow='autoplay'>Browser anda tidak mendukung Iframe.</iframe>"; } else{ echo "<a href='document/".$tugas['dokumen']."'>" .$tugas['dokumen']. "</a>"; } } else{ echo "Tidak ada dokumen!"; }?> </td> </tr> </table> <a href="list-tugas.php"><button type="button" class="btn btn-primary float-right" style="margin-top: 20px;">Kembali</button></a> </div> </div> </div> <footer> <h4>All Rights Reserved</h4> </footer> </body> </html> - form-edit.phpThis file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
<?php include("config.php"); session_start(); if($_SESSION['status']!="login"){ header("location: index.php"); } if (!isset($_GET['id'])) { header('Location: list-tugas.php'); } $id = $_GET['id']; $sql = "Select * From assignment Where id=$id"; $query = mysqli_query($db, $sql); $tugas = mysqli_fetch_assoc($query); if (mysqli_num_rows($query) < 1) { die("Data tidak ditemukan..."); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Formulir Edit Submission | SMK Coding</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <link rel="stylesheet" href="css/style.css"> </head> <body> <header> <span style="display: inline;"> <a href="menu.php"><img src="images/smk-coding.png" alt="gambar"></a> <a href="logout.php"> <button type="button" class="btn btn-danger btn-sm float-right" style="margin-top: 2%; margin-right: 3%;">Log Out</button></a> </span> </header> <div class=" formContainer" style="margin-top: 80px; margin-bottom: 80px"> <h1 style="margin-bottom: 40px;">Edit Submission</h1> <div> <?php if (isset($_GET['status'])) : ?> <p> <?php if ($_GET['status'] == 'kuranglengkap') { echo "<h4 style='color: #bf2b16; margin-bottom: 20px;'>Isi Judul & Kelas!</h4>"; } ?> </p> <?php endif; ?> </div> <div class="container"> <form autocomplete="off" action="proses-edit.php" method="POST" enctype="multipart/form-data"> <input type="hidden" name="id" value="<?php echo $tugas['id'] ?>"> <div class="form-group"> <label for="judul">Judul Tugas :</label> <input type="text" name="judul" class="form-control" minlength="1" value=" <?php echo $tugas['judul'] ?> "> </div> <div class="form-group"> <label for="kelas">Pilih Kelas :</label> <?php $sql = 'Select * from kelas Order By nama_kelas Asc;'; $query = mysqli_query($db, $sql); ?> <select name="kelas" class="form-control"> <option value="0">Pilih Kelas yang Tersedia</option> <?php if(mysqli_num_rows($query) > 0) { ?> <?php while($row = mysqli_fetch_assoc($query)) { ?> <?php $number = (int)$row['id']; ?> <option <?php echo ($tugas['kelas'] == $row['id']) ? "selected" : "" ?> value= <?php echo $number ?>><?php echo $row['nama_kelas']; ?></option> <?php } ?> <?php } ?> </select> </div> <div class="form-group"> <label for="dokumen">Upload Dokumen :</label><br><br> <?php if($tugas['dokumen'] != NULL){ $info = pathinfo($tugas['dokumen']); if ($info['extension'] == "pdf"){ echo "<iframe src='document/".$tugas['dokumen']."' width='560' height='480' allow='autoplay'>Browser anda tidak mendukung Iframe.</iframe><br><br>"; echo "<input type='file' name='dokumen' value='".$tugas['dokumen']."'><br><br>"; echo "<input type='checkbox' name='ubah_dokumen' value='true'> Ceklis jika ingin mengubah dokumen saat ini<br>"; } else{ echo "<a href='document/".$tugas['dokumen']."'>" .$tugas['dokumen']. "</a>"; echo "<br><br>"; echo "<input type='file' name='dokumen' value='".$tugas['dokumen']."'><br><br>"; echo "<input type='checkbox' name='ubah_dokumen' value='true'> Ceklis jika ingin mengubah dokumen saat ini<br>"; } } else { echo "Tidak ada dokumen!<br><br>"; echo "<input type='file' name='dokumen' value=''><br><br>"; echo "<input type='checkbox' name='ubah_dokumen' value='true'> Ceklis jika ingin mengubah dokumen saat ini<br>"; } ?> </div> <span style="display : inline"> <button name="ubah" type="submit" class="btn btn-primary" style="margin-top: 20px; width: 10%;">Ubah</button> <a href="list-tugas.php"><button type="button" name="cancel" class="btn btn-danger" style="margin-top: 20px; margin-left: 3%; width: 10%;">Batal</button></a> </span> </form> </div> </div> <footer> <h4>© All Rights Reserved.</h4> </footer> </body> </html> - form-register.phpThis file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Formulir Pendaftaran Akun Baru | SMK Coding</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <link rel="stylesheet" href="css/style.css"> </head> <html> <body> <header> <a href="index.php"><img src="images/smk-coding.png" alt="gambar"></a> </header> <div class=" formContainer" style="margin-top: 80px; margin-bottom: 80px"> <h1 style="margin-bottom: 40px;">Registrasi Akun</h1> <div> <?php if (isset($_GET['regakun'])) : ?> <p> <?php if ($_GET['regakun'] == 'nisalreadyreg') { echo "<h4 style='color: #bf2b16; margin-bottom: 40px;'>Data NIS sudah terdaftar !</h4>"; } else if ($_GET['regakun'] == 'wrongpass') { echo "<h4 style='color: #bf2b16; margin-bottom: 40px;'>Password yang dimasukkan tidak sesuai !</h4>"; } else if ($_GET['regakun'] == 'gagal') { echo "<h4 style='color: #bf2b16; margin-bottom: 40px;'>Pendaftaran Akun Anda Gagal !</h4>"; } else if ($_GET['regakun'] == 'emailalreadyreg') { echo "<h4 style='color: #bf2b16; margin-bottom: 40px;'>Data Email sudah terdaftar !</h4>"; } else if ($_GET['regakun'] == 'kuranglengkap') { echo "<h4 style='color: #bf2b16; margin-bottom: 40px;'>Lengkapi keseluruhan data!</h4>"; } ?> </p> <?php endif; ?> </div> <div class="container"> <form autocomplete="off" action="proses-register.php" method="POST"> <div class="form-group"> <label for="nama">Nama Siswa :</label> <input type="text" name="nama" class="form-control" minlength="1" maxlength="50"> </div> <div class="form-group"> <label for="nis">Nomor Induk Siswa :</label> <input type="text" name="nis" class="form-control" minlength="1" maxlength="25"> </div> <div class="form-group"> <label for="email">Email :</label> <input type="email" name="email" class="form-control" minlength="1" maxlength="30"> </div> <div class="form-group"> <label for="password">Password :</label> <input type="password" name="password" class="form-control" minlength="1" maxlength="20"> </div> <div class="form-group"> <label for="repassword">Ulangi Kembali Password :</label> <input type="password" name="repassword" class="form-control" minlength="1" maxlength="20"> </div> <span style="display : inline"> <button name="register" type="submit" class="btn btn-primary" style="margin-top: 20px; width: 10%;">Daftar</button> <a href="index.php"><button type="button" name="cancel" class="btn btn-danger" style="margin-top: 20px; margin-left: 3%; width: 10%;">Batal</button></a> </span> </form> </div> </div> <footer> <h4>All Rights Reserved</h4> </footer> </body> </html> - form-submit.phpThis file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
<?php include ("config.php"); session_start(); if($_SESSION['status']!="login"){ header("location: index.php"); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Form Assignment Submission | SMK Coding</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <link rel="stylesheet" href="css/style.css"> </head> <body> <header> <span style="display: inline;"> <a href="menu.php"><img src="images/smk-coding.png" alt="gambar"></a> <a href="logout.php"> <button type="button" class="btn btn-danger btn-sm float-right" style="margin-top: 2%; margin-right: 3%;">Log Out</button></a> </span> </header> <div class=" formContainer" style="margin-top: 80px; margin-bottom: 80px"> <h1 style="margin-bottom: 40px;">Submit Tugas Kelas</h1> <div> <?php if (isset($_GET['status'])) : ?> <p> <?php if ($_GET['status'] == 'kuranglengkap') { echo "<h4 style='color: #bf2b16; margin-bottom: 20px;'>Isi Judul & Kelas!</h4>"; } ?> </p> <?php endif; ?> </div> <div class="container"> <form autocomplete="off" action="proses-submit.php" method="POST" enctype="multipart/form-data"> <div class="form-group"> <label for="judul">Judul Tugas :</label> <input type="text" name="judul" class="form-control" minlength="1"> </div> <div class="form-group"> <label for="kelas">Pilih Kelas :</label> <?php $sql = 'Select * from kelas Order By nama_kelas Asc;'; $query = mysqli_query($db, $sql); ?> <select name="kelas" class="form-control"> <option value="0">Pilih Kelas yang Tersedia</option> <?php if(mysqli_num_rows($query) > 0) { ?> <?php while($row = mysqli_fetch_assoc($query)) { ?> <?php $number = (int)$row['id']; ?> <option value= <?php echo $number ?>><?php echo $row['nama_kelas']; ?></option> <?php } ?> <?php } ?> </select> </div> <div class="form-group"> <label for="dokumen">Upload Dokumen :</label><br><br> <input type="file" name="dokumen" value=""><br><br> <input type="checkbox" name="ubah_dokumen" value="true"> Ceklis jika ingin menambahkan dokumen<br> </div> <span style="display : inline"> <button name="tambah" type="submit" class="btn btn-primary" style="margin-top: 20px; width: 10%;">Tambah</button> <a href="menu.php"><button type="button" name="cancel" class="btn btn-danger" style="margin-top: 20px; margin-left: 3%; width: 10%;">Batal</button></a> </span> </form> </div> </div> <footer> <h4>© All Rights Reserved.</h4> </footer> </body> </html> - hapus.phpThis file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
<?php include("config.php"); if (isset($_GET['id'])) { $id = (int)$_GET['id']; $sql = "Select * from assignment Where id=$id"; $query = mysqli_query($db, $sql); $data = mysqli_fetch_array($query); if(is_file("document/".$data['dokumen'])){ unlink("document/".$data['dokumen']); } $sql2 = "Delete from assignment Where id=$id"; $query2 = mysqli_query($db, $sql2); if ($query2) { header('Location: list-tugas.php?hapus=sukses'); } else { die("Gagal menghapus..."); } } else { die("Akses Dilarang..."); } - index.phpThis file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Aplikasi Submission Tugas Siswa | SMK Coding</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <link rel="stylesheet" href="css/style.css"> </head> <body> <header> <a href=""><img src="images/smk-coding.png" alt="gambar"></a> </header> <div class=" formContainerLogin" style="margin-top: 80px; margin-bottom: 80px"> <h1 style="margin-bottom: 40px;">Login</h1> <div> <?php if (isset($_GET['status'])) : ?> <p> <?php if ($_GET['status'] == 'gagal') { echo "<h4 style='color: #bf2b16; margin-bottom: 40px;'>Informasi Login Salah!</h4>"; } if ($_GET['status'] == 'logout') { echo "<h4 style='color: #004a74; margin-bottom: 40px;'>Anda telah berhasil logout</h4>"; } ?> </p> <?php endif; ?> <?php if (isset($_GET['regstatus'])) : ?> <p> <?php if ($_GET['regstatus'] == 'sukses') { echo "<h4 style='color: #64c09f; margin-bottom: 40px; '>Pendaftaran Berhasil !</h4>"; } ?> </p> <?php endif; ?> </div> <div class="container"> <form autocomplete="off" action="proses-login.php" method="POST"> <div class="form-group"> <label for="nis">Nomor Induk Siswa :</label> <input type="text" name="nis" class="form-control" minlength="1" maxlength="15"> </div> <div class="form-group"> <label for="password">Password :</label> <input type="password" name="password" class="form-control" minlength="1" maxlength="20"> </div> <button name="login" type="submit" class="btn btn-primary" style="margin-top: 20px; width: 100%;">Login</button> <br><br> <div class="form-group" style="text-align:center;"> <label for="register">Don't have an account? <a id="registerLink" href="form-register.php">Register Here</a></label> </div> </form> </div> </div> <footer> <h4>All Rights Reserved</h4> </footer> </body> </html> - list-tugas.phpThis file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
<?php include("config.php"); session_start(); if($_SESSION['status']!="login"){ header("location: index.php"); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>List Pengumpulan Tugas Siswa | SMK Coding</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <link rel="stylesheet" href="css/style.css"> <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> --> <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js"></script> --> <style> .custab { border: 1px solid #ccc; padding: 5px; transition: 0.5s; } .custab:hover { box-shadow: 3px 3px 0px transparent; transition: 0.5s; } </style> </head> <body> <header> <span style="display: inline;"> <a href="menu.php"><img src="images/smk-coding.png" alt="gambar"></a> <a href="logout.php"> <button type="button" class="btn btn-danger btn-sm float-right" style="margin-top: 2%; margin-right: 3%;">Log Out</button></a> </span> </header> <div id="dataTable" style="margin-top:20px; margin-bottom: 40px; width: 90%; margin-left: auto; margin-right: auto;"> <h1>List Submission Tugas</h1> <br> <!-- <div> <?php if (isset($_GET['hapus'])) : ?> <p> <?php if ($_GET['hapus'] == 'sukses') { echo "<h4 style='color: #bf2b16; margin-bottom: 20px;'>Penghapusan Berhasil!</h4>"; } ?> </p> <?php endif; ?> </div> --> <br> <p style="text-align: right; margin:15px"> <a href=" form-submit.php" class="btn btn-primary btn-xs col-md-3">[+] Tambah Baru</a> </p> <div class="col-md-12 col-md-offset-2 custyle"> <table class="table table-striped custab"> <thead> <tr> <th width="5%" style="text-align: center;">Detail</th> <th width="8%" style="text-align: center;">ID Tugas</th> <th width="20%" style="text-align: center;">Waktu Submit</th> <th width="22%" style="text-align: center;">Judul Tugas</th> <th width="20%" style="text-align: center;">Kelas</th> <th style="text-align: center;">Aksi</th> <th width="8%" style="text-align: center;">Nilai</th> </tr> </thead> <tbody> <?php $user_id = (int)$_SESSION['user_id']; $sql = "Select * From assignment where user_id = $user_id"; $query = mysqli_query($db, $sql); while ($tugas = mysqli_fetch_array($query)) { $tugaskelas = (int)$tugas['kelas']; $sql1 = "select * from kelas where id=$tugaskelas"; $query1 = mysqli_query($db, $sql1); $kelas = mysqli_fetch_assoc($query1); echo "<tr>"; echo "<td><a class='btn btn-success btn-xs' href='form-detail.php?id=" . $tugas['id'] . "'><span class='glyphicon glyphicon-remove'></span>Detail</a></td>"; echo "<td class='text-center'>" . $tugas['id'] . "</td>"; echo "<td class='text-center'>" . $tugas['waktu'] . "</td>"; echo "<td class='text-center'>" . $tugas['judul'] . "</td>"; echo "<td class='text-center'>" . $kelas['nama_kelas'] . "</td>"; echo "<td class='text-center'>"; if($tugas['nilai'] == 0){ echo "<a class='btn btn-info btn-sm' href='form-edit.php?id=" . $tugas['id'] . "' ><span class='glyphicon glyphicon-edit'></span>Edit</a> | "; } echo "<a class='btn btn-danger btn-sm' href='hapus.php?id=" . $tugas['id'] . "' onclick='return confirm(`Apakah anda yakin ingin menghapus item ini?`)'><span class='glyphicon glyphicon-remove'></span>Hapus</a>"; echo "</td>"; echo "<td class='text-center'>"; if($tugas['nilai'] == 0) { echo "-"; } else{ echo $tugas['nilai']; } echo "</td>"; echo "</tr>"; } ?> </tbody> </table> <p style="font-weight : bolder">Total : <?php echo mysqli_num_rows($query) ?></p> <div id="editor"></div> <!-- <buttont type="button" class="btn btn-warning float-right" style="margin-top: 2%; margin-right:2%; width: 5%" id="btn-downloadlist">Print</buttont> --> </div> </div> <footer> <h4>All Rights Reserved</h4> </footer> </body> - logout.phpThis file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
<?php // mengaktifkan session session_start(); // menghapus semua session session_destroy(); // mengalihkan halaman sambil mengirim pesan logout header("location:index.php?status=logout"); ?> - menu.php
- proses-edit.phpThis file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
<?php include("config.php"); session_start(); if (isset($_POST['ubah'])) { $id = $_POST['id']; $judul = $_POST['judul']; $kelas = (int)$_POST['kelas']; $user_id = (int)$_SESSION['user_id']; $tmpwaktu = date_create(); $waktu = date_format($tmpwaktu, 'Y-m-d H:i:s'); if($judul == "" || $kelas == 0){ header("Location: form-edit.php?id='$id'&status=kuranglengkap"); } else { if(isset($_POST['ubah_dokumen'])){ $dokumen = $_FILES['dokumen']['name']; $tmp = $_FILES['dokumen']['tmp_name']; $dokumenbaru = date('dmYHis').$dokumen; $path = "document/".$dokumenbaru; if(move_uploaded_file($tmp, $path)){ $sql= "Select * From assignment WHERE id='$id'"; $query = mysqli_query($db, $sql); $data = mysqli_fetch_array($query); if(is_file("document/".$data['dokumen'])) unlink("document/".$data['dokumen']); $sql = "Update assignment set judul='$judul', kelas='$kelas', waktu='$waktu', dokumen='$dokumenbaru', nilai=0 Where id='$id'"; $query = mysqli_query($db, $sql); if ($query) { header('Location: list-tugas.php'); } else { die('Gagal menyimpan perubahan'); } } else{ echo 'alert("Maaf, Dokumen gagal untuk diupload")'; echo "<br><a href='form-edit.php'>Kembali Ke Form</a>"; } } else{ $sql = "Update assignment set judul='$judul', kelas='$kelas', waktu='$waktu', nilai=0 Where id='$id';"; $query = mysqli_query($db, $sql); if ($query) { header('Location: list-tugas.php'); } else { die('Gagal menyimpan perubahan'); } } } } else{ die("Akses dilarang..."); } - proses-login.phpThis file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
<?php include ("config.php"); session_start(); if (isset($_POST['login'])){ $nis = $_POST['nis']; $password = $_POST['password']; $sql = "Select * from user where nis='$nis' && password='$password'"; $query = mysqli_query($db, $sql); $cek = mysqli_num_rows($query); if ($cek > 0) { $user = mysqli_fetch_assoc($query); $_SESSION['nama'] = $user['nama']; $_SESSION['nis'] = $user['nis']; $_SESSION['user_id'] = $user['id']; $_SESSION['status'] = "login"; header('Location: menu.php'); // header('Location: menu.php?user=' .$user["id"]. ''); } else { header('Location: index.php?status=gagal'); } } ?> - proses-register.phpThis file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
<?php include("config.php"); if (isset($_POST['register'])){ $nama = $_POST['nama']; $email = $_POST['email']; $nis = $_POST['nis']; $password = $_POST['password']; $repassword = $_POST['repassword']; $sql = "Select * from user where nis='$nis'"; $query = mysqli_query($db, $sql); $cek = mysqli_num_rows($query); if ($nis == "" || $email == "" || $nama=="" || $password == "" || $repassword == ""){ header('Location: form-register.php?regakun=kuranglengkap'); } else { if ($cek <= 0) { $sql0 = "Select * from user where email='$email'"; $query0 = mysqli_query($db, $sql); $cek0 = mysqli_num_rows($query); if($cek0 <= 0){ if($password == $repassword){ $sql2 = "Insert into user (nama, nis, email, password) values ('$nama', '$nis', '$email', '$password')"; $query2 = mysqli_query($db, $sql2); if ($query2) { header('Location: index.php?regstatus=sukses'); } else { header('Location: form-register.php?regakun=gagal'); } } else{ // password yang dimasukkan tidak sesuai header('Location: form-register.php?regakun=wrongpass'); } } else{ header('Location: form-register.php?regakun=emailalreadyreg'); } } else { // Data akun sudah ada di db header('Location: form-register.php?regakun=nisalreadyreg'); } } } else{ die('Akses Dilarang ...'); } ?> - proses-submit.phpThis file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
<?php include("config.php"); session_start(); if (isset($_POST['tambah'])) { $judul = $_POST['judul']; $kelas = (int)$_POST['kelas']; $user_id = (int)$_SESSION['user_id']; $tmpwaktu = date_create(); $waktu = date_format($tmpwaktu, 'Y-m-d H:i:s'); if($judul == "" || $kelas == 0){ header('Location: form-submit.php?status=kuranglengkap'); } else { if(isset($_POST['ubah_dokumen'])){ $dokumen = $_FILES['dokumen']['name']; $tmp = $_FILES['dokumen']['tmp_name']; $dokumenbaru = date('dmYHis').$dokumen; $path = "document/".$dokumenbaru; if(move_uploaded_file($tmp, $path)){ $sql = "Insert into assignment (judul, kelas, dokumen, user_id, waktu) values ('$judul', $kelas, '$dokumenbaru', $user_id, '$waktu');"; $query = mysqli_query($db, $sql); if ($query) { header('Location: menu.php?status=sukses'); } else { header('Location: menu.php?status=gagal'); } } else{ echo 'alert("Maaf, Dokumen gagal untuk diupload")'; echo "<br><a href='form-submit.php'>Kembali Ke Form</a>"; } } else{ $sql = "Insert into assignment (judul, kelas, user_id, waktu) values ('$judul', $kelas, $user_id, '$waktu');"; $query = mysqli_query($db, $sql); if ($query) { header('Location: menu.php?status=sukses'); } else { header('Location: menu.php?status=gagal'); } } } } else{ die("Akses dilarang..."); } - style.cssThis file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
@import url("https://fonts.googleapis.com/css2?family=Mulish:wght@200;400&display=swap"); body { display: flex; flex-direction: column; min-height: 100vh; font-family: "Mulish"; } .formContainer { margin-right: auto; margin-left: auto; width: 72%; background-color: #ececec; border-radius: 20px; height: auto; padding: 70px; } .formContainerLogin { margin-right: auto; margin-left: auto; width: 600px; background-color: #ececec; border-radius: 20px; height: auto; padding: 70px; } h1 { text-align: center; font-weight: bolder; color: #004a74; } h4, h5 { text-align: center; /* font-weight: bolder; */ } header { background-color: #004a74; } header img { margin-bottom: 1%; margin-top: 1%; margin-left: 5%; width: 20%; } footer { background-color: #004a74; margin-top: auto; display: flex; flex-direction: column; } footer h4 { text-align: center; padding-top: 30px; padding-bottom: 30px; color: #ffffff; font-weight: 400; } label { font-weight: 900; } .btn-danger { font-weight: bold; color: whitesmoke; background-color: #bf2b16; border-color: #bf2b16; } .btn-primary { font-weight: bold; color: whitesmoke; background-color: #004a74; border-color: #004a74; } .btn-primary:hover { color: whitesmoke; background-color: #f39c12; border-color: #f39c12; } #registerLink { color: #004a74; } #registerLink:hover { color: #f39c12; }
Untuk lebih jelasnya, berikut adalah link github pengerjaan saya : Link Github.
Sekian pengerjaan evaluasi yang telah saya lakukan. Mohon maaf apabila terdapat kesalahan atau kekurangan dalam pekerjaan saya. Terima kasih atas perhatiannya.
Komentar
Posting Komentar