first commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
session_start();
|
||||
$role = isset($_SESSION['role']) ? $_SESSION['role'] : '';
|
||||
if ($role !== 'kemiskinan') { echo "unauthorized"; exit; }
|
||||
|
||||
include "koneksi.php";
|
||||
|
||||
$rumah_id = isset($_POST['rumah_id']) ? intval($_POST['rumah_id']) : 0;
|
||||
$tanggal = isset($_POST['tanggal']) ? $conn->real_escape_string($_POST['tanggal']) : date('Y-m-d');
|
||||
$jenis = isset($_POST['jenis']) ? $conn->real_escape_string($_POST['jenis']) : '';
|
||||
$keterangan = isset($_POST['keterangan']) ? $conn->real_escape_string($_POST['keterangan']) : '';
|
||||
$petugas = isset($_POST['petugas']) ? $conn->real_escape_string($_POST['petugas']) : '';
|
||||
|
||||
if ($rumah_id <= 0) { echo "error|rumah_id kosong"; exit; }
|
||||
|
||||
$sql = "INSERT INTO tb_bantuan_history (rumah_id, tanggal, jenis_bantuan, keterangan, petugas)
|
||||
VALUES ($rumah_id, '$tanggal', '$jenis', '$keterangan', '$petugas')";
|
||||
|
||||
if ($conn->query($sql)) {
|
||||
echo "success|" . $conn->insert_id;
|
||||
} else {
|
||||
echo "error|" . $conn->error;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user