T.ME/BIBIL_0DAY
CasperSecurity


Server : Apache/2
System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User : gositeme ( 1004)
PHP Version : 8.2.29
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/gositeme/.cursor-server/data/User/History/-70cebe16/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/.cursor-server/data/User/History/-70cebe16/dLd4.md
# avocat.quebec - PHP/MySQL Migration

This is the PHP/MySQL version of the avocat.quebec legal platform, migrated from the original React/Next.js application.

## 🚀 **Migration Status**

### ✅ **Phase 1: Foundation Setup** - COMPLETED
- [x] PHP project structure with MVC pattern
- [x] MySQL database classes (replacing Prisma)
- [x] Authentication system (replacing NextAuth)
- [x] Configuration management
- [x] Basic homepage with bilingual support

### ✅ **Phase 2: Core Features** - COMPLETED
- [x] User registration and login system
- [x] Dashboard with case statistics
- [x] User management and profiles
- [x] Legal case management
- [x] API endpoints for frontend integration
- [x] Bilingual support (French/English)

### 🔄 **Phase 3: Advanced Features** - IN PROGRESS
- [ ] Chat system with WebSockets
- [ ] File upload and document management
- [ ] Lawyer directory and search
- [ ] Live cases (public arena)
- [ ] Video calling integration
- [ ] AI research tools

### ⏳ **Phase 4: UI Polish** - PENDING
- [ ] Complete all remaining pages
- [ ] Mobile responsiveness optimization
- [ ] Performance optimization
- [ ] Testing and bug fixes

## 📁 **Project Structure**

```
php-migration/
├── config/
│   ├── config.php          # Application configuration
│   └── database.php        # Database connection
├── models/
│   ├── User.php            # User model
│   ├── LegalCase.php       # Legal case model
│   └── ...                 # Additional models
├── auth/
│   └── Auth.php            # Authentication system
├── api/
│   ├── users.php           # Users API endpoint
│   ├── cases.php           # Cases API endpoint
│   └── ...                 # Additional API endpoints
├── uploads/                # File upload directory
├── index.php               # Homepage
├── login.php               # Login page
├── register.php            # Registration page
├── dashboard.php           # User dashboard
├── logout.php              # Logout handler
└── README.md               # This file
```

## 🛠 **Installation & Setup**

### Prerequisites
- PHP 7.4 or higher
- MySQL 5.7 or higher
- Web server (Apache/Nginx)

### Database Setup
1. Create MySQL database using the provided schema:
   ```sql
   -- Use the existing database_schema.sql file
   mysql -u username -p < database_schema.sql
   ```

2. Update database credentials in `config/database.php`:
   ```php
   private $host = 'localhost';
   private $db_name = 'gositeme_avocat';
   private $username = 'your_username';
   private $password = 'your_password';
   ```

### Configuration
1. Update `config/config.php` with your settings:
   - Database credentials
   - JWT secret key
   - Email SMTP settings
   - File upload settings

2. Set proper file permissions:
   ```bash
   chmod 755 uploads/
   chmod 644 *.php
   ```

## 🔧 **Features Implemented**

### Authentication System
- User registration with role-based access
- Secure login/logout functionality
- Password hashing and validation
- Session management
- Password reset functionality

### User Management
- Complete user profiles with all fields from original system
- Role-based permissions (USER, LAWYER, ADMIN, SUPER_ADMIN)
- User verification system
- Profile picture and document management

### Legal Case Management
- Create, read, update, delete cases
- Case status and priority management
- Client-lawyer case assignment
- Case statistics and reporting
- Public case visibility controls

### API Endpoints
- RESTful API for frontend integration
- User management endpoints
- Case management endpoints
- Proper error handling and validation
- CORS support for cross-origin requests

### Bilingual Support
- French and English language switching
- Dynamic content translation
- User language preferences
- URL-based language switching

## 🌐 **Usage**

### Accessing the Application
1. **Homepage**: `https://lavocat.quebec/php-migration/`
2. **Login**: `https://lavocat.quebec/php-migration/login.php`
3. **Register**: `https://lavocat.quebec/php-migration/register.php`
4. **Dashboard**: `https://lavocat.quebec/php-migration/dashboard.php`

### API Usage
- **Users API**: `https://lavocat.quebec/php-migration/api/users.php`
- **Cases API**: `https://lavocat.quebec/php-migration/api/cases.php`

### Language Switching
- Add `?lang=en` for English
- Add `?lang=fr` for French
- Default language is French

## 🔒 **Security Features**

- Password hashing using PHP's `password_hash()`
- SQL injection prevention with prepared statements
- XSS protection with `htmlspecialchars()`
- CSRF protection (to be implemented)
- Session security with proper configuration
- Input validation and sanitization

## 📊 **Database Schema**

The database schema maintains compatibility with the original Prisma schema:
- **User** table with all original fields
- **LegalCase** table for case management
- **Session** table for authentication
- **VerificationToken** table for password resets
- **ChatRoom**, **ChatParticipant**, **Message** tables for chat functionality
- **LawFirm** table for law firm management
- **Document** table for file management

## 🚀 **Next Steps**

1. **Complete Phase 3**: Implement remaining advanced features
2. **Add WebSocket support**: For real-time chat and notifications
3. **File upload system**: Complete document management
4. **Search functionality**: Lawyer and case search
5. **Email system**: Complete email notifications
6. **Testing**: Comprehensive testing of all features
7. **Performance optimization**: Caching and query optimization

## 🤝 **Contributing**

This is a migration project. All changes should maintain compatibility with the original React/Next.js functionality while providing the same user experience in PHP/MySQL.

## 📝 **Notes**

- The migration preserves all original functionality
- Bilingual support is fully implemented
- Database schema is identical to the original
- API endpoints maintain the same structure
- UI/UX remains consistent with the original design

## 🔗 **Related Files**

- Original React/Next.js code: `/src/` directory
- Database schema: `/database_schema.sql`
- Original configuration: `/package.json`, `/next.config.js`

CasperSecurity Mini