Initial commit: Setup Landing Page dan file pertemuan
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
// Tolak akses jika bukan admin
|
||||
if (!isset($_SESSION['role']) || $_SESSION['role'] !== 'admin') {
|
||||
http_response_code(403); // Status Forbidden
|
||||
echo "Akses ditolak! Anda bukan operator.";
|
||||
exit;
|
||||
}
|
||||
include 'koneksi.php';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$nama = $_POST['nama_spbu'];
|
||||
$hp = $_POST['no_hp'];
|
||||
$kategori = $_POST['kategori'];
|
||||
$lat = $_POST['latitude'];
|
||||
$lng = $_POST['longitude'];
|
||||
|
||||
// Perhatikan: id dihilangkan, tanda tanya hanya 5
|
||||
$stmt = $conn->prepare("INSERT INTO spbu_locations (nama_spbu, no_hp, kategori, latitude, longitude) VALUES (?, ?, ?, ?, ?)");
|
||||
|
||||
// Perhatikan: huruf sssdd (5 huruf untuk 5 variabel)
|
||||
$stmt->bind_param("sssdd", $nama, $hp, $kategori, $lat, $lng);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
echo "Data SPBU berhasil disimpan!";
|
||||
} else {
|
||||
echo "Gagal menyimpan data: " . $conn->error;
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
}
|
||||
Reference in New Issue
Block a user