How varun987-a11/disasterlink works
What this project is (type + purpose)
From the README + tree, DisasterLink is a classic LAMP-style web application (Apache/PHP + MySQL) with two primary roles:
• Citizen/User: submit emergency/disaster reports, view resources/locator, possibly fetch report locations.
• Administrator: authenticate, view/manage reports, update report status, export/report oversight.
It’s not microservices; it’s a single web app with multiple PHP endpoints/pages, shared “includes” for config/auth, and a MySQL database backing the workflows.
Public entry points (HTTP endpoints / pages)
These are the “controllers” in a simple PHP app (each is a route/page):
• Root
• index.php, index.html → landing / entry into the system
• User area
• user/submit_report.php → creates new report records
• user/resources.php → resource locator UI (likely reads resources / location data)
• user/get_report_location.php → location lookup endpoint (often used via AJAX)
• user/export_csv.php → exports report data to CSV (may be admin-only logically, but placed in user/)
• user/user_home.php → user dashboard/home
• Admin area
• admin/admin_home.php → admin landing
• admin/dashboard.php → admin dashboard (report listing/metrics)
• admin/view_reports.php → report list/details
• admin/update_status.php → status transition (Pending/In Progress/Resolved)
• admin/delete_report.php → deletion lifecycle
Shared backend modules (“library” / cross-cutting)
• includes/config.php → DB connection + likely constants (DB host/user/pass)
• includes/user_login.php / includes/admin_login.php → auth flows (session creation)
• includes/logout.php → session teardown
• includes/create_admin.php → admin bootstrap/seed tool
Static assets
• assets/style.css → UI styling (front-end layer)
Deployment assumptions
README explicitly references XAMPP → implies:
• Apache serving PHP
• PHP runtime executes the .php endpoints
• MySQL as the persistence layer
submit_report.php → includes/config.php (DB connection)
3. submit_report.php → MySQL reports (INSERT new report with default status = Pending)
Auth/session flow (should be explicit
• Admin Browser → includes/admin_login.php → DB (admins) for credential check → sets PHP session
• User Browser → includes/user_login.php (if used) → session
• Both roles → includes/logout.php to clear session
Resource locator / location lookup flow
• User Browser → user/resources.php (page)
• resources.php may call (or the browser may AJAX-call):
• user/get_report_location.php → DB (SELECT locations) → returns JSON/HTML fragment
CSV export flow
• Browser → user/export_csv.php → DB (SELECT reports) → outputs text/csv download
Notable architectural patterns/design principles present
• Role separation by directory: /admin vs /user (good to reflect as two logical subsystems)
• Shared includes for cross-cutting concerns (config/auth/logout)
• Page-per-action pattern typical of PHP apps (each endpoint handles request + DB + response)
• DB connectivity → includes/config.php
• Admin auth → includes/admin_login.php
• User auth → includes/user_login.php
• Report submission → user/submit_report.php
• Report review → admin/view_reports.php
• Status update → admin/update_status.php
• CSV export → user/export_csv.php
If anything is unclear (e.g., whether resources are stored in DB or hardcoded), reflect that honestly with:
• a note (“Resource data source: unknown—verify in resources.php”)
What “best and most accurate” looks like for this repo
• two role-based entry surfaces (User vs Admin)
• PHP endpoints as first-class components (because they *are* the units of behavior here)
• includes/config/auth as shared dependencies
• MySQL tables and the report-status lifecycle
• data flows (submit → store → manage → update → export) end-to-end