FoodShare is a full-stack, database-driven web application designed to combat food waste and enhance community support by creating an efficient platform for sharing surplus food. The system manages the entire lifecycle of a donation, from listing and securing requests to volunteer assignment and final delivery confirmation.
This project is built using a classic, robust LAMP-like stack (Linux/Windows, Apache, MySQL, PHP) for simplicity and reliability.
| Category | Technology | Role & Details |
|---|---|---|
| Frontend | HTML, CSS, JavaScript | Provides a modern, responsive user interface. Utilizes custom CSS (style.css) for consistent theming. |
| Backend | PHP | Handles all session management, business logic, and database interaction. Focuses on simple, direct execution. |
| Database | MySQL | Stores user data, food donations, requests, and administrative logs. |
| Server | XAMPP | Provides the necessary local development environment, including Apache (web server) and MySQL (database). |
After hardening the application, the following security and data integrity measures are implemented:
-
SQL Injection Prevention: All critical database operations (Login, Registration, Data Insertion, Updates, Deletions) utilize MySQLi Prepared Statements and parameter binding to treat user input as data, not executable code.
-
Transactional Integrity: The Request Module uses database transactions (
BEGIN TRANSACTION,COMMIT,ROLLBACK) to ensure that quantity subtraction and request insertion either both succeed or both fail, preventing phantom inventory or data corruption. -
Cross-Site Scripting (XSS) Mitigation: All user-supplied data displayed on the dashboard is passed through
htmlspecialchars()for output escaping.
- Roles: Supports Donor, Receiver, Volunteer, and Admin roles, each routed to a dedicated dashboard upon successful login.
- Navigation: Includes Home links on the login/registration pages for easy navigation.
- Control: Donors can Edit or Delete their listed donations, but only if the item status is 'Available' (preventing disruption of active deliveries).
- Feedback/Notifications: Displays "Thank You" notifications for all past donations that have been successfully marked as Delivered.
- Real-Time View: Displays only Available items with remaining quantity.
- Quantity Input: Receivers submit requests using a number input box that validates against the maximum available stock.
- Request Logic: The system uses a transaction to securely subtract the requested quantity from the total stock. If the quantity reaches zero, the item status is set to 'Unavailable'.
- Workflow Tabs: The dashboard is structured into three dedicated views for clear status management: Pending, In Progress, and Delivered.
- Automatic Logging: All Admin actions (Accept, Decline, Assign) are automatically logged into the
admin_logstable.
- Task View: Displays only requests that have been explicitly Assigned to the logged-in volunteer.
-
Status Update: Volunteers manage the delivery progress by updating the status from Assigned
$\rightarrow$ Picked Up$\rightarrow$ Delivered. - Seamless Operation: Uses iframe target fixes to ensure action buttons execute and refresh the main dashboard without nesting.
- Clone or Download this repository.
- Install XAMPP (or equivalent WAMP/MAMP stack).
- Place Files: Move the project folder into your XAMPP's
htdocsdirectory. - Database Setup:
- Open phpMyAdmin (via XAMPP Control Panel).
- Create a new database named
community_food_sharing_login. - Import the provided
community_food_sharing_login.sqlfile.
- Access: Open your browser and navigate to
http://localhost/FoodShare/index.html(assuming "FoodShare" is your project folder name).
- Ashwin Joseph Monteiro