72 lines
2.5 KiB
PHP
72 lines
2.5 KiB
PHP
<?php
|
|
session_start();
|
|
include('../config.php');
|
|
|
|
// Mengecek apakah ini permintaan AJAX untuk fetch data
|
|
if (isset($_GET['fetch_data'])) {
|
|
header('Content-Type: application/json');
|
|
$query = mysqli_query($conn, "SELECT * FROM profil WHERE id_usaha = 1");
|
|
$profile = mysqli_fetch_assoc($query);
|
|
echo json_encode($profile);
|
|
exit();
|
|
}
|
|
|
|
if (isset($_GET['fetch_produk'])) {
|
|
|
|
$query = "SELECT * FROM produk";
|
|
$result = mysqli_query($conn, $query);
|
|
|
|
$produk = [];
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
$produk[] = [
|
|
'id_produk' => $row['id_produk'],
|
|
'nama_produk' => $row['nama_produk'],
|
|
'harga' => $row['harga_jual'],
|
|
'stok' => $row['stok']
|
|
];
|
|
}
|
|
|
|
header('Content-Type: application/json');
|
|
echo json_encode($produk);
|
|
exit;
|
|
}
|
|
|
|
$base_url = "http://localhost";
|
|
|
|
// Query untuk mendapatkan profil awal
|
|
$query = mysqli_query($conn, "SELECT * FROM profil WHERE id_usaha = 1");
|
|
$profile = mysqli_fetch_assoc($query);
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
|
<title id="page-title"><?php echo $profile['nama_usaha']; ?> - Landing Page</title>
|
|
<meta content="" name="description">
|
|
<meta content="" name="keywords">
|
|
|
|
<!-- Favicons -->
|
|
<link href="../assets/img/favicon.png" rel="icon">
|
|
<link href="../assets/img/apple-touch-icon.png" rel="apple-touch-icon">
|
|
|
|
<!-- Fonts -->
|
|
<link href="https://fonts.googleapis.com" rel="preconnect">
|
|
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900&family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900&display=swap" rel="stylesheet">
|
|
|
|
<!-- Vendor CSS Files -->
|
|
<link href="../assets/vendor/bootstrap/css/bootstrap.min.css?v=<?php echo time(); ?>" rel="stylesheet">
|
|
<link href="../assets/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
|
|
<link href="../assets/vendor/aos/aos.css" rel="stylesheet">
|
|
<link href="../assets/vendor/glightbox/css/glightbox.min.css" rel="stylesheet">
|
|
<link href="../assets/vendor/swiper/swiper-bundle.min.css" rel="stylesheet">
|
|
|
|
<!-- Main CSS File -->
|
|
<link href="../assets/css/main.css?v=<?php echo time(); ?>" rel="stylesheet">
|
|
<script src="../dist/sweetalert2.all.min.js"></script>
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
</head>
|
|
|
|
<body class="index-page">
|