<repo_name>adilfarizki/uprak-php<file_sep>/uprak_php/formedit.php
<?php
session_start();

if (!isset($_SESSION["login"])) {
    header("Location : login.php");
    exit;
}
include 'koneksi.php';
    $id_produk = $_GET['id_produk'];
    $sql    = "SELECT * FROM produk WHERE id_produk='$id_produk'";
    $query  = mysqli_query($connect, $sql);
    $pel = mysqli_fetch_assoc($query);

if ( mysqli_num_rows($query) < 1) {
    die("data tidak ditemukan...");
}

?>
<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="<KEY>" crossorigin="anonymous">

    <link rel="stylesheet" href="edit.css">

    <!-- google font -->
    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">

  

    <title>Hello, world!</title>
  </head>
  <body>
    <!-- navbar -->
  <nav class="navbar navbar-expand-lg navbar-light fixed-top">
        <div class="container-fluid">
            <a class="navbar-brand" href="index.php">Online Shop</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
                aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="nav-link">
                <div><a class="me-4" href="produk.php">Produk</a></div>
            </div>
        </div>
    </nav>

      <!-- form edit  -->

      <form action="edit.php" method="post">
          <div class="form">
      <div class="container fluid">
        <div class="card-body">
          <div class="modal-body">
            <h4 class="card-subtitle mb-4 text-center">Form Edit Barang dan Stock Data Barang</h4>
    
            <div class="form-gorup row">
              <label class="col-sm-3 col-form-label" for="id_produk">Id Produk</label>
              <div class="col-8">
                <input type="text" class="form-control" name="id_produk" value="<?php echo $pel['id_produk']?>">
              </div>
            </div>
    
            <div class="form-gorup row" style="margin-top: 10px;">
              <label class="col-sm-3" for="nama_produk">Nama Produk</label>
              <div class="col-8">
                <input type="text" class="form-control" name="nama_produk" value="<?php echo $pel['nama_produk']?>">
              </div>
            </div>
    
            <div class="form-group row" style="margin-top: 10px;">
              <label class="col-sm-3" for="harga">Harga Produk</label>
              <div class="col-8">
                <input type="text" class="form-control" name="harga" value="<?php echo $pel['harga']?>">
              </div>
            </div>
    
            <div class="form-group row" style="margin-top: 8px;">
              <label class="col-sm-3" for="stok">Stock Produk</label>
              <div class="col-8">
                <input type="text" class="form-control" name="stok" value="<?php echo $pel['stok']?>">
              </div>
            </div>
    
            <div class="form-group row" style="margin-top: 8px;">
              <label class="col-sm-3" for="gambar">Gambar Produk</label>
              <div class="col-8">
                <input type="url" class="form-control" name="gambar" value="<?php echo $pel['gambar']?>">
              </div>
            </div>

            <div class="form-group row" style="margin-top: 8px;">
              <label class="col-sm-3" for="detail">Detail Produk</label>
              <div class="col-8">
                <input type="text" class="form-control" name="detail" value="<?php echo $pel['detail']?>">
              </div>
            </div>
          </div>
    
          <a href="produk.php" class="btn btn-danger">kembali</a>
          <button type="submit" name="simpan" value="simpan" class="btn btn-success">Submit</button>
          <!-- <button type="button" class="btn btn-primary mb-1 col-sm-2 container" onclick="datasimpan()"
            id="simpan2">Simpan</button> -->
        </div>
      </div>
      </div>

    <!-- Option 1: Bootstrap Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" integrity="<KEY>" crossorigin="anonymous"></script>

    <!-- Option 2: Separate Popper and Bootstrap JS -->
    <!--
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.6.0/dist/umd/popper.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
    -->
  </body>
</html>
<file_sep>/uprak_php/produk.php
<?php
session_start();

