Disusun oleh:
Anggota:
Nurhalim Habibie (170212086)
Taufik Hidayat (170212131)
Adfani (170212097)
Dosen pembimbing:
Mira maisura M.Sc
E. FLOWCHART
1. Admin
2. User
F. Rancangan Entitas Relationship Diagram (ERD)
G. PEMBAHASAN DAN PEMBUATAN CODING DATABASE
if (!$conn){
die("Connection failed: ". mysqli_connect_error());
}
echo "";
?>
b. coding index.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Informasi Roti</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="bar">
<a href="index.php" class="home">Website Roti</a>
<a href="login.php" class="login">Login Admin</a>
</div>
<div class="container">
<div class="header">
<h1 class="judul">Selamat Datang</h1>
</div>
<div class="hero"></div>
<table class="table1">
<tr>
<th>No.</th>
<th>Nama</th>
<th>Harga</th>
<th>Stock</th>
<th>Gambar</th>
<th>Detail</th>
</tr>
<?php
error_reporting(0);
include('koneksi.php');
if(isset($_GET['kata_cari'])) {
$kata_cari = $_GET['kata_cari'];
} else {
echo '</tr>';
$no++;
}
}else{
echo '<tr><td colspan="6">Tidak ada
data!</td></tr>';
}
mysqli_close($conn);
?>
</table>
<hr />
<footer class="fot">
<div>© 2021 Website Roti by Nurhalim Habibie, Taufik Hidayat,
Adfani</div>
</footer>
</div>
</body>
</html>
c. Coding login.php
<?php
require_once("koneksi.php");
if(isset($_POST['login'])) {
$userid = trim($_POST ['username']);
$password = trim($_POST ['password']);
if (mysqli_num_rows ($result) != 0) {
header("Location: data.php");
} else {
header("Location: logineror.php?e=2");
exit();
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Informasi Roti</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="bar">
<a href="index.php" class="home">Website Roti</a>
<a href="index.php" class="login">Back</a>
</div>
<div class="container">
<div class="header">
<h1 class="judul">Silahkan Login</h1>
</div>
<center>
<form action="" method="post">
<table border="0" bgcolor="" height="100" width="300"
cellpadding="10">
<tr>
<td>Username</td>
<td>:</td>
<td><input type="text" name="username"
placeholder="Username"/></td>
</tr>
<br><br>
<tr>
<td>Password</td>
<td>:</td>
<td><input type="password" name="password"
placeholder="Password"/></td>
</tr>
<tr>
<td> </td>
<td></td>
<td><input type="submit" name="login"
value="Login" /></td>
</tr>
</table>
</form>
</center>
<br><br><br><br><br><br><br><br><br>
<hr />
<footer class="fot">
<div>© 2021 Website Roti by Nurhalim Habibie, Taufik Hidayat,
Adfani</div>
</footer>
</div>
</body>
</html>
d. coding loginerror.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-
width, initial-scale=1.0">
<title>Error 404 (Not Found)!!!</title>
</head>
<body>
<?php
if(isset($_GET ['e'])) {
$error = $_GET ['e'] ;
if($error == 1){
echo "<p>Login error! Username dan
Password harus di isi!</p>";
}elseif ($error == 2) {
echo "<p>Login error! Silahkan masukkan
Username dan Password dengan benar!</p>";
}
}
?>
</body>
</html>
e. coding data.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-
width, initial-scale=1.0">
<title>Informasi Roti</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="bar">
<a href="index.php" class="home">Website
Roti</a>
<a href="login.php" class="login">Log
Out</a>
</div>
<div class="container">
<div class="header">
<h1 class="judul">Laman
Admin</h1>
</div>
<table class="table1">
<tr>
<th>No.</th>
<th>Nama</th>
<th>Harga</th>
<th>Stock</th>
<th>Gambar</th>
<th>Alamat</th>
<th>Opsi</th>
</tr>
<?php
include('koneksi.php');
<img src="upload/'.$data['gambar'].'"
width="100px" height="100px">
</td>';
echo '<td>'.
$data['alamat'].'</td>';
echo '<td>
<a href="edit.php?id='.$data['id_roti'].'">Edit</a>
|
<a href="hapus.php?id='.$data['id_roti'].'"
onclick="return confirm(\'Apakah Anda Yakin?\')">Hapus</a></td>';
echo '</tr>';
$no++;
}
}else{
echo '<tr><td
colspan="6">Tidak ada data!</td></tr>';
}
mysqli_close($conn);
?>
</table>
<div class="parent">
<button class="tombol">
<a class="tekan"
href="tambah.php">Tambah Data</a>
</button>
</div>
<hr />
<footer class="fot">
<div>© 2021 Website Roti by Nurhalim Habibie, Taufik Hidayat,
Adfani</div>
</footer>
</div>
</body>
</html>
f. coding tambah.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-
width, initial-scale=1.0">
<title>Informasi Roti</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="bar">
<a href="index.php" class="home">Website
Roti</a>
<a href="data.php" class="login">Back</a>
</div>
<div class="container">
<div class="header">
<h1 class="judul">Input Data</h1>
</div>
<center>
<form action="tambahproses.php"
method="post" enctype="multipart/form-data">
<table border="3" bgcolor="" align="center"
height="100" width="300" cellpadding="10">
<tr>
<td>Nama</td>
<td>:</td>
<td><input type="text"
name="nama" size="30" placeholder="nama" required></td>
</tr>
<tr>
<td>Harga</td>
<td>:</td>
<td><input type="text"
name="harga" size="30" placeholder="harga" required></td>
</tr>
<tr>
<td>Stock</td>
<td>:</td>
<td><input type="text"
name="stock" size="30" placeholder="stock" required></td>
</tr>
<tr>
<td>Gambar</td>
<td>:</td>
<td><input type="file"
name="gambar" required></td>
</tr>
<tr>
<td>Alamat</td>
<td>:</td>
<td><input type="text"
name="alamat" size="30" placeholder="alamat" required></td>
</tr>
<tr>
<td> </td>
<td></td>
<td><input type="submit"
name="tambah" value="Tambah">
</tr>
</table>
</form>
</center>
<br><br><br><br><br><br><br>
<hr />
<footer class="fot">
<div>© 2021 Website Roti by Nurhalim Habibie, Taufik Hidayat,
Adfani</div>
</footer>
</div>
</body>
</html>
g. coding tambahproses.php
<?php
if(isset($_POST['tambah'])){
include('koneksi.php');
$nama = $_POST['nama'];
$harga = $_POST['harga'];
$stock = $_POST['stock'];
$nama_file = $_FILES['gambar']['name'];
$source = $_FILES['gambar']
['tmp_name'];
$folder = './upload/';
$alamat = $_POST['alamat'];
move_uploaded_file($source, $folder.
$nama_file);
$input = mysqli_query($conn, "INSERT INTO
tb_roti VALUES(
NULL,
'$nama',
'$harga',
'$stock',
'$nama_file',
'$alamat')");
if($input){
echo"<script> document.location.href
='data.php';</script>";
}else{
}else{
echo '<script>window.history.back()</script>';
}
?>
h. coding edit.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-
width, initial-scale=1.0">
<title>Informasi Roti</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="bar">
<a href="index.php" class="home">Website
Roti</a>
<a href="data.php" class="login">Back</a>
</div>
<?php
include('koneksi.php');
$id = $_GET['id'];
if(mysqli_num_rows($result) == 0){
echo
'<script>window.history.back()</script>';
}else{
$data = mysqli_fetch_assoc($result);
}
?>
<div class="container">
<div class="header">
<h1 class="judul">Edit Data</h1>
</div>
<center>
<form action="editproses.php" method="post"
enctype="multipart/form-data">
<input type="hidden" name="id" value="<?
php echo $id; ?>">
<table border="3" bgcolor="" align="center"
height="100" width="300" cellpadding="10">
<tr>
<td>Nama</td>
<td>:</td>
<td><input type="text"
name="nama" size="30" value="<?php echo $data['nama']; ?>" required>
</td>
</tr>
<tr>
<td>Harga</td>
<td>:</td>
<td><input type="text"
name="harga" size="30" value="<?php echo $data['harga']; ?>" required>
</td>
</tr>
<tr>
<td>Stock</td>
<td>:</td>
<td><input type="text"
name="stock" size="30" value="<?php echo $data['stock']; ?>" required>
</td>
</tr>
<tr>
<td>Gambar</td>
<td>:</td>
<td>
<img src="upload/<?
php echo $data['gambar']; ?>" style="width: 120px;float: left;margin-bottom: 5px;">
<input type="file" name="gambar" />
</td>
</tr>
<tr>
<td>Alamat</td>
<td>:</td>
<td><input type="text"
name="alamat" size="30" value="<?php echo $data['alamat']; ?>" required></td>
</tr>
<tr>
<td> </td>
<td></td>
<td><input type="submit"
name="simpan" value="Simpan">
</tr>
</table>
</form>
</center>
<br><br>
<hr />
<footer class="fot">
<div>© 2021 Website Roti by Nurhalim Habibie, Taufik Hidayat,
Adfani</div>
</footer>
</div>
</body>
</html>
i. coding editproses.php
<?php
if(isset($_POST['simpan'])){
include('koneksi.php');
$id = $_POST['id'];
$nama = $_POST['nama'];
$harga = $_POST['harga'];
$stock = $_POST['stock'];
$nama_file = $_FILES['gambar']['name'];
$source = $_FILES['gambar']
['tmp_name'];
$folder = './upload/';
$alamat = $_POST['alamat'];
move_uploaded_file($source, $folder.
$nama_file);
$update = "UPDATE tb_roti SET nama='$nama',
harga='$harga', stock='$stock', gambar='$nama_file', alamat='$alamat' WHERE
id_roti='$id'";
if(mysqli_query($conn, $update)){
}else{
j. coding hapus.php
<?php
if(isset($_GET['id'])){
include('koneksi.php');
$id = $_GET['id'];
if(mysqli_query($conn, $del)){
}else{
}
}
?>
k. coding ket.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-
width, initial-scale=1.0">
<title>Informasi Roti</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="bar">
<a href="index.php" class="home">Website
Roti</a>
<a href="index.php" class="login">Back</a>
</div>
<?php
include('koneksi.php');
$id = $_GET['id'];
if(mysqli_num_rows($result) == 0){
echo
'<script>window.history.back()</script>';
}else{
$data = mysqli_fetch_assoc($result);
}
?>
<div class="container">
<div class="header">
<h1 class="judul"><?php echo
$data['nama']; ?></h1>
</div>
</body>
</html>
l. coding style.css
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
/*Style*/
body {
font: 16px/28px arial, sans-serif;
background-color: #eaeaea;
color: #333;
}
.container {
width: 1100px;
margin: auto;
background-color: white;
}
.bar {
padding: 5px 20px;
background-color: lightblue;
}
.bar a {
display: inline-block;
text-decoration: none;
color: #333;
padding: 3px;
}
.bar a:hover {
background-color: lightskyblue;
color: white;
}
.bar .login {
float: right;
}
.header {
padding: 20px;
}
.header .judul {
font-size: 40px;
font-weight: bold;
text-align: center;
}
.hero {
height: 300px;
background-image: url(img/hero.jpg);
background-size: cover;
}
.table1 {
font-family: sans-serif;
color: #444;
width: 80%;
border: 1px solid #f2f5f7;
margin: 30px auto;
}
.table1 tr th{
background: #35A9DB;
color: #fff;
font-weight: normal;
}
.table1, th, td {
padding: 8px 20px;
text-align: center;
}
.table1 tr:hover {
background-color: #f5f5f5;
}
.table1 tr:nth-child(even) {
background-color: #f2f2f2;
}
.parent {
display: grid;
place-items: center;
}
.tombol {
display: inline-block;
background: #4285F4;
color: #fff;
width: 150px;
height: 50px;
border-radius: 5px;
border: thin solid #888;
font-size: 16px;
font-weight: normal;
font-family: Roboto, sans-serif;
margin: 2rem 0;
}
.bold {
font-size: 20px;
font-weight: bold;
}
.kal {
font-size: 15px;
font-weight: bold;
}
.tombol .tekan {
text-decoration: none;
color: #333;
}
.cari {
margin: 20px auto;
}
.par {
text-indent: 45px;
margin: 20px;
}
.fot {
margin: 0px 20px;
}
.search {
border-radius: 5px;
border: thin solid;
background: #e0e0e0;
box-shadow: 3px 3px 3px #bcbcbc,
-3px -3px 3px #ffffff;
}
B. Hasil
Berikut adalah hasil dari tampilan website yang telah dibuat.
a. Tampilan utama user
b. Tampilan keterangan