The Civic Eye Website is the official frontend for Civic Eye, an AI-powered helmet violation detection system. This server-side edition offers authentication, app downloads, team bios, contact features, and detection result storage — all connected to a backend powered by PHP and MySQL.
- Introduction
- Features
- Technologies Used
- Installation
- Configuration
- Database Setup
- How Login System Works
- Insert Admin to Database
- API Endpoints
- User Dashboard
- Admin Panel
- Usage
- Session Handling
- Contributing
- License
- Notes
The Civic Eye Web Interface acts as the central hub to manage authentication, display detection results, and interact with users via contact forms. Detection happens locally; this server interface focuses purely on session management, UI rendering, and MySQL data handling.
- Responsive multi-page frontend:
- Home
- Download
- Team
- Contact Us
- Login/Register
- Clean authentication system (login + register with session)
- Admin panel (
user_page.php) for contact form logs and detection moderation - Detection upload API with image saving and metadata logging
- Beautiful dark mode with glassmorphism
- GitHub download integration
- Animated backgrounds (Particles.js, AOS)
- Custom-styled with
login.css&style.css
| Layer | Tech |
|---|---|
| Frontend | HTML5, CSS3, JavaScript |
| Backend | PHP (session, form handling) |
| Database | MySQL (auth, contact, detects) |
| Styling | login.css, style.css |
| JS Libraries | AOS, Particles.js, Lucide |
- PHP 7.4+ server (XAMPP, MAMP, WAMP)
- MySQL Server
- Git (optional for clone)
git clone https://github.com/SHADOW2669/CivicEye-Website-Server.git
mv CivicEye-Website-Server /path/to/htdocs/Then open:
http://localhost/CivicEye-Website-Server/index.php
$host = "localhost";
$username = "root";
$password = "";
$database = "civiceye";Update based on your DB server credentials.
CREATE DATABASE civiceye;CREATE TABLE users (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100) UNIQUE,
password VARCHAR(255),
role VARCHAR(50) DEFAULT 'user'
);CREATE TABLE contacts (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100),
message TEXT,
submitted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);CREATE TABLE detections (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
user_id INT UNSIGNED NOT NULL,
timestamp DATETIME NOT NULL,
frame_number INT NOT NULL,
helmet_status VARCHAR(20) NOT NULL,
status ENUM('pending', 'approved', 'rejected') DEFAULT 'pending',
image LONGBLOB,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);The login system is built using PHP sessions. When a user logs in via login.php:
- PHP checks the email and password against the
userstable. - If valid, a
$_SESSIONis created storinguser_idandrole. - The session persists across pages until logout or browser close.
- User: Can view personal detections via
user_page.php. - Admin: Can view all detections, approve/reject entries, and see all contact messages.
To insert an admin manually:
- Generate a hashed password using PHP:
<?php echo password_hash("yourpassword", PASSWORD_DEFAULT); ?>- Insert the user:
INSERT INTO users (name, email, password, role)
VALUES ('Admin', 'admin@example.com', 'HASHED_PASSWORD_HERE', 'admin');Method: POST
Content-Type: application/json
Request Body:
{
"email": "user@example.com",
"password": "password123"
}Response:
{
"status": "success",
"user": {
"id": 1,
"name": "User",
"role": "user"
}
}Method: POST
Form Data:
timestampframehelmetuser_idimage(binary file)
Response:
{ "status": "success" }After login, users are redirected to user_page.php which displays:
- Personal information (name, email)
- Uploaded detection records (filtered by their
user_id) - Logout option
All views are session-restricted using $_SESSION['role'] === 'user'
Admins logging in via login.php and accessing user_page.php see:
- All detection entries from all users
- Approve / Reject buttons for each detection
- Contact form message log
- Enhanced view based on
$_SESSION['role'] === 'admin'
Navigate through:
index.php→ Homepagedownload.php→ GitHub & OS setupteam.php→ Team memberscontact-us.php→ Form → stored in MySQLlogin.php→ Login/Register formuser_page.php→ User/Admin dashboard
- Login creates
$_SESSION['user_id']and$_SESSION['role'] - Session is destroyed on logout or browser close
- Access to user/admin views is protected by session roles
We welcome all contributions that help improve the Civic Eye Website!
If you have suggestions, bug fixes, design improvements, or feature additions, feel free to fork the repository and submit a pull request.
- Found an issue? Open a GitHub Issue
- Want to enhance something? We'd love your contributions!
🙌 Feel free to use this project in your own work — but if you make improvements, please consider contributing them back to the community!
Licensed under the MIT License.
See the LICENSE.
- Always run PHP files from a server (
http://localhost/...) not fromfile:// - Ensure MySQL is running before launching the site
- Run the Python detection
civiceye.pylocally on your system.