# Chameleon Bot License System A simple license management system for software products. ## Features - License key generation and management - User tracking and verification - Admin panel for license management - API for license verification - RESTful API for programmatic management ## Installation ### Windows 1. Extract all files to a temporary directory 2. Run `install.bat` and follow the instructions 3. Open your web browser and navigate to: - `http://localhost/chameleon-license/easy_install.php` (Recommended - easier setup) - OR `http://localhost/chameleon-license/setup.php` (Standard setup) 4. Follow the on-screen instructions to complete the installation ### Linux/Mac 1. Extract all files to a temporary directory 2. Run `install.sh` and follow the instructions 3. Open your web browser and navigate to: - `http://localhost/chameleon-license/easy_install.php` (Recommended - easier setup) - OR `http://localhost/chameleon-license/setup.php` (Standard setup) 4. Follow the on-screen instructions to complete the installation ## Default Admin Credentials - Username: `admin` - Password: `admin123` **Important**: Change the default password immediately after installation for security reasons. ## System Requirements - PHP 7.4 or higher - MySQL 5.7 or higher - Web server (Apache, Nginx, etc.) ## API Usage ### License Verification API To verify a license in your application, make a request to the API endpoint: ```php $license_key = "USER_LICENSE_KEY"; $url = "http://your-domain.com/chameleon-license/verify_license.php?key=" . urlencode($license_key); $response = file_get_contents($url); $result = json_decode($response, true); if ($result['status'] === 'active') { // License is valid echo "License verified successfully!"; } else { // License is invalid echo "Invalid license: " . $result['message']; } ``` ### Complete REST API The system also includes a comprehensive REST API for programmatic license management. The API is accessed through `api.php` and requires an API key for authentication. #### Authentication Authentication is done using the `X-Api-Key` header or by passing the `api_key` parameter in the request URL. ```php $api_key = "YOUR_API_KEY"; // Set in api.php $headers = [ 'X-Api-Key: ' . $api_key, 'Content-Type: application/json' ]; ``` #### Available Endpoints | Endpoint | Method | Description | |----------|--------|-------------| | `/api.php?action=verify&key={license_key}` | GET | Verify a license key | | `/api.php?action=create` | POST | Create a new license | | `/api.php?action=update` | PUT/POST | Update a license | | `/api.php?action=revoke` | POST | Revoke a license | | `/api.php?action=delete` | DELETE/POST | Delete a license | | `/api.php?action=list` | GET | List licenses with pagination | #### Example: Creating a new license ```php $ch = curl_init("http://your-domain.com/chameleon-license/api.php?action=create"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'user_name' => 'John Doe', 'user_email' => 'john@example.com', 'user_phone' => '123-456-7890', 'status' => 'active' ])); $response = curl_exec($ch); $result = json_decode($response, true); curl_close($ch); echo "New license key: " . $result['data']['key']; ``` #### Example: Listing active licenses ```php $ch = curl_init("http://your-domain.com/chameleon-license/api.php?action=list&status=active&limit=10"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); $result = json_decode($response, true); curl_close($ch); foreach ($result['data']['licenses'] as $license) { echo "License: " . $license['key'] . " - " . $license['user_name'] . "\n"; } ``` See `client_example.php` for a complete implementation example. ## License Management 1. Log in to the admin panel at `http://your-domain.com/chameleon-license/admin.php` 2. From here you can: - Generate new license keys - Manage existing licenses - View license verification logs - Deactivate or delete licenses ## Support For support, please contact support@chameleon-bot.com