Free Delivery on all Orders.
Minimum delivery order amount Rs 500.
Free Delivery on all Orders.
Minimum delivery order amount Rs 500.
Main Banner Image 1
store logo

The All Seasons Company

Crafted from finest fabrics

Have you built a license system using one of these GitHub projects? Share your experience in the discussion below.

CREATE TABLE `licenses` ( `id` INT AUTO_INCREMENT PRIMARY KEY, `license_key` VARCHAR(64) NOT NULL UNIQUE, `status` ENUM('active', 'expired', 'suspended') DEFAULT 'active', `max_instances` INT DEFAULT 1, `expires_at` DATETIME NOT NULL, `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); CREATE TABLE `license_activations` ( `id` INT AUTO_INCREMENT PRIMARY KEY, `license_id` INT NOT NULL, `domain` VARCHAR(255) NOT NULL, `activated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (`license_id`) REFERENCES `licenses`(`id`) ON DELETE CASCADE ); Use code with caution. 2. The Verification API (Server Side)

false, 'message' => 'Invalid request method.']); exit; $license_key = $_POST['license_key'] ?? ''; $domain = $_POST['domain'] ?? ''; if (empty($license_key) || empty($domain)) echo json_encode(['valid' => false, 'message' => 'Missing required parameters.']); exit; // Connect to your database $pdo = new PDO('mysql:host=localhost;dbname=license_db', 'username', 'password'); // Check if license exists and is active $stmt = $pdo->prepare("SELECT * FROM licenses WHERE license_key = ? AND status = 'active'"); $stmt->execute([$license_key]); $license = $stmt->fetch(); if (!$license) echo json_encode(['valid' => false, 'message' => 'Invalid or suspended license key.']); exit; // Check expiration date if ($license['expires_at'] && strtotime($license['expires_at']) < time()) echo json_encode(['valid' => false, 'message' => 'License has expired.']); exit; // Check current activations $stmt = $pdo->prepare("SELECT COUNT(*) FROM activations WHERE license_id = ?"); $stmt->execute([$license['id']]); $current_activations = $stmt->fetchColumn(); // Check if this domain is already activated $stmt = $pdo->prepare("SELECT * FROM activations WHERE license_id = ? AND domain = ?"); $stmt->execute([$license['id'], $domain]); $already_active = $stmt->fetch(); if (!$already_active) if ($current_activations >= $license['max_activations']) echo json_encode(['valid' => false, 'message' => 'Activation limit reached.']); exit; // Register new activation $stmt = $pdo->prepare("INSERT INTO activations (license_id, domain) VALUES (?, ?)"); $stmt->execute([$license['id'], $domain]); echo json_encode(['valid' => true, 'message' => 'License validated successfully.']); Use code with caution. Step 3: Implementing the Client-Side Verification

Without a license system, your code is vulnerable to being shared, modified, and redistributed freely. A proper system offers:

These repositories include both the (where you generate keys and manage customers) and the Client (the code that goes into your product).

Periodically sends the user's license key to your server via cURL .