A comprehensive web-based educational management system designed for managing tutoring relationships, courses, payments, and student progress. Built with PHP, MySQL, and vanilla JavaScript for a robust and scalable learning platform.
- Features
- Architecture
- Tech Stack
- Installation
- Configuration
- Project Structure
- Usage
- API Documentation
- Database Schema
- User Roles
- Testing
- Documentation
- Troubleshooting
- Contributing
- Multi-Role User System - Support for Admin, Tutor, Student, and Parent roles
- Course Management - Create, update, and manage courses with detailed scheduling
- Payment System - Track payments, generate invoices, and manage financial records
- Calendar Integration - Visual calendar for scheduling and event management
- Student Dashboard - Personalized student interface with course information
- Parent Portal - Parent access to student progress and course information
- Tutor Management - Tutor profiles, scheduling, and course assignments
- Authentication - Secure login and session management
- Time Tracking - Precise time tracking for sessions and courses
- Data Validation - Comprehensive input validation and error handling
- Role-Based Access Control - Fine-grained permissions for each user role
- API Endpoints - RESTful API for programmatic access
- Responsive Design - Works on desktop and mobile devices
- UTF-8 Support - Full support for international characters (including Vietnamese)
- Error Logging - Comprehensive error tracking and debugging
App Layer:
βββ Controllers (handle requests and business logic)
βββ Models (handle data access and queries)
βββ Views (handle presentation and UI)
Supporting Layer:
βββ Base Classes (BaseController, BaseModel, Database)
βββ Routing (URL to Controller mapping)
βββ API Routes (REST endpoints)
1. User Request
β
2. index.php (routing)
β
3. Controller (authentication & validation)
β
4. Model (database queries)
β
5. View (HTML rendering) OR JSON Response
- Language: PHP 7.4+
- Database: MySQL 5.7+
- Architecture: Custom MVC Framework
- Session Management: PHP Sessions
- Encryption: bcrypt for passwords
- Markup: HTML5
- Styling: CSS3
- Scripts: Vanilla JavaScript (no dependencies)
- Calendar: Custom JavaScript calendar implementation
- Forms: Dynamic form handling with AJAX
- Version Control: Git
- Server: Apache (XAMPP recommended)
- Database Management: MySQL
- PHP 7.4 or higher
- MySQL 5.7 or higher
- Apache with mod_rewrite enabled
- XAMPP (recommended for local development)
- Git (for cloning the repository)
git clone https://github.com/anomalyco/VAL_EDU.git
cd VAL_EDU-
Using XAMPP:
- Start Apache and MySQL from XAMPP Control Panel
- Open phpMyAdmin: http://localhost/phpmyadmin
-
Import Database Schema:
# Option 1: Via phpMyAdmin # 1. Create new database: ValEduDatabase # 2. Import webapp/ValEduDatabase.sql # Option 2: Via Command Line mysql -u root < webapp/ValEduDatabase.sql
-
Database Configuration:
- Open
webapp/Base/Database.php - Default XAMPP configuration is already set:
private $host = '127.0.0.1'; private $database = 'ValEduDatabase'; private $username = 'root'; private $password = ''; // Empty for XAMPP
- Open
-
Web Server Configuration:
- Place project in XAMPP htdocs:
C:\xampp\htdocs\VAL_EDU - OR configure your Apache DocumentRoot to point to project root
- Place project in XAMPP htdocs:
Access the application:
http://localhost/VAL_EDU/webapp/
# Generate password hash
php webapp/generate_password.php
# Then manually insert into users table in phpMyAdmin
# Or use the admin registration interfaceEdit webapp/Base/Database.php:
private $host = '127.0.0.1'; // Database host
private $port = 3306; // MySQL port
private $database = 'ValEduDatabase'; // Database name
private $username = 'root'; // MySQL username
private $password = ''; // MySQL passwordDefault session configuration in webapp/index.php:
session_start();To modify session settings, update PHP configuration or add to index.php:
ini_set('session.gc_maxlifetime', 3600); // 1 hourThis project uses hard-coded configuration values in Base/Database.php for learning purposes only. This demonstrates how basic configuration works but is not recommended for production use.
Current Method:
private $host = '127.0.0.1';
private $database = 'ValEduDatabase';
private $username = 'root';
private $password = ''; // Empty for XAMPP defaultβ
Simple to understand - Easy to see how configuration values are used
β
No dependencies - No external libraries needed
β
Clear flow - Configuration β Connection β Usage
β
Low barrier to entry - Beginners can quickly modify settings
For production applications, you would use a .env file approach instead:
Why .env files are better:
- Security - Sensitive data never committed to Git
- Environment separation - Different settings for dev/test/production
- Deployment flexibility - Same code runs anywhere
- Team collaboration - Easy to share
.env.exampletemplate
How it would look:
# .env file (never committed to Git)
DB_HOST=127.0.0.1
DB_PORT=3306
DB_NAME=ValEduDatabase
DB_USER=root
DB_PASSWORD=
DB_CHARSET=utf8mb4Code would use:
private $host = getenv('DB_HOST');
private $port = getenv('DB_PORT');
private $database = getenv('DB_NAME');
private $username = getenv('DB_USER');
private $password = getenv('DB_PASSWORD');Or with a library like phpdotenv:
require_once 'vendor/autoload.php';
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
private $host = $_ENV['DB_HOST'];
private $database = $_ENV['DB_NAME'];
// ... etc| Aspect | Learning Project (Current) | Production Project |
|---|---|---|
| Configuration | Hard-coded in PHP files | Environment variables (.env) |
| Credentials | Visible in code | Hidden from version control |
| Flexibility | Requires code changes | Change .env to switch environments |
| Security | Not secure | Secure with proper setup |
| Dependencies | None needed | May use library like phpdotenv |
| Team Setup | Copy code, modify Database.php | Copy code, create .env file |
| Deployment | Requires code modification | No code changes needed |
| Containerization | Difficult | Easy with Docker |
As you progress with this project:
- Now (Learning): Understand configuration in
Base/Database.php - Intermediate: Learn about environment variables and
.envfiles - Advanced: Implement
.envfile support usingphpdotenvor similar - Professional: Implement full configuration management with multiple environments
If you want to implement .env support later, here's a basic example:
1. Install dependency:
composer require vlucas/phpdotenv2. Create .env file:
DB_HOST=127.0.0.1
DB_PORT=3306
DB_NAME=ValEduDatabase
DB_USER=root
DB_PASSWORD=
DB_CHARSET=utf8mb4
3. Create .env.example for Git:
DB_HOST=localhost
DB_PORT=3306
DB_NAME=ValEduDatabase
DB_USER=root
DB_PASSWORD=
DB_CHARSET=utf8mb4
4. Add .env to .gitignore:
.env
.env.local
.env.*.php
5. Update Base/Database.php:
<?php
require_once dirname(__DIR__) . '/../vendor/autoload.php';
$dotenv = Dotenv\Dotenv::createImmutable(dirname(__DIR__) . '/..');
$dotenv->load();
class Database {
private static $instance = null;
private $connection;
private $host = '';
private $port = 3306;
private $database = '';
private $username = '';
private $password = '';
private function __construct() {
// Load from environment
$this->host = $_ENV['DB_HOST'] ?? '127.0.0.1';
$this->port = $_ENV['DB_PORT'] ?? 3306;
$this->database = $_ENV['DB_NAME'] ?? 'ValEduDatabase';
$this->username = $_ENV['DB_USER'] ?? 'root';
$this->password = $_ENV['DB_PASSWORD'] ?? '';
// ... rest of configuration
}
}This project uses hard-coded configuration for learning purposes. Understanding how this works is valuable, but remember that production applications should always use environment variables to keep sensitive data secure and enable flexible deployments.
UTF-8 is configured in Base/Database.php:
$this->connection->set_charset("utf8mb4");VAL_EDU/
βββ README.md # This file
βββ TESTING_REFACTOR_SUMMARY.md # Test organization guide
β
βββ webapp/ # Application root
β βββ index.php # Main routing file
β βββ .htaccess # Apache rewrite rules
β β
β βββ Base/ # Base framework classes
β β βββ Database.php # Database connection (Singleton)
β β βββ BaseController.php # Base controller class
β β βββ BaseModel.php # Base model class
β β
β βββ Controller/ # Application controllers
β β βββ HomeController.php
β β βββ AuthController.php # Authentication
β β βββ AdminController.php # Admin functions
β β βββ StudentController.php # Student functions
β β βββ TutorController.php # Tutor functions
β β βββ ParentController.php # Parent functions
β β
β βββ Model/ # Data models
β β βββ UserModel.php # User operations
β β βββ AdminModel.php # Admin data
β β βββ StudentModel.php # Student data
β β βββ TutorModel.php # Tutor data
β β βββ ParentModel.php # Parent data
β β βββ HomeModel.php # Home page data
β β
β βββ View/ # HTML templates
β β βββ Auth/ # Login/Register views
β β βββ Admin/ # Admin panel views
β β βββ Student/ # Student views
β β βββ Tutor/ # Tutor views
β β βββ Parent/ # Parent views
β β βββ Home/ # Home page views
β β βββ Partial/ # Reusable components
β β βββ images/ # Static images
β β
β βββ api/ # API endpoints
β β βββ student/ # Student API routes
β β
β βββ routes/ # URL routing
β β βββ student.php # Student routes
β β
β βββ tests/ # Test suite (organized)
β β βββ unit/ # Unit tests
β β βββ integration/ # Integration tests
β β βββ e2e/ # End-to-end tests
β β βββ fixtures/ # Test data
β β βββ scripts/ # Utility scripts
β β βββ archived/ # Temporary debug files
β β
β βββ ValEduDatabase.sql # Database schema
β βββ PAYMENT_SYSTEM_DOCUMENTATION.md # Payment details
β βββ USERNAME_ROUTING.md # Routing reference
β β
β βββ Utility Scripts # Helper scripts
β βββ generate_password.php # Password generation
β βββ create_sample_data.php # Sample data generator
β βββ create_sample_payments.php # Sample payment data
β
βββ .gitignore # Git ignore rules
-
Start XAMPP:
- Open XAMPP Control Panel
- Start Apache and MySQL services
-
Open in Browser:
http://localhost/VAL_EDU/webapp/ -
Login:
- Use credentials from the database
- Default admin can be created using
generate_password.php
| URL | Purpose |
|---|---|
/ |
Home page |
/admin |
Admin dashboard |
/student |
Student portal |
/tutor |
Tutor dashboard |
/parent |
Parent portal |
/auth/login |
Login page |
/auth/register |
Registration page |
/auth/logout |
Logout |
POST /api/student/auth/login
Content-Type: application/json
{
"username": "user@example.com",
"password": "password123"
}
Response: { "success": true, "message": "Login successful", "user": {...} }
POST /api/student/auth/logout
Response: { "success": true, "message": "Logout successful" }
GET /api/student/profile
Authorization: Bearer {token}
Response: { "id": 1, "name": "John Doe", "email": "john@example.com", ... }
GET /api/student/courses
Response: [ { "id": 1, "name": "Math 101", "tutor": "Jane Smith" }, ... ]
GET /api/student/schedule
Response: [ { "date": "2024-01-15", "time": "10:00", "course": "Math 101" }, ... ]
GET /api/student/payments
Response: [ { "id": 1, "amount": 100, "date": "2024-01-15", "status": "Paid" }, ... ]
GET /api/courses
Response: [ { "id": 1, "name": "Math 101", "tutor": "Jane Smith", "price": 100 }, ... ]
POST /api/student/courses/enroll
Content-Type: application/json
{ "course_id": 1 }
Response: { "success": true, "message": "Enrolled successfully" }
| Table | Purpose |
|---|---|
users |
All user accounts (admin, tutor, student, parent) |
students |
Student profiles and information |
tutors |
Tutor profiles and rates |
courses |
Course definitions |
enrollments |
Student course enrollments |
payments |
Payment records |
sessions |
Student-tutor sessions |
CREATE TABLE users (
id INT PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(255) UNIQUE NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL,
password_hash VARCHAR(255) NOT NULL,
role ENUM('admin', 'tutor', 'student', 'parent') NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);CREATE TABLE students (
id INT PRIMARY KEY AUTO_INCREMENT,
user_id INT NOT NULL,
first_name VARCHAR(255),
last_name VARCHAR(255),
phone VARCHAR(20),
parent_id INT,
enrollment_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id),
FOREIGN KEY (parent_id) REFERENCES users(id)
);CREATE TABLE tutors (
id INT PRIMARY KEY AUTO_INCREMENT,
user_id INT NOT NULL,
first_name VARCHAR(255),
last_name VARCHAR(255),
specialization VARCHAR(255),
hourly_rate DECIMAL(10, 2),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id)
);CREATE TABLE courses (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
description TEXT,
tutor_id INT NOT NULL,
price DECIMAL(10, 2),
duration_hours INT,
max_students INT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (tutor_id) REFERENCES tutors(id)
);CREATE TABLE payments (
id INT PRIMARY KEY AUTO_INCREMENT,
student_id INT NOT NULL,
amount DECIMAL(10, 2),
payment_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
status ENUM('pending', 'completed', 'failed', 'refunded') DEFAULT 'pending',
course_id INT,
FOREIGN KEY (student_id) REFERENCES students(id),
FOREIGN KEY (course_id) REFERENCES courses(id)
);- Manage all users and permissions
- View financial reports
- Manage courses and enrollments
- System configuration and monitoring
Permissions:
- Create/Edit/Delete users
- View all transactions
- Generate reports
- Manage system settings
- Create and manage courses
- View enrolled students
- Track sessions and payments
- Manage schedule
Permissions:
- Create courses
- View student information
- Track hours and earnings
- Manage availability
- Enroll in courses
- View course materials
- Track progress
- Make payments
Permissions:
- View assigned courses
- Submit assignments
- View grades
- Make course payments
- Monitor student progress
- View enrolled courses
- View payment history
- Receive notifications
Permissions:
- View student's courses
- View student's progress
- View payment records
- Receive update notifications
The project has organized test suite located in webapp/tests/:
# Unit tests (component-level testing)
php webapp/tests/unit/run_tests.php
# Integration tests (multi-component workflows)
php webapp/tests/integration/run_tests.php
# End-to-end tests (full browser testing)
php webapp/tests/e2e/run_tests.php
# Run all tests
bash webapp/tests/run_all_tests.shtests/
βββ unit/ # Isolated component tests (12 files)
βββ integration/ # Multi-component tests (8 files)
βββ e2e/ # Browser-based tests (12 files)
βββ fixtures/ # Test data and factories (1 file)
βββ scripts/ # Test utilities (1 file)
βββ archived/ # Debug files (7 files)
βββ README.md # Detailed testing guide
βββ QUICK_REFERENCE.md # Command quick reference
βββ CONSOLIDATION_GUIDE.md # Test redundancy report
βββ index.html # Interactive test browser
For detailed testing information, see webapp/tests/README.md
Additional documentation files:
- TESTING_REFACTOR_SUMMARY.md - Test organization and refactoring details
- PAYMENT_SYSTEM_DOCUMENTATION.md - Payment system architecture
- USERNAME_ROUTING.md - URL routing reference
- webapp/tests/README.md - Comprehensive testing guide
- webapp/tests/QUICK_REFERENCE.md - Testing commands reference
- webapp/tests/CONSOLIDATION_GUIDE.md - Test consolidation roadmap
Problem: Connection refused or No database selected
Solution:
- Verify MySQL is running (check XAMPP Control Panel)
- Check database credentials in
Base/Database.php - Verify
ValEduDatabaseexists in MySQL - Run:
mysql -u root < webapp/ValEduDatabase.sql
Problem: The requested resource was not found
Solution:
- Verify
.htaccessis inwebapp/directory - Check that Apache
mod_rewriteis enabled - Restart Apache after enabling modules
- Access via
http://localhost/VAL_EDU/webapp/
Problem: User keeps getting logged out
Solution:
- Check session folder has write permissions
- Verify
session.save_pathin php.ini - Check browser allows cookies
- Clear browser cache and cookies
Problem: Vietnamese characters display as ? or garbled
Solution:
- Verify database charset is
utf8mb4 - Check HTML meta charset:
<meta charset="UTF-8"> - Verify MySQL connection charset in
Base/Database.php:$this->connection->set_charset("utf8mb4");
Problem: Permission denied when accessing files
Solution:
- Check file permissions:
chmod 755 webapp/ - Verify Apache user has read/write access
- Check logs in
apache/logs/error.log
Problem: Page loads but shows nothing
Solution:
- Check PHP error logs:
php -r "phpinfo();" | grep "error_log" - Enable display_errors temporarily in
php.ini - Check for syntax errors in controller/view files
- Review Apache error log
- PHP: Follow PSR-2 coding standards
- JavaScript: Use consistent indentation (2 spaces)
- HTML/CSS: Semantic markup, mobile-first design
- Comments: Add meaningful comments for complex logic
- Fork the repository
- Create feature branch:
git checkout -b feature/your-feature - Make your changes
- Write/update tests as needed
- Commit with clear messages:
git commit -m "Add your feature description" - Push to branch:
git push origin feature/your-feature - Open Pull Request with description
- Run all tests:
bash webapp/tests/run_all_tests.sh - Verify no PHP errors:
php -l yourfile.php - Check database migrations work
- Test in multiple browsers if UI changes
- At least one approval required before merge
- CI/CD checks must pass
- No merge conflicts with main branch
- Updated documentation for new features
Educational Use License - This project is provided for learning and educational purposes.
Project: VAL_EDU - Educational Platform Purpose: Learning and educational management Support: For issues and feedback, visit https://github.com/anomalyco/VAL_EDU
- Implement
.envfile configuration support - Add comprehensive error logging
- Implement request/response caching
- Add email notifications
- Real-time chat between students and tutors
- Video conferencing integration
- Mobile app development
- API rate limiting
- Student performance analytics
- Financial reporting dashboard
- Usage metrics and insights
- Export to various formats (PDF, Excel)
- Implement multi-environment configuration
- Add comprehensive test coverage (>80%)
- Security audit and penetration testing
- Performance optimization and caching
- Deployment pipeline (CI/CD)
- Single Server: Not designed for distributed/multi-server deployment
- Hard-coded Configuration: Uses hard-coded values (see Configuration section)
- No API Authentication: API endpoints use session-based auth only
- Limited Error Logging: Basic error handling without comprehensive logging
- No Background Jobs: Synchronous processing only
- Basic Input Validation: Client-side and server-side validation present but could be enhanced
- No HTTPS/SSL: Designed for local development without encryption
- β Multi-role user system (Admin, Tutor, Student, Parent)
- β Course management and enrollment
- β Payment tracking system
- β Calendar and scheduling
- β Student and parent portals
- β Comprehensive test suite
- β Complete documentation
- β API endpoints for core functionality
- Environment variable configuration (.env)
- Enhanced error logging
- Real-time notifications
- Video integration
- Analytics dashboard
Last Updated: February 2026 Repository: https://github.com/anomalyco/VAL_EDU Questions or Issues? Visit the GitHub issues page