first commit
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
session_start();
|
||||
$role = isset($_SESSION['role']) ? $_SESSION['role'] : '';
|
||||
if ($role !== 'infrastruktur') { echo "unauthorized"; exit; }
|
||||
|
||||
include "koneksi.php";
|
||||
|
||||
$id = intval($_GET['id']);
|
||||
$conn->query("DELETE FROM tb_jalan WHERE id='$id'");
|
||||
?>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
session_start();
|
||||
$role = isset($_SESSION['role']) ? $_SESSION['role'] : '';
|
||||
if ($role !== 'infrastruktur') { echo "unauthorized"; exit; }
|
||||
|
||||
include "koneksi.php";
|
||||
$id = intval($_GET['id']);
|
||||
$conn->query("DELETE FROM tb_kavling WHERE id='$id'");
|
||||
?>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
session_start();
|
||||
$role = isset($_SESSION['role']) ? $_SESSION['role'] : '';
|
||||
if ($role !== 'infrastruktur') { echo "unauthorized"; exit; }
|
||||
|
||||
include "koneksi.php";
|
||||
|
||||
$id = intval($_GET['id']);
|
||||
$conn->query("DELETE FROM tb_spbu WHERE id='$id'");
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
$host = "localhost";
|
||||
$user = "root";
|
||||
$pass = "";
|
||||
$dbname = "db_infrastruktur";
|
||||
|
||||
// Auto-create database if not exists
|
||||
$conn = new mysqli($host, $user, $pass);
|
||||
if ($conn->connect_error) {
|
||||
die(json_encode(['error' => 'Koneksi MySQL gagal: ' . $conn->connect_error]));
|
||||
}
|
||||
|
||||
// Create database if not exist
|
||||
$conn->query("CREATE DATABASE IF NOT EXISTS `$dbname`");
|
||||
$conn->select_db($dbname);
|
||||
|
||||
// Auto-create tables if not exist
|
||||
$conn->query("CREATE TABLE IF NOT EXISTS tb_admin (
|
||||
id INT(11) AUTO_INCREMENT PRIMARY KEY,
|
||||
username VARCHAR(50) NOT NULL UNIQUE,
|
||||
password VARCHAR(255) NOT NULL,
|
||||
role VARCHAR(50) NOT NULL DEFAULT 'infrastruktur'
|
||||
)");
|
||||
|
||||
$conn->query("CREATE TABLE IF NOT EXISTS tb_spbu (
|
||||
id INT(11) AUTO_INCREMENT PRIMARY KEY,
|
||||
nama_spbu VARCHAR(150) NOT NULL,
|
||||
no_wa VARCHAR(20) DEFAULT NULL,
|
||||
buka_24jam ENUM('Ya','Tidak') DEFAULT 'Tidak',
|
||||
latitude DECIMAL(11,8) NOT NULL,
|
||||
longitude DECIMAL(11,8) NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
)");
|
||||
|
||||
$conn->query("CREATE TABLE IF NOT EXISTS tb_jalan (
|
||||
id INT(11) AUTO_INCREMENT PRIMARY KEY,
|
||||
nama_jalan VARCHAR(200) NOT NULL,
|
||||
status_jalan ENUM('Nasional','Provinsi','Kabupaten') NOT NULL,
|
||||
panjang_jalan VARCHAR(50) DEFAULT NULL,
|
||||
geojson LONGTEXT NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
)");
|
||||
|
||||
$conn->query("CREATE TABLE IF NOT EXISTS tb_kavling (
|
||||
id INT(11) AUTO_INCREMENT PRIMARY KEY,
|
||||
nama_kavling VARCHAR(200) NOT NULL,
|
||||
status_kepemilikan ENUM('SHM','HGB','HGU','HP') NOT NULL,
|
||||
luas_tanah VARCHAR(50) DEFAULT NULL,
|
||||
geojson LONGTEXT NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
)");
|
||||
|
||||
// Insert default admin if not exist
|
||||
$check = $conn->query("SELECT id FROM tb_admin WHERE username='admin'");
|
||||
if ($check && $check->num_rows == 0) {
|
||||
$pw = password_hash("password", PASSWORD_DEFAULT);
|
||||
$conn->query("INSERT INTO tb_admin (username, password, role) VALUES ('admin', '$pw', 'infrastruktur')");
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
include "koneksi.php";
|
||||
|
||||
$data = [];
|
||||
$q = $conn->query("SELECT * FROM tb_jalan");
|
||||
|
||||
while($row = $q->fetch_assoc()){
|
||||
$data[] = $row;
|
||||
}
|
||||
|
||||
echo json_encode($data);
|
||||
?>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
include "koneksi.php";
|
||||
|
||||
$data = [];
|
||||
$q = $conn->query("SELECT * FROM tb_kavling");
|
||||
|
||||
while($row = $q->fetch_assoc()){
|
||||
$data[] = $row;
|
||||
}
|
||||
|
||||
echo json_encode($data);
|
||||
?>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
include "koneksi.php";
|
||||
|
||||
$data = [];
|
||||
$q = $conn->query("SELECT * FROM tb_spbu");
|
||||
|
||||
while($row = $q->fetch_assoc()){
|
||||
$data[] = $row;
|
||||
}
|
||||
|
||||
echo json_encode($data);
|
||||
?>
|
||||
@@ -0,0 +1,310 @@
|
||||
<?php
|
||||
session_start();
|
||||
if(isset($_SESSION['username'])){
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include "koneksi.php";
|
||||
|
||||
$error = false;
|
||||
if($_SERVER['REQUEST_METHOD'] == 'POST'){
|
||||
$username = $conn->real_escape_string($_POST['username']);
|
||||
$password = $_POST['password'];
|
||||
|
||||
$sql = "SELECT * FROM tb_admin WHERE username='$username'";
|
||||
$result = $conn->query($sql);
|
||||
|
||||
if($result && $result->num_rows > 0){
|
||||
$row = $result->fetch_assoc();
|
||||
if(password_verify($password, $row['password'])){
|
||||
$_SESSION['username'] = $username;
|
||||
$_SESSION['role'] = $row['role'];
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
} else {
|
||||
$error = true;
|
||||
}
|
||||
} else {
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Login — WebGIS Infrastruktur</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
:root {
|
||||
--primary: #ea580c;
|
||||
--primary-hover: #c2410c;
|
||||
--primary-light: #fff7ed;
|
||||
--radius: 14px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Plus Jakarta Sans', sans-serif;
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(135deg, #1c1917 0%, #292524 40%, #1a1207 100%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Decorative background blobs */
|
||||
body::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -200px;
|
||||
right: -200px;
|
||||
width: 600px;
|
||||
height: 600px;
|
||||
background: radial-gradient(circle, rgba(234,88,12,0.15) 0%, transparent 70%);
|
||||
border-radius: 50%;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
body::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -200px;
|
||||
left: -200px;
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
background: radial-gradient(circle, rgba(234,88,12,0.1) 0%, transparent 70%);
|
||||
border-radius: 50%;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.login-wrapper {
|
||||
width: 100%;
|
||||
max-width: 420px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* Brand header */
|
||||
.brand-header {
|
||||
text-align: center;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.brand-icon {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
background: linear-gradient(135deg, #ea580c, #f97316);
|
||||
border-radius: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 32px;
|
||||
margin: 0 auto 16px;
|
||||
box-shadow: 0 8px 32px rgba(234,88,12,0.4);
|
||||
}
|
||||
|
||||
.brand-title {
|
||||
font-size: 24px;
|
||||
font-weight: 800;
|
||||
color: #fff;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.brand-sub {
|
||||
font-size: 13px;
|
||||
color: rgba(255,255,255,0.5);
|
||||
}
|
||||
|
||||
/* Card */
|
||||
.login-card {
|
||||
background: rgba(255,255,255,0.05);
|
||||
backdrop-filter: blur(20px);
|
||||
border: 1px solid rgba(255,255,255,0.1);
|
||||
border-radius: var(--radius);
|
||||
padding: 32px;
|
||||
box-shadow: 0 20px 60px rgba(0,0,0,0.5);
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.card-sub {
|
||||
font-size: 13px;
|
||||
color: rgba(255,255,255,0.5);
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
/* Error */
|
||||
.error-box {
|
||||
background: rgba(239,68,68,0.15);
|
||||
border: 1px solid rgba(239,68,68,0.3);
|
||||
border-radius: 8px;
|
||||
padding: 12px 14px;
|
||||
margin-bottom: 18px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
color: #fca5a5;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Form */
|
||||
.form-group {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: rgba(255,255,255,0.7);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
input[type="text"], input[type="password"] {
|
||||
width: 100%;
|
||||
background: rgba(255,255,255,0.07);
|
||||
border: 1px solid rgba(255,255,255,0.12);
|
||||
border-radius: 8px;
|
||||
padding: 12px 14px;
|
||||
font-size: 14px;
|
||||
font-family: 'Plus Jakarta Sans', sans-serif;
|
||||
color: #fff;
|
||||
outline: none;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
input[type="text"]:focus, input[type="password"]:focus {
|
||||
border-color: var(--primary);
|
||||
background: rgba(234,88,12,0.08);
|
||||
box-shadow: 0 0 0 3px rgba(234,88,12,0.2);
|
||||
}
|
||||
|
||||
input::placeholder { color: rgba(255,255,255,0.3); }
|
||||
|
||||
.btn-login {
|
||||
width: 100%;
|
||||
padding: 14px;
|
||||
background: linear-gradient(135deg, #ea580c, #f97316);
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
font-family: 'Plus Jakarta Sans', sans-serif;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
margin-top: 8px;
|
||||
transition: all 0.2s;
|
||||
box-shadow: 0 4px 20px rgba(234,88,12,0.4);
|
||||
}
|
||||
|
||||
.btn-login:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 6px 28px rgba(234,88,12,0.55);
|
||||
}
|
||||
|
||||
.btn-login:active { transform: translateY(0); }
|
||||
|
||||
/* Info chips at bottom */
|
||||
.info-chips {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-top: 20px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.chip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 5px;
|
||||
flex: 1;
|
||||
background: rgba(255,255,255,0.06);
|
||||
border: 1px solid rgba(255,255,255,0.1);
|
||||
border-radius: 20px;
|
||||
padding: 5px 10px;
|
||||
font-size: 11px;
|
||||
color: rgba(255,255,255,0.5);
|
||||
}
|
||||
|
||||
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: #f97316; }
|
||||
|
||||
/* Footer */
|
||||
.footer-link {
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
font-size: 12.5px;
|
||||
color: rgba(255,255,255,0.35);
|
||||
}
|
||||
|
||||
.footer-link a {
|
||||
color: rgba(234,88,12,0.8);
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
transition: color 0.15s;
|
||||
}
|
||||
|
||||
.footer-link a:hover { color: #f97316; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="login-wrapper">
|
||||
<div class="brand-header">
|
||||
<div class="brand-icon">🏗️</div>
|
||||
<div class="brand-title">WebGIS Infrastruktur</div>
|
||||
<div class="brand-sub">Sistem Informasi Geografis — SPBU, Jalan & Kavling</div>
|
||||
</div>
|
||||
|
||||
<div class="login-card">
|
||||
<div class="card-title">Masuk ke Sistem</div>
|
||||
<div class="card-sub">Gunakan akun Admin Infrastruktur untuk mengakses peta</div>
|
||||
|
||||
<?php if($error): ?>
|
||||
<div class="error-box">
|
||||
⚠️ Username atau password salah. Silakan coba lagi.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="POST" action="login.php">
|
||||
<div class="form-group">
|
||||
<label>Username</label>
|
||||
<input type="text" name="username" placeholder="Masukkan username" required autofocus>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Password</label>
|
||||
<input type="password" name="password" placeholder="Masukkan password" required>
|
||||
</div>
|
||||
<button type="submit" class="btn-login">🔑 Masuk ke Sistem Infrastruktur</button>
|
||||
</form>
|
||||
|
||||
<div class="info-chips">
|
||||
<div class="chip"><span class="dot"></span> SPBU</div>
|
||||
<div class="chip"><span class="dot"></span> Jalan</div>
|
||||
<div class="chip"><span class="dot"></span> Kavling</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer-link">
|
||||
<a href="index.php">← Kembali ke Peta Infrastruktur</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
session_start();
|
||||
session_destroy();
|
||||
header("Location: index.php");
|
||||
exit();
|
||||
?>
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
$host = "localhost";
|
||||
$user = "root";
|
||||
$pass = "";
|
||||
|
||||
// Koneksi tanpa DB dulu untuk buat DB jika belum ada
|
||||
$conn = new mysqli($host, $user, $pass);
|
||||
if ($conn->connect_error) {
|
||||
die("Koneksi gagal: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// 1. Buat Database
|
||||
$sql_db = "CREATE DATABASE IF NOT EXISTS db_infrastruktur";
|
||||
if ($conn->query($sql_db) === TRUE) {
|
||||
echo "Database db_infrastruktur siap.<br>";
|
||||
} else {
|
||||
echo "Error membuat database: " . $conn->error . "<br>";
|
||||
}
|
||||
|
||||
// Gunakan database tersebut
|
||||
$conn->select_db("db_infrastruktur");
|
||||
|
||||
// 2. Buat Tabel tb_admin
|
||||
$sql_admin = "CREATE TABLE IF NOT EXISTS tb_admin (
|
||||
id INT(11) AUTO_INCREMENT PRIMARY KEY,
|
||||
username VARCHAR(50) NOT NULL UNIQUE,
|
||||
password VARCHAR(255) NOT NULL,
|
||||
role VARCHAR(50) NOT NULL DEFAULT 'infrastruktur'
|
||||
)";
|
||||
if ($conn->query($sql_admin) === TRUE) {
|
||||
echo "Tabel tb_admin siap.<br>";
|
||||
} else {
|
||||
echo "Error membuat tb_admin: " . $conn->error . "<br>";
|
||||
}
|
||||
|
||||
// Insert admin infrastruktur if not exist
|
||||
$check_admin = $conn->query("SELECT id FROM tb_admin WHERE username='admin'");
|
||||
if ($check_admin->num_rows == 0) {
|
||||
// Password "password"
|
||||
$pw = password_hash("password", PASSWORD_DEFAULT);
|
||||
$conn->query("INSERT INTO tb_admin (username, password, role) VALUES ('admin', '$pw', 'infrastruktur')");
|
||||
echo "Akun 'admin' ditambahkan.<br>";
|
||||
}
|
||||
|
||||
// 3. Buat Tabel tb_spbu
|
||||
$sql_spbu = "CREATE TABLE IF NOT EXISTS tb_spbu (
|
||||
id INT(11) AUTO_INCREMENT PRIMARY KEY,
|
||||
nama_spbu VARCHAR(150) NOT NULL,
|
||||
no_wa VARCHAR(20) DEFAULT NULL,
|
||||
buka_24jam ENUM('Ya','Tidak') DEFAULT 'Tidak',
|
||||
latitude DECIMAL(11,8) NOT NULL,
|
||||
longitude DECIMAL(11,8) NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
)";
|
||||
if ($conn->query($sql_spbu) === TRUE) {
|
||||
echo "Tabel tb_spbu siap.<br>";
|
||||
} else {
|
||||
echo "Error membuat tb_spbu: " . $conn->error . "<br>";
|
||||
}
|
||||
|
||||
// 4. Buat Tabel tb_jalan
|
||||
$sql_jalan = "CREATE TABLE IF NOT EXISTS tb_jalan (
|
||||
id INT(11) AUTO_INCREMENT PRIMARY KEY,
|
||||
nama_jalan VARCHAR(200) NOT NULL,
|
||||
status_jalan ENUM('Nasional','Provinsi','Kabupaten') NOT NULL,
|
||||
panjang_jalan VARCHAR(50) DEFAULT NULL,
|
||||
geojson LONGTEXT NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
)";
|
||||
if ($conn->query($sql_jalan) === TRUE) {
|
||||
echo "Tabel tb_jalan siap.<br>";
|
||||
} else {
|
||||
echo "Error membuat tb_jalan: " . $conn->error . "<br>";
|
||||
}
|
||||
|
||||
// 5. Buat Tabel tb_kavling
|
||||
$sql_kavling = "CREATE TABLE IF NOT EXISTS tb_kavling (
|
||||
id INT(11) AUTO_INCREMENT PRIMARY KEY,
|
||||
nama_kavling VARCHAR(200) NOT NULL,
|
||||
status_kepemilikan ENUM('SHM','HGB','HGU','HP') NOT NULL,
|
||||
luas_tanah VARCHAR(50) DEFAULT NULL,
|
||||
geojson LONGTEXT NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
)";
|
||||
if ($conn->query($sql_kavling) === TRUE) {
|
||||
echo "Tabel tb_kavling siap.<br>";
|
||||
} else {
|
||||
echo "Error membuat tb_kavling: " . $conn->error . "<br>";
|
||||
}
|
||||
|
||||
echo "<br><h3>Migrasi Selesai!</h3>";
|
||||
echo "<a href='index.php'>Kembali ke Halaman Utama</a>";
|
||||
?>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
session_start();
|
||||
$role = isset($_SESSION['role']) ? $_SESSION['role'] : '';
|
||||
if ($role !== 'infrastruktur') { echo "unauthorized"; exit; }
|
||||
|
||||
include "koneksi.php";
|
||||
|
||||
$nama = $conn->real_escape_string($_POST['nama']);
|
||||
$status = $conn->real_escape_string($_POST['status']);
|
||||
$panjang = $conn->real_escape_string($_POST['panjang']);
|
||||
$geojson = $conn->real_escape_string($_POST['geojson']);
|
||||
|
||||
$sql = "INSERT INTO tb_jalan (nama_jalan,status_jalan,panjang_jalan,geojson)
|
||||
VALUES ('$nama','$status','$panjang','$geojson')";
|
||||
|
||||
if($conn->query($sql)){
|
||||
echo "success|".$conn->insert_id;
|
||||
}else{
|
||||
echo "error";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
session_start();
|
||||
$role = isset($_SESSION['role']) ? $_SESSION['role'] : '';
|
||||
if ($role !== 'infrastruktur') { echo "unauthorized"; exit; }
|
||||
|
||||
include "koneksi.php";
|
||||
|
||||
$nama = $conn->real_escape_string($_POST['nama']);
|
||||
$status = $conn->real_escape_string($_POST['status']);
|
||||
$luas = $conn->real_escape_string($_POST['luas']);
|
||||
$geojson = $conn->real_escape_string($_POST['geojson']);
|
||||
|
||||
$sql = "INSERT INTO tb_kavling (nama_kavling,status_kepemilikan,luas_tanah,geojson)
|
||||
VALUES ('$nama','$status','$luas','$geojson')";
|
||||
|
||||
if($conn->query($sql)){
|
||||
echo "success|".$conn->insert_id;
|
||||
}else{
|
||||
echo "error";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
session_start();
|
||||
$role = isset($_SESSION['role']) ? $_SESSION['role'] : '';
|
||||
if ($role !== 'infrastruktur') { echo "unauthorized"; exit; }
|
||||
|
||||
include "koneksi.php";
|
||||
|
||||
$nama = $conn->real_escape_string($_POST['nama']);
|
||||
$wa = $conn->real_escape_string($_POST['wa']);
|
||||
$buka = $conn->real_escape_string($_POST['buka']);
|
||||
$lat = doubleval($_POST['lat']);
|
||||
$lng = doubleval($_POST['lng']);
|
||||
|
||||
$sql = "INSERT INTO tb_spbu (nama_spbu,no_wa,buka_24jam,latitude,longitude)
|
||||
VALUES ('$nama','$wa','$buka','$lat','$lng')";
|
||||
|
||||
if($conn->query($sql)){
|
||||
echo "success|".$conn->insert_id;
|
||||
}else{
|
||||
echo "error";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
session_start();
|
||||
$role = isset($_SESSION['role']) ? $_SESSION['role'] : '';
|
||||
if ($role !== 'infrastruktur') { echo "unauthorized"; exit; }
|
||||
|
||||
include "koneksi.php";
|
||||
|
||||
$id = intval($_POST['id']);
|
||||
$nama = $conn->real_escape_string($_POST['nama']);
|
||||
$status = $conn->real_escape_string($_POST['status']);
|
||||
$panjang = $conn->real_escape_string($_POST['panjang']);
|
||||
$geojson = $conn->real_escape_string($_POST['geojson']);
|
||||
|
||||
$sql = "UPDATE tb_jalan SET
|
||||
nama_jalan = '$nama',
|
||||
status_jalan = '$status',
|
||||
panjang_jalan = '$panjang',
|
||||
geojson = '$geojson'
|
||||
WHERE id = '$id'";
|
||||
|
||||
if($conn->query($sql)){
|
||||
echo "success";
|
||||
}else{
|
||||
echo "error";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
session_start();
|
||||
$role = isset($_SESSION['role']) ? $_SESSION['role'] : '';
|
||||
if ($role !== 'infrastruktur') { echo "unauthorized"; exit; }
|
||||
|
||||
include "koneksi.php";
|
||||
|
||||
$id = intval($_POST['id']);
|
||||
$nama = $conn->real_escape_string($_POST['nama']);
|
||||
$status = $conn->real_escape_string($_POST['status']);
|
||||
$luas = $conn->real_escape_string($_POST['luas']);
|
||||
$geojson = $conn->real_escape_string($_POST['geojson']);
|
||||
|
||||
$sql = "UPDATE tb_kavling SET
|
||||
nama_kavling = '$nama',
|
||||
status_kepemilikan = '$status',
|
||||
luas_tanah = '$luas',
|
||||
geojson = '$geojson'
|
||||
WHERE id = '$id'";
|
||||
|
||||
if($conn->query($sql)){
|
||||
echo "success";
|
||||
}else{
|
||||
echo "error";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
session_start();
|
||||
$role = isset($_SESSION['role']) ? $_SESSION['role'] : '';
|
||||
if ($role !== 'infrastruktur') { echo "unauthorized"; exit; }
|
||||
|
||||
include "koneksi.php";
|
||||
|
||||
$id = intval($_POST['id']);
|
||||
$lat = doubleval($_POST['lat']);
|
||||
$lng = doubleval($_POST['lng']);
|
||||
|
||||
$conn->query("UPDATE tb_spbu SET latitude='$lat', longitude='$lng' WHERE id='$id'");
|
||||
?>
|
||||
Reference in New Issue
Block a user