if (!isset($_SESSION["login"])) {
    header("Location : login.php");
    exit;
}
include 'koneksi.php';
?>
<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="<KEY>" crossorigin="anonymous">
    <link rel="stylesheet" href="data.css">

    <!-- google font -->
    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">

    <title>Hello, world!</title>
  </head>
  <body>

  <!-- navbar -->
  
  <nav class="navbar navbar-expand-lg navbar-light fixed-top">
        <div class="container-fluid">
            <a class="navbar-brand" href="index.php">Online Shop</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
                aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="nav-link">
                <div><a class="me-4" href="produk.php">Produk</a></div>
                <div><a class="me-4" href="cart.php">Cart</a></div>
            </div>
        </div>
    </nav>

    <!-- input -->
    <div class="container mb-5">
        
        <div class="hero">
            <p><span class="ms-2 fw-bold">Data Produk</span></p>
            <a href="tambah_produk.php" class="btn btn-primary ms-3">[+] Tambah Baru</a>
            <a href="index.php" class="btn btn-green ms-3">Kembali</a>
        </div>
        <div class="input ms-3 me-3 mt-3 pb-3">
            <table class="table table-bordered bg-light btn-dark text-dark text-center">
                <tr class="bg-primary table-bordered btn-dark">
                    <td>NO</td>
                    <td>GAMBAR</td>
                    <td>NAMA PRODUK</td>
                    <td>HARGA PRODUK</td>
                    <td>STOCK</td>
                    <td>ACTION</td>
                </tr>
                <?php
            $sql = "SELECT * FROM produk";
            $query = mysqli_query($connect,$sql);

                while($pel = mysqli_fetch_array($query)){
                    echo"<tr>";
                    echo"<td>".$pel['id_produk']."</td>";
                    echo "<td><img src='".$pel['gambar']."'style='width:80px; height:80px;'></td>";
                    echo"<td>".$pel['nama_produk']."</td>";
                    echo"<td>".$pel['harga']."</td>";
                    echo"<td>".$pel['stok']."</td>";

                    echo"<td>";
                    echo "<a class='btn btn-warning' href='formedit.php?id_produk=".$pel['id_produk']."'>Edit</a>  ";
                    echo "<a class='btn btn-danger' href='hapus.php?id_produk=".$pel['id_produk']."'>Hapus</a>";
                    echo"</td>";
                    echo"</tr>";    
                }

        ?>
            </table>
        </div>
    </div>

    <!-- Option 1: Bootstrap Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" integrity="<KEY>U5S9FOnJ0" crossorigin="anonymous"></script>

    <!-- Option 2: Separate Popper and Bootstrap JS -->
    <!--
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.6.0/dist/umd/popper.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
    -->
  </body>
</html><file_sep>/uprak_php/index.php
<?php
session_start();

if (!isset($_SESSION["login"])) {
    header("Location: login.php");
    exit;
}
include 'koneksi.php';
?>
<!doctype html>
<html lang="en">

<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="<KEY>" crossorigin="anonymous">
    <link rel="stylesheet" href="style.css">

    <!-- google font -->
    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">


    <title>Hello, world!</title>
</head>

