A web based application that allows college students to report campus problems and track their status. Administrators can view submitted reports and update their status to help manage campus issues more efficiently.
- Student registration and login
- Submit campus problem reports
- View personal reports
- Edit and delete personal reports
- Search reports and filter by status
- Pagination for report lists
- Track report status
- Admin login using the shared login page
- View submitted student reports
- View report statistics
- Filter reports by status
- Update report status
- Refresh report data
- Password hashing
- PHP session-based authentication
- Role-based access checks for admin functionality
- Report ownership checks for student updates and deletions
- Server-side validation of report input
- Database queries using PDO prepared statements
- Logout endpoint to destroy the server-side session
| Technology | Purpose |
|---|---|
| React | Frontend UI |
| Vite | Frontend development server |
| JavaScript | Application logic |
| CSS | Styling and responsive layout |
| PHP | Backend API |
| PostgreSQL | Database |
| PDO | Database access |
| Git & GitHub | Version control |
CampusProblemReporter/
├── frontend/
│ └── src/
│ ├── Components/
│ │ ├── Dashboard.jsx
│ │ ├── login.jsx
│ │ ├── register.jsx
│ │ ├── ReportForm.jsx
│ │ ├── ReportList.jsx
│ │ ├── AdminDashboard.jsx
│ │ └── AdminDashboard.css
│ └── Services/
│ └── api.js
│
├── backend/
│ ├── api/
│ │ ├── login.php
│ │ ├── register.php
│ │ ├── logout.php
│ │ ├── createReport.php
│ │ ├── myReports.php
│ │ ├── reports.php
│ │ ├── users.php
│ │ ├── test.php
│ │ ├── updateReport.php
│ │ ├── deleteReport.php
│ │ └── adminUpdateReportStatus.php
│ ├── db.php
│ └── config.php
│
├── README.md
└── LICENSE
Install the following before running the project:
- Node.js
- PostgreSQL
- PHP
- Git (optional, for cloning the repository)
git clone https://github.com/ADITYA-PROGRAMMER5/Campus-Problem-Reporter.git
cd Campus-Problem-ReporterOpen PostgreSQL using pgAdmin or psql and execute:
CREATE DATABASE campus_problem_reporter;Connect to the newly created campus_problem_reporter database before creating the tables.
This table stores student and administrator account information.
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
email VARCHAR(150) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
role VARCHAR(20) NOT NULL DEFAULT 'student',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);This table stores campus problem reports. Each report belongs to a user through the user_id foreign key.
CREATE TABLE reports (
id SERIAL PRIMARY KEY,
user_id INTEGER NOT NULL,
title VARCHAR(200) NOT NULL,
description TEXT NOT NULL,
category VARCHAR(50) NOT NULL,
location VARCHAR(150) NOT NULL,
priority VARCHAR(20) NOT NULL DEFAULT 'medium',
status VARCHAR(30) NOT NULL DEFAULT 'pending',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_report_user
FOREIGN KEY (user_id)
REFERENCES users(id)
);- Primary keys: The
idcolumn uniquely identifies each user and report. - Foreign key:
reports.user_idreferencesusers.id. - Unique email: Each account must use a unique email address.
- Default role: New users receive the
studentrole. - Default priority: New reports use
mediumpriority. - Default status: New reports start with
pendingstatus.
Important: Create the users table before the reports table because the reports table references the users table.
The updated_at column receives its initial timestamp when the report is created. Automatically updating it when a report changes requires additional backend logic or a database trigger.
Configure the PostgreSQL connection in the backend configuration files according to your local environment.
Keep database credentials private. Do not commit passwords or other sensitive configuration to GitHub.
Start the PHP development server from the backend directory:
php -S localhost:8000The backend API base URL is:
http://localhost:8000/api/
Open a separate terminal and run:
cd frontend
npm install
npm run devOpen the local URL displayed by Vite, typically:
http://localhost:5173
Keep both development servers running while using the application.
The following endpoints are available in the backend API.
| Method | Endpoint | Purpose |
|---|---|---|
| POST | register.php |
Register an account |
| POST | login.php |
Authenticate a user |
| POST | logout.php |
End the current session |
| POST | createReport.php |
Create a report |
| GET | myReports.php |
Fetch the logged-in student's reports |
| GET | reports.php |
Fetch reports for the admin dashboard |
| POST | updateReport.php |
Update an owned report |
| POST | deleteReport.php |
Delete an owned report |
| POST | adminUpdateReportStatus.php |
Update report status as an admin |
Protected endpoints require an authenticated PHP session. Access depends on the user's role and, for student report operations, report ownership.
- Pending: The issue is awaiting action.
- In Progress: The issue is being addressed.
- Resolved: The issue has been resolved.
- Never store plain-text passwords.
- Keep database credentials out of public repositories.
- Validate user input on the server.
- Enforce authentication and authorization in backend APIs, not only in React.
- Use HTTPS and secure cookie settings when deploying to production.
- Review and test all API endpoints before deploying publicly.
The goal of this project is to make campus issue reporting more organized, transparent, and manageable by providing a central platform for students and administrators.
BCA Students | Aspiring Full Stack Developer
Built as a learning project to practice React, PHP, PostgreSQL, API development, authentication, and full-stack application design.