Jawaban Tugas UAS MBD - Dodik Arvianto - 04319004 - TI - B
Jawaban Tugas UAS MBD - Dodik Arvianto - 04319004 - TI - B
Jawaban Tugas UAS MBD - Dodik Arvianto - 04319004 - TI - B
NIM : 04319004
1. Buatkan tutorial aplikasi user acount basis data terdsistribusi, menggunakan minimal
2 user .
Tampilan menu Login, pada menu login terdapat 2 pilihan login, login sebagai admin dan
login sebagai anggota.
<!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">
<!--
The above 3 meta tags *must* come first in the head; any other head content must come
*after* these tags -->
<meta name="description" content="PerpustakaanKU">
<meta name="perpustakaanku" content="PerpustakaanKU">
<link rel="icon" href="../../favicon.ico">
<title>PerpustakaanKU</title>
</head>
<body background="img/page-background.png">
<div class="container">
</html>
<?php
include("conn.php");
date_default_timezone_set('Asia/Jakarta');
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
$level = $_POST['level'];
if ($level == 'admin') {
if (mysqli_num_rows($q) == 1) {
$_SESSION['user_id'] = $row['user_id'];
$_SESSION['username'] = $username;
$_SESSION['fullname'] = $row['fullname'];
$_SESSION['gambar'] = $row['gambar'];
header('location:admin/index.php');
} else {
header('location:login.html?error=4');
}
}
} else {
$username = mysqli_real_escape_string($conn, $username);
$password = mysqli_real_escape_string($conn, $password);
if (mysqli_num_rows($q) == 1) {
$_SESSION['id'] = $row['id'];
$_SESSION['no_induk'] = $row['no_induk'];
$_SESSION['nama'] = $row['nama'];
$_SESSION['username'] = $username;
$_SESSION['jk'] = $row['jk'];
$_SESSION['kelas'] = $row['kelas'];
$_SESSION['ttl'] = $row['ttl'];
$_SESSION['alamat'] = $row['alamat'];
$_SESSION['foto'] = $row['gambar'];
header('location:anggota/index.php');
} else {
header('location:login.html?error=4');
}
}
}
Tampilan halaman Perpustakaan
<head>
<meta charset="UTF-8">
<title>PerpustakaanKU || Membaca menjadi lebih mudah!</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-
scalable=no' name='viewport'>
<meta name="description" content="Perpustakaan Berbasis Web">
<meta name="keywords" content="Perpustakaan, perpus, online, website">
<meta name="perpustakaanku" content="PerpustakaanKU" />
<!-- bootstrap 3.0.2 -->
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- font Awesome -->
<link href="css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!-- Ionicons -->
<link href="css/ionicons.min.css" rel="stylesheet" type="text/css" />
<!-- Morris chart -->
<link href="css/morris/morris.css" rel="stylesheet" type="text/css" />
<!-- jvectormap -->
<link href="css/jvectormap/jquery-jvectormap-
1.2.2.css" rel="stylesheet" type="text/css" />
<!-- Date Picker -->
<link href="css/datepicker/datepicker3.css" rel="stylesheet" type="text/css" />
<!-- Daterange picker -->
<link href="css/daterangepicker/daterangepicker-
bs3.css" rel="stylesheet" type="text/css" />
<!-- iCheck for checkboxes and radio inputs -->
<link href="css/iCheck/all.css" rel="stylesheet" type="text/css" />
<!-- bootstrap wysihtml5 - text editor -->
<link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='te
xt/css'>
<!-- Theme style -->
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
// 1 detik = 1000
window.setTimeout("waktu()", 1000);
function waktu() {
var tanggal = new Date();
setTimeout("waktu()", 1000);
document.getElementById("output").innerHTML = tanggal.getHours() + ":" + t
anggal.getMinutes() + ":" + tanggal.getSeconds();
}
</script>
<script language="JavaScript">
var tanggallengkap = new String();
var namahari = ("Minggu Senin Selasa Rabu Kamis Jumat Sabtu");
namahari = namahari.split(" ");
var namabulan = ("Januari Februari Maret April Mei Juni Juli Agustus September
Oktober November Desember");
namabulan = namabulan.split(" ");
var tgl = new Date();
var hari = tgl.getDay();
var tanggal = tgl.getDate();
var bulan = tgl.getMonth();
var tahun = tgl.getFullYear();
tanggallengkap = namahari[hari] + ", " + tanggal + " " + namabulan[bulan] + "
" + tahun;
<style type="text/css">
</style>
</head>
<body class="skin-black">
<!-- header logo: style can be found in header.less -->
<header class="header">
<a href="index.html" class="logo">
PerpustakaanKU
</a>
<aside>
<div class="col-md-8">
<section class="panel">
<header class="panel-heading">
<b>Data Pengunjung Hari Ini</b>
</header>
<div class="panel-body table-responsive">
<?php
$tanggal = date("Y/m/d");
$query1 = "select * from pengunjung where tgl_kunjung=
'$tanggal'";
$tampil = mysqli_query($conn, $query1) or die(mysqli_e
rror($conn));
?>
<table class="table table-hover">
<thead>
<tr>
<th>Nama</th>
<th>Tanggal</th>
<th>Jam Berkunjung </th>
<th>Keperluan</th>
</tr>
</thead>
</table>
<hr />
<?php $tampil = mysqli_query($conn, "select * from pen
gunjung where tgl_kunjung='$tanggal'");
$user = mysqli_num_rows($tampil);
?>
<center>
<h4>Jumlah Pengunjung Hari Ini : <?php echo "$user
"; ?> Orang </h4>
</center>
</div>
</section>
</div>
<!--end col-6 -->
<div class="col-md-4">
<section class="panel">
<header class="panel-heading">
<b>Buku Pengunjung</b>
</header>
<div class="panel-body">
<div class="twt-area">
<form class="form-horizontal style-
form" style="margin-top: 20px;" action="insert-
pengunjung.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<div class="form-group">
<label class="col-sm-2 col-sm-2 control-
label">No </label>
<div class="col-sm-10">
<input name="id" type="text" id="id" c
lass="form-
control" placeholder="Tidak perlu di isi" autofocus="on" readonly="readonly" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 col-sm-2 control-
label">Nama</label>
<div class="col-sm-10">
<input name="nama" type="text" id="nam
a" class="form-control" placeholder="Nama Anda" required />
<!--<span class="help-
block">A block of help text that breaks onto a new line and may extend beyond one line
.</span>-->
</div>
</div>
<div class="form-group">
<label class="col-sm-2 col-sm-2 control-
label">Jenis kelamin</label>
<div class="col-sm-6">
<select class="form-
control" name="jk" id="jk">
<option> -- Pilih Salah Satu --
</option>
<option value="L"> Laki -
Laki</option>
<option value="P"> Perempuan</opti
on>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 col-sm-2 control-
label">Usia</label>
<div class="col-sm-6">
<input name="kelas" type="text" id="ke
las" class="form-control" placeholder="Usia Anda" required />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 col-sm-2 control-
label">Perlu</label>
<div class="col-sm-10">
<input name="perlu1" type="text" id="p
erlu1" class="form-control" placeholder="Keperluan" required />
<!--<span class="help-
block">A block of help text that breaks onto a new line and may extend beyond one line
.</span>-->
</div>
</div>
<div class="form-group">
<label class="col-sm-2 col-sm-2 control-
label">Cari?</label>
<div class="col-sm-10">
<input name="cari" type="text" id="car
i" class="form-control" placeholder="Apa yang anda cari.?" required />
<!--<span class="help-
block">A block of help text that breaks onto a new line and may extend beyond one line
.</span>-->
</div>
</div>
<div class="form-group">
<label class="col-sm-2 col-sm-2 control-
label">Saran</label>
<div class="col-sm-10">
<textarea rows="4" name="saran" id="sa
ran" class="form-
control" placeholder="Saran Anda untuk PerpustakaanKU" cols="25"></textarea>
<!--<span class="help-
block">A block of help text that breaks onto a new line and may extend beyond one line
.</span>-->
</div>
</div>
<div class="form-group">
<label class="col-sm-2 col-sm-2 control-
label">Tanggal</label>
<div class="col-sm-10">
<input name="tgl_kunjung" type="text"
class="form-
control" id="tgl_kunjung" value="<?php echo "" . date("Y/m/d") . ""; ?>" readonly="rea
donly" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 col-sm-2 control-
label">Jam</label>
<div class="col-sm-10">
<input name="jam_kunjung" type="text"
class="form-
control" id="jam_kunjung" value="<?php echo "" . date("H:i:s") . "" ?>" readonly="read
only" />
</div>
</div>
<div class="form-group" style="margin-
bottom: 20px;">
<label class="col-sm-2 col-sm-2 control-
label"></label>
<div class="col-sm-8">
<input type="submit" value="Simpan" na
me="simpan" class="btn btn-sm btn-primary" />
<a href="#" class="btn btn-sm btn-
danger">Batal </a>
</div>
</div>
</form>
</div>
</div>
</section>
</div>
</div>
</section>
</table>
<hr />
<?php $tampil1 = mysqli_query($conn, "select * from pengunjung
order by id");
$user1 = mysqli_num_rows($tampil1);
?>
<center>
<h4>Jumlah Total Pengunjung : <?php echo "$user1"; ?> Oran
g </h4>
</center>
</div>
</section>
</div>
</div>
<!-- row end -->
<!-- /.content -->
<div class="footer-main">
Copyright PerpustakaanKU 2021
</div>
</aside><!-- /.right-side -->
<!-- datepicker
<script src="js/plugins/datepicker/bootstrap-
datepicker.js" type="text/javascript"></script>-->
<!-- Bootstrap WYSIHTML5
<script src="js/plugins/bootstrap-wysihtml5/bootstrap3-
wysihtml5.all.min.js" type="text/javascript"></script>-->
<!-- iCheck -->
<script src="js/plugins/iCheck/icheck.min.js" type="text/javascript"></script>
<!-- calendar -->
<script src="js/plugins/fullcalendar/fullcalendar.js" type="text/javascript"></scr
ipt>
<!-- Director dashboard demo (This is only for demo purposes) -->
<script src="js/Director/dashboard.js" type="text/javascript"></script>
$('input[type="checkbox"].flat-grey, input[type="radio"].flat-grey').iCheck({
checkboxClass: 'icheckbox_flat-grey',
radioClass: 'iradio_flat-grey'
});
</script>
<script type="text/javascript">
$(function() {
"use strict";
//BAR CHART
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July
"],
datasets: [{
label: "My First dataset",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: [65, 59, 80, 81, 56, 55, 40]
},
{
label: "My Second dataset",
fillColor: "rgba(151,187,205,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [28, 48, 40, 19, 86, 27, 90]
}
]
};
new Chart(document.getElementById("linechart").getContext("2d")).Line(data
, {
responsive: true,
maintainAspectRatio: false,
});
});
// Chart.defaults.global.responsive = true;
</script>
</body>
</html>
<!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">
<!--
The above 3 meta tags *must* come first in the head; any other head content must come
*after* these tags -->
<meta name="description" content="PerpustakaanKU">
<meta name="perpustakaanku" content="PerpustakaanKU">
<link rel="icon" href="../../favicon.ico">
<title>PerpustakaanKU</title>
</head>
<body background="img/page-background.png">
<div class="container">
<center>
<h5 class="form-signin">Copyright © <a href="#" data-toggle="modal" data-
target="#contact">PerpustakaanKU</a>
</h5>
</center>
</html>
<?php
include "conn.php";
$id = $_POST['id'];
$nama = $_POST['nama'];
$jk = $_POST['jk'];
$kelas = $_POST['kelas'];
$perlu1 = $_POST['perlu1'];
$cari = $_POST['cari'];
$saran = $_POST['saran'];
$tgl_kunjung = $_POST['tgl_kunjung'];
$jam_kunjung = $_POST['jam_kunjung'];
$query = mysqli_query($conn, "INSERT INTO pengunjung (id, nama, jk, kelas, perlu1, car
i, saran, tgl_kunjung, jam_kunjung) VALUES ('$id', '$nama', '$jk', '$kelas', '$perlu1'
, '$cari', '$saran', '$tgl_kunjung', '$jam_kunjung')");
if ($query){
echo "<script>alert('Data Berhasil dimasukan!'); window.location = 'index.php'</sc
ript>";
} else {
echo "<script>alert('Data Gagal dimasukan!'); window.location = 'index.php'</scrip
t>";
}
//}
Dibawah ini merupkan script configurasi database dan lampiran database pembuatan aplikasi
perpustakaan :
<?php
$db_name = "db_perpuspro";
Lampiran database :
--
-- Database: `db_perpuspro`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`user_id`, `username`, `password`, `fullname`, `gambar`) VALUES
(1, 'operator', 'operator', 'Petugas', 'gambar_admin/avatar5.png'),
(2, 'mihrawardana', 'mihrawardana', 'Mihra Wardana', 'gambar_admin/foto.jpg'),
(3, 'admin', 'admin', 'Admin PerpustakaanKU', 'gambar_admin/ssamson.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `data_anggota`
--
--
-- Dumping data for table `data_anggota`
--
-- --------------------------------------------------------
--
-- Table structure for table `data_buku`
--
--
-- Dumping data for table `data_buku`
--
-- --------------------------------------------------------
--
-- Table structure for table `pengunjung`
--
--
-- Dumping data for table `pengunjung`
--
INSERT INTO `pengunjung` (`id`, `nama`, `jk`, `kelas`, `perlu1`, `cari`, `saran`, `tgl
_kunjung`, `jam_kunjung`) VALUES
(10, 'Mihra Wardana', 'P', '19', 'Mencari referen', 'Buku yang berkaitan dengan komput
er', 'Agar menyediakan lebih banyak buku referensi, sehingga kami dapat menemukan refe
rensi sesuai kebutuhan kami', '2021-02-01', '14:35:53'),
(11, 'Wardana', 'P', '21', 'Membaca', 'Novel', 'Sebaiknya jumlah referensi lebih diti
ngkatkan', '2021-02-01', '14:43:30');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`user_id`);
--
-- Indexes for table `data_anggota`
--
ALTER TABLE `data_anggota`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `data_buku`
--
ALTER TABLE `data_buku`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `pengunjung`
--
ALTER TABLE `pengunjung`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `admin`
--
ALTER TABLE `admin`
MODIFY `user_id` int(2) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `data_anggota`
--
ALTER TABLE `data_anggota`
MODIFY `id` int(4) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT for table `data_buku`
--
ALTER TABLE `data_buku`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;
--
-- AUTO_INCREMENT for table `pengunjung`
--
ALTER TABLE `pengunjung`
MODIFY `id` int(8) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
COMMIT;