<body>
    <!-- navbar -->

    <nav class="navbar navbar-expand-lg navbar-light fixed-top">
        <div class="container-fluid">
            <a class="navbar-brand" href="index.php">Online Shop</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
                aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="nav-link">
                <div><a class="me-4" href="index.php">Home</a></div>
                <div><a class="me-4" href="produk.php">Produk</a></div>
                <div><a class="me-4" href="cart.php">Cart</a></div>
                <div><a class="me-4" style="margin-left: 700px;" href="logout.php">Logout</a></div>
            </div>
        </div>
    </nav>

    <!-- hero -->



    <div id="carouselExampleControls" class="carousel slide gambar" data-bs-ride="carousel">
        <div class="carousel-inner">
            <div class="carousel-indicators">
                <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="0" class="active"
                    aria-current="true" aria-label="Slide 1"></button>
                <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="1"
                    aria-label="Slide 2"></button>
                <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="2"
                    aria-label="Slide 3"></button>
            </div>

            <div class="carousel-item active">
                <img src="https://s3.bukalapak.com/uploads/content_attachment/8c074ee410e8d762540a8cb5/w-744/12._Raincoat.jpg"
                    class="d-block w-100" alt="...">
            </div>
            <div class="carousel-item">
                <img src="https://s0.bukalapak.com/uploads/content_attachment/5df4369af5f4585e8bcf5cb5/w-744/14._Jaket_track_top.jpg"
                    class="d-block w-100" alt="...">
            </div>
            <div class="carousel-item">
                <img src="https://asset.kompas.com/crops/OrdUvsozEEjdX3F-YXwNLyuR1fA=/118x63:1288x843/750x500/data/photo/2020/01/29/5e3104a405ae4.jpg"
                    class="d-block w-100" alt="...">
            </div>
        </div>
        <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleControls"
            data-bs-slide="prev">
            <span class="carousel-control-prev-icon" aria-hidden="true"></span>
            <span class="visually-hidden">Previous</span>
        </button>
        <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleControls"
            data-bs-slide="next">
            <span class="carousel-control-next-icon" aria-hidden="true"></span>
            <span class="visually-hidden">Next</span>
        </button>

        <div class="button">
        </div>
        <b>Jaket</b>
        <p>No Windage Hold Off, No Windage Hold Off seri MA-1 dan N3-B</p>

    </div>

    
    <!-- Produk -->
    <div class="pro">
        <h1 class="laris ps-5 p-2">Produk Terlaris</h1>
    </div>
    <div class="produk">

        <?php
            $id = mysqli_query($connect,'SELECT * FROM produk ORDER BY produk.id_produk');
            while ($prdk = mysqli_fetch_array($id)){
            $idp = $prdk['id_produk']; 
        ?>

        <a href="detail.php?id_produk=<?= $prdk["id_produk"]?>">
            <div class="card m-2 me-3" style="width: 18rem;">
                <img src="<?php echo $prdk['gambar'] ?>" class="mt-2 ms-3 mb-2 me-3 gambar_produk" alt="...">
                <div class="card-body float-end">
                    <h5 class="card-title"><?php echo $prdk['nama_produk'] ?></h5>
                    <b>Rp. <?php echo $prdk['harga'] ?></b> <br>
                </div>
            </div>
        </a>
        <?php
            }
        ?>
    </div>

    
    <!-- produk -->

    
    <div class="duk">
        <h1 class="produkkk ps-5 p-2">Product</h1>
    </div>
    <div class="listproduk">

        <?php
            $id = mysqli_query($connect,'SELECT * FROM produk ORDER BY produk.id_produk');
            while ($prdk = mysqli_fetch_array($id)){
            $idp = $prdk['id_produk']; 
        ?>

        <a href="detail.php?id_produk=<?= $prdk["id_produk"]?>">
            <div class="card m-2 me-3 float-start" style="width: 15rem;">
                <img src="<?php echo $prdk['gambar'] ?>"  style="width: 200px; height: 200px !important;" class="mt-2 ms-3 mb-2 me-3 gambar_produk" alt="...">
                <div class="card-body float-end">
                    <h5 class="card-title"><?php echo $prdk['nama_produk'] ?></h5>
                    <b>Rp. <?php echo $prdk['harga'] ?></b> <br>
                </div>
            </div>
        </a>
        <?php
            }
        ?>
    </div>

    <div id="footer">
        <footer>Copyright © 2021 Online Shop.com MAF <NAME>.</footer>
    </div>



    <!-- Option 1: Bootstrap Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js"
        integrity="<KEY>" crossorigin="anonymous">
    </script>

    <!-- Option 2: Separate Popper and Bootstrap JS -->
    <!--
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.6.0/dist/umd/popper.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
    -->
</body>

</html><file_sep>/uprak_php/hapus.php
<?php
include 'koneksi.php';
if (isset($_GET['id_produk'])) {
    header('Location: produk.php');
}
$id_produk = $_GET['id_produk']; 

$sql    = "DELETE FROM produk WHERE id_produk='$id_produk'";
$query  = mysqli_query($connect, $sql);

if ($query){
    echo "<meta http-equiv='refresh' content='1;url=produk.php'>";
}else{
    header('Location: hapus.php?status=gagal');
}

?><file_sep>/uprak_php/aksilogin.php
<?php
session_start();
include 'koneksi.php';
if ( isset($_POST["submit"])) {
    $username = $_POST["username"];
    $password = $_POST["<PASSWORD>"];

    $result = mysqli_query($connect, "SELECT * FROM user WHERE username = '$username'");

    // cek username
    if ( mysqli_num_rows($result) === 1) {
        
    // cek password
    $row = mysqli_fetch_assoc($result);
    if (password_verify($password, $row["password"])) {

        // session
        $_SESSION["login"] = true;

        header("Location: index.php");
        exit;
    }
    }
}

?><file_sep>/uprak_php/koneksi.php
<?php
$host       ="localhost";
$user       ="root";
$password   ="";
$database   ="uprak_2";
$connect    =mysqli_connect($host,$user,$password,$database) or die("Gagal Menghubungkan");
?>
<?php
function registerasi($data) {
    global $connect;

    $username = stripslashes($data["username"]);
    $email = stripslashes($data["email"]);
    $password = mysqli_real_escape_string($connect, $data["password"]);
    $password2 = mysqli_real_escape_string($connect, $data["password2"]);



if( $password !== $password2) {
    echo "<script> alert('konfirmasi password tidak sama') </script>";
    return false;
}



$password = password_hash($password, PASSWORD_DEFAULT);
    
    // cek username 
    $result = mysqli_query($connect,"SELECT username FROM user WHERE username ='$username' ");
    if (mysqli_fetch_assoc($result)) {
        echo "<script> alert('username sudah ada!')</script>";
            return false;
    }
    
    $querry = mysqli_query($connect, "INSERT INTO user VALUES('','$username','$email','$password')");

    return mysqli_affected_rows($connect);
}
?><file_sep>/README.md
# uprak-php
progres_uprak
<file_sep>/uprak_php/detail.php
<?php
include 'koneksi.php';
    $id_produk = $_GET['id_produk'];
    $sql    = "SELECT * FROM produk WHERE id_produk='$id_produk'";
    $query  = mysqli_query($connect, $sql);
    $pel = mysqli_fetch_assoc($query);

if ( mysqli_num_rows($query) < 1) {
    die("data tidak ditemukan...");
}

?>
<!doctype html>
<html lang="en">

<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="<KEY>" crossorigin="anonymous">
    <link rel="stylesheet" href="detail.css">

    <!-- google font -->
    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">

    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700&display=swap" rel="stylesheet">


    <title>Hello, world!</title>
</head>

<body>
    <!-- navbar -->

    <nav class="navbar navbar-expand-lg navbar-light fixed-top">
        <div class="container-fluid">
            <a class="navbar-brand" href="index.php">Online Shop</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
                aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
        </div>
    </nav>

    <!-- Produk -->
    <div class="produk">
        <div class="container">
        <div class="row">
            <div class="col-6">
                <img src="<?php echo $pel['gambar']?>" alt="">
            </div>
            <div class="col-6">
                <p><?php echo $pel['nama_produk']?></p>
                <p>Rp. <?php echo $pel['harga']?></p>

                <p>Stock : <?php echo $pel['stok']?></p>

                <h1>Detail Product</h1>

                <p class="detail">Detail : <?php echo $pel['detail']?></p>


                <button class="btn btn-primary">Buy</button>
            </div>
        </div>
        </div>
    </div>



    <!-- Option 1: Bootstrap Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js"
        integrity="<KEY>" crossorigin="anonymous">
    </script>

    <!-- Option 2: Separate Popper and Bootstrap JS -->
    <!--
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.6.0/dist/umd/popper.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
    -->
</body>

</html><file_sep>/uprak_php/uprak_2.sql
-- phpMyAdmin SQL Dump
-- version 5.0.3
-- https://www.phpmyadmin.net/
--
-- Host: 1192.168.3.11
-- Generation Time: Mar 25, 2021 at 08:30 AM
-- Server version: 10.4.14-MariaDB
-- PHP Version: 7.4.11

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `uprak_2`
--

-- --------------------------------------------------------

--
-- Table structure for table `login`
--

CREATE TABLE `login` (
  `id` int(30) NOT NULL,
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `login`
--

INSERT INTO `login` (`id`, `username`, `password`) VALUES
(1, 'admin', '<PASSWORD>');

-- --------------------------------------------------------

--
-- Table structure for table `produk`
--

CREATE TABLE `produk` (
  `id_produk` int(30) NOT NULL,
  `nama_produk` varchar(255) NOT NULL,
  `harga` int(255) NOT NULL,
  `stok` int(255) NOT NULL,
  `gambar` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `produk`
--

INSERT INTO `produk` (`id_produk`, `nama_produk`, `harga`, `stok`, `gambar`) VALUES
(1, 'd&f Jaket pria Bomber with mustard strip - Navy', 189900, 10, 'https://id-test-11.slatic.net/p/11a306f5f738b8c5d78299614846ddfe.jpg_400x400q90.jpg_.webp'),
(2, 'M.RDJ.JAKET - SANDWASH - JAKET SANDWASH BLACK ', 88000, 10, 'https://id-test-11.slatic.net/p/ab54716cbf50a03d4c26f2732e4f06b3.jpg_400x400q90.jpg_.webp'),
(3, '17SEVEN Jaket Bomber Polos Pria Terpopuler', 149000, 10, 'https://id-test-11.slatic.net/p/a5927313930f44fb5c6eb221fb7abfa0.jpg_400x400q90.jpg_.webp'),
(4, 'JAKET PRIA BAHAN JN IMPORT Mala punye', 126000, 10, 'https://id-test-11.slatic.net/p/836887c2898abaa92b1b9de678c2b19b.jpg_400x400q90.jpg_.webp'),
(5, 'Jaket Jeans Denim Hitam Pekat Pria ukuran M-XXL', 86100, 10, 'https://id-live-01.slatic.net/original/2cb6d776b23edc70a80e04e8b0f5c579.jpg_400x400q90.jpg_.webp');

-- --------------------------------------------------------

--
-- Table structure for table `user`
--

CREATE TABLE `user` (
  `id` int(11) NOT NULL,
  `username` varchar(50) NOT NULL,
  `email` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `user`
--

INSERT INTO `user` (`id`, `username`, `email`, `password`) VALUES
(1, 'adilfarizki', '<EMAIL>', <PASSWORD>'),
(2, 'LarasPradita', '<EMAIL>', <PASSWORD>');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `login`
--
ALTER TABLE `login`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `produk`
--
ALTER TABLE `produk`
  ADD PRIMARY KEY (`id_produk`);

--
-- Indexes for table `user`
--
ALTER TABLE `user`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `login`
--
ALTER TABLE `login`
  MODIFY `id` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `produk`
--
ALTER TABLE `produk`
  MODIFY `id_produk` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
<file_sep>/uprak_php/tambah_produk.php
<?php
include 'koneksi.php';
?>
<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="<KEY>" crossorigin="anonymous">

    <link rel="stylesheet" href="input.css">
  

    <title>Hello, world!</title>
  </head>
  <body>
    
      <!-- nav-bar  -->
      <form action="simpan.php" method="post">
      <div class="card container">
        <div class="card-body">
          <div class="modal-body">
            <h4 class="card-subtitle mb-4 text-center">Input Data Barang/Produk</h4>
    
            <div class="form-gorup row">
              <label class="col-sm-3 col-form-label" for="id_produk">Id Produk</label>
              <div class="col-8">
                <input type="text" class="form-control" name="id_produk">
              </div>
            </div>
    
            <div class="form-gorup row" style="margin-top: 10px;">
              <label class="col-sm-3" for="nama">Nama Produk</label>
              <div class="col-8">
                <input type="text" class="form-control" name="nama_produk">
              </div>
            </div>
    
            <div class="form-group row" style="margin-top: 10px;">
              <label class="col-sm-3" for="harga">Harga Produk</label>
              <div class="col-8">
                <input type="text" class="form-control" name="harga">
              </div>
            </div>
    
            <div class="form-group row" style="margin-top: 8px;">
              <label class="col-sm-3" for="stock">Stock Produk</label>
              <div class="col-8">
                <input type="text" class="form-control" name="stok">
              </div>
            </div>
    
            <div class="form-group row" style="margin-top: 8px;">
              <label class="col-sm-3" for="gambar">Gambar Produk</label>
              <div class="col-8">
                <input type="url" class="form-control" name="gambar">
              </div>
            </div>

            <div class="form-group row" style="margin-top: 8px;">
              <label class="col-sm-3" for="detail">Detail Produk</label>
              <div class="col-8">
                <input type="text" class="form-control" name="detail">
              </div>
            </div>
          </div>
    
          <input type="submit" value="Simpan" name="simpan" class="btn btn-primary">
          <a href="index.php" class="btn btn-success ms-3">Kembali</a>
        </div>
      </div>

    <!-- Option 1: Bootstrap Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" integrity="<KEY>" crossorigin="anonymous"></script>

    <!-- Option 2: Separate Popper and Bootstrap JS -->
    <!--
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.6.0/dist/umd/popper.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
    -->
  </body>
</html><file_sep>/uprak_php/register.php
<?php
include 'koneksi.php';

if (isset($_POST["submit"])) {
    if (registerasi($_POST) > 0) {
        echo "<script> alert('user baru telah ditambahkan')</script>";
    }else{
        echo mysqli_error($connect);
    }
}
?>
<!doctype html>
<html lang="en">

<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="<KEY>" crossorigin="anonymous">

    <link rel="stylesheet" href="login.css">

    <!-- google font -->
    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap" rel="stylesheet">

    <title>Register</title>
</head>

<body>

    <div id="cardd">
        <div id="card-content">
            <div id="card-title">
                <h2>REGISTER</h2>
                <div class="underline-title2"></div>
            </div>
        </div>
    

    <!-- form -->
    <form action="" method="post" class="form">
        <label for="user-name" style="padding-top:-5px; margin-left:20px">&nbsp;Username</label>
        <input id="user-name" class="form-content" type="name" name="username" autocomplete="on" required />
        <div class="form-border"></div>

        <label for="user-email" style="padding-top:13px; margin-left:20px">&nbsp;Email</label>
        <input id="user-email" class="form-content" type="email" name="email" autocomplete="on" required />
        <div class="form-border"></div>

        <label for="user-password" style="padding-top:13px; margin-left:20px">&nbsp;Password</label>
        <input id="user-password" class="form-content" type="<PASSWORD>" name="password" required />
        <div class="form-border"></div>

        <label for="user-password2" style="padding-top:13px; margin-left:20px">&nbsp;Confirm Password</label>
        <input id="user-confirmpassword" class="form-content" type="<PASSWORD>" name="password2" required />
        <div class="form-border"></div>
    
        <input id="submit-btn" type="submit" name="submit" value="REGISTER" />
    </form>
    </div>
    <!-- Option 1: Bootstrap Bundle with Popper -->
    < src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js"
        integrity="<KEY>" crossorigin="anonymous">
    </>

    <!-- Option 2: Separate Popper and Bootstrap JS -->
    <!--
    < src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.1/dist/umd/popper.min.js" integrity="<KEY>" crossorigin="anonymous"></>
    < src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.min.js" integrity="<KEY>" crossorigin="anonymous"></>
    -->
</body>

</html>