-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 01, 2025 at 02:10 PM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.2.12

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: `sistemkos_db`
--

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

--
-- Table structure for table `admin`
--

CREATE TABLE `admin` (
  `id` int(11) NOT NULL,
  `nama` varchar(100) NOT NULL,
  `email` varchar(150) NOT NULL,
  `password` varchar(255) NOT NULL,
  `status` enum('aktif','nonaktif') NOT NULL DEFAULT 'aktif',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `admin`
--

INSERT INTO `admin` (`id`, `nama`, `email`, `password`, `status`, `created_at`) VALUES
(2, 'Admin', 'admin@admin.com', '$2y$10$wUrYCRXLn/kUJwNtCtyRF.waS50yDrj5w6aoCaQahNCDHVCahXonO', 'aktif', '2025-11-05 13:50:03'),
(3, 'admin1', 'admin1@admin.com', '$2y$10$9iaVnJjS/NU5diogW/PdneLUB0m2V/aOmvoao6WBlkRCpuNuY2R0C', 'aktif', '2025-11-07 05:14:11');

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

--
-- Table structure for table `detail_laporan`
--

CREATE TABLE `detail_laporan` (
  `id_detail_laporan` int(11) NOT NULL,
  `id_laporan` int(11) NOT NULL,
  `id_penghuni` int(11) DEFAULT NULL,
  `keterangan` text NOT NULL,
  `gambar` varchar(255) DEFAULT NULL,
  `status` enum('Diajukan','Diproses','Selesai') DEFAULT 'Diajukan',
  `tanggal_update` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `iklan`
--

CREATE TABLE `iklan` (
  `id_iklan` int(11) NOT NULL,
  `id_admin` int(11) DEFAULT NULL,
  `id_kos` int(11) DEFAULT NULL,
  `judul` varchar(150) NOT NULL,
  `deskripsi` text DEFAULT NULL,
  `gambar` varchar(255) NOT NULL,
  `link` varchar(255) DEFAULT NULL,
  `urutan` int(3) DEFAULT 0,
  `status` enum('Aktif','Nonaktif') DEFAULT 'Aktif',
  `tanggal_dibuat` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `iklan`
--

INSERT INTO `iklan` (`id_iklan`, `id_admin`, `id_kos`, `judul`, `deskripsi`, `gambar`, `link`, `urutan`, `status`, `tanggal_dibuat`) VALUES
(12, 2, 1, 'ewdwedew3', 'dwdewdewd', '08daf918674b032ea8375fee8b016ea4.jpg', 'asasa.comahttps://www.youtube.com/watch?v=B9KFb_fmvV8&list=RDcXDOHqa_QgY&index=4', 1, 'Aktif', '2025-11-06 14:58:30'),
(13, 2, 2, 'dwwqdqw3d', 'dww', '0b29c373df741adcbeec01f7e3e9407c.png', 'yoooo.comahttps://www.youtube.com/watch?v=B9KFb_fmvV8&list=RDcXDOHqa_QgY&index=4', 1, 'Aktif', '2025-11-06 15:17:55');

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

--
-- Table structure for table `kos`
--

CREATE TABLE `kos` (
  `id_kos` int(11) NOT NULL,
  `id_admin` int(11) NOT NULL,
  `nama_kos` varchar(150) NOT NULL,
  `alamat` text DEFAULT NULL,
  `jumlah_kamar` int(11) DEFAULT NULL,
  `deskripsi` text DEFAULT NULL,
  `status` enum('Aktif','Nonaktif') DEFAULT 'Aktif',
  `tanggal_dibuat` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `kos`
--

INSERT INTO `kos` (`id_kos`, `id_admin`, `nama_kos`, `alamat`, `jumlah_kamar`, `deskripsi`, `status`, `tanggal_dibuat`) VALUES
(1, 2, 'larisa', 'jaln capung', 20, 'okee boss', 'Aktif', '2025-11-05 19:58:47'),
(2, 2, 'kontol', 'okee', 23, 'edewfwe', 'Aktif', '2025-11-05 20:00:33'),
(4, 3, 'kos waris', 'odqwodoqwjkd', 12, 'sixjwicjdiw', 'Aktif', '2025-11-07 11:14:38');

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

--
-- Table structure for table `laporan`
--

CREATE TABLE `laporan` (
  `id_laporan` int(11) NOT NULL,
  `id_penghuni` int(11) NOT NULL,
  `id_kos` int(11) DEFAULT NULL,
  `judul` varchar(150) NOT NULL,
  `deskripsi` text NOT NULL,
  `gambar` varchar(255) DEFAULT NULL,
  `status` enum('Diajukan','Diproses','Selesai') DEFAULT 'Diajukan',
  `tanggal_laporan` timestamp NOT NULL DEFAULT current_timestamp(),
  `tanggal_selesai` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `laporan`
--

INSERT INTO `laporan` (`id_laporan`, `id_penghuni`, `id_kos`, `judul`, `deskripsi`, `gambar`, `status`, `tanggal_laporan`, `tanggal_selesai`) VALUES
(1, 1, 1, 'kd3or32o2rjj3', 'efjeifjeif', '13a5475573cd50dd95a50537d07310f5.png', 'Selesai', '2025-11-05 20:14:24', '2025-11-12 21:04:48'),
(2, 2, 2, 'hihh', 'gyjugjgjyhg', 'b49237b1479073043080df0613f31450.jpg', 'Diajukan', '2025-11-05 21:41:40', NULL);

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

--
-- Table structure for table `penghuni`
--

CREATE TABLE `penghuni` (
  `id_penghuni` int(11) NOT NULL,
  `id_kos` int(11) DEFAULT NULL,
  `nama_penghuni` varchar(100) NOT NULL,
  `email` varchar(150) NOT NULL,
  `password` varchar(255) NOT NULL,
  `no_hp` varchar(20) DEFAULT NULL,
  `kamar` varchar(50) DEFAULT NULL,
  `alamat` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `penghuni`
--

INSERT INTO `penghuni` (`id_penghuni`, `id_kos`, `nama_penghuni`, `email`, `password`, `no_hp`, `kamar`, `alamat`, `created_at`) VALUES
(1, 1, 'kiki', 'rizqywahyu59@gmail.com', '$2y$10$P23y1xe1NQBzVrS8zXCsQ.ET6bjZQu7pQRBjBeYSDncUL30D.0dli', '00000000000', '20', 'jdjkdjd', '2025-11-05 14:13:51'),
(2, 2, 'kiki', 'kiki@gmail.com', '$2y$10$HL/mHLA1g0GAOZuPWFoc0OrblH2nI6GdQ/6kxFC0Ky4U76Ev1y93C', '00000000000', '23', 'jogja okeee', '2025-11-05 15:28:01');

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

--
-- Table structure for table `super_admin`
--

CREATE TABLE `super_admin` (
  `id_super_admin` int(11) NOT NULL,
  `nama` varchar(100) NOT NULL,
  `email` varchar(150) NOT NULL,
  `password` varchar(255) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `super_admin`
--

INSERT INTO `super_admin` (`id_super_admin`, `nama`, `email`, `password`, `created_at`) VALUES
(1, 'superr boss', 'superadmin@superadmin.com', '$2y$10$uV5Woi7aLDpjBGHC8OQHVuJH.Glg.e.u6E.4JxenxnOvVVGDvZkmq', '2025-10-31 16:31:17');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `email` (`email`);

--
-- Indexes for table `detail_laporan`
--
ALTER TABLE `detail_laporan`
  ADD PRIMARY KEY (`id_detail_laporan`),
  ADD KEY `fk_detail_laporan_laporan` (`id_laporan`),
  ADD KEY `fk_detail_laporan_penghuni` (`id_penghuni`);

--
-- Indexes for table `iklan`
--
ALTER TABLE `iklan`
  ADD PRIMARY KEY (`id_iklan`),
  ADD KEY `fk_iklan_admin` (`id_admin`),
  ADD KEY `fk_iklan_kos` (`id_kos`);

--
-- Indexes for table `kos`
--
ALTER TABLE `kos`
  ADD PRIMARY KEY (`id_kos`),
  ADD KEY `fk_kos_admin` (`id_admin`);

--
-- Indexes for table `laporan`
--
ALTER TABLE `laporan`
  ADD PRIMARY KEY (`id_laporan`),
  ADD KEY `fk_laporan_penghuni` (`id_penghuni`),
  ADD KEY `fk_laporan_kos` (`id_kos`);

--
-- Indexes for table `penghuni`
--
ALTER TABLE `penghuni`
  ADD PRIMARY KEY (`id_penghuni`),
  ADD UNIQUE KEY `email` (`email`),
  ADD KEY `fk_penghuni_kos` (`id_kos`);

--
-- Indexes for table `super_admin`
--
ALTER TABLE `super_admin`
  ADD PRIMARY KEY (`id_super_admin`),
  ADD UNIQUE KEY `email` (`email`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `admin`
--
ALTER TABLE `admin`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `detail_laporan`
--
ALTER TABLE `detail_laporan`
  MODIFY `id_detail_laporan` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `iklan`
--
ALTER TABLE `iklan`
  MODIFY `id_iklan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT for table `kos`
--
ALTER TABLE `kos`
  MODIFY `id_kos` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `laporan`
--
ALTER TABLE `laporan`
  MODIFY `id_laporan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `penghuni`
--
ALTER TABLE `penghuni`
  MODIFY `id_penghuni` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `super_admin`
--
ALTER TABLE `super_admin`
  MODIFY `id_super_admin` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `detail_laporan`
--
ALTER TABLE `detail_laporan`
  ADD CONSTRAINT `fk_detail_laporan_laporan` FOREIGN KEY (`id_laporan`) REFERENCES `laporan` (`id_laporan`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_detail_laporan_penghuni` FOREIGN KEY (`id_penghuni`) REFERENCES `penghuni` (`id_penghuni`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `iklan`
--
ALTER TABLE `iklan`
  ADD CONSTRAINT `fk_iklan_admin` FOREIGN KEY (`id_admin`) REFERENCES `admin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_iklan_kos` FOREIGN KEY (`id_kos`) REFERENCES `kos` (`id_kos`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `kos`
--
ALTER TABLE `kos`
  ADD CONSTRAINT `fk_kos_admin` FOREIGN KEY (`id_admin`) REFERENCES `admin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `laporan`
--
ALTER TABLE `laporan`
  ADD CONSTRAINT `fk_laporan_kos` FOREIGN KEY (`id_kos`) REFERENCES `kos` (`id_kos`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_laporan_penghuni` FOREIGN KEY (`id_penghuni`) REFERENCES `penghuni` (`id_penghuni`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `penghuni`
--
ALTER TABLE `penghuni`
  ADD CONSTRAINT `fk_penghuni_kos` FOREIGN KEY (`id_kos`) REFERENCES `kos` (`id_kos`) ON DELETE SET NULL ON UPDATE CASCADE;
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 */;
