adding registration management
This commit is contained in:
parent
caebeeb615
commit
2d29c8c62b
23
db/migrations/20260220_license_server_schema.sql
Normal file
23
db/migrations/20260220_license_server_schema.sql
Normal file
@ -0,0 +1,23 @@
|
||||
-- Migration: Create server-side license tables
|
||||
-- Target: u128023052_meezan_license (Remote Server)
|
||||
-- Created at: 2026-02-20
|
||||
|
||||
CREATE TABLE IF NOT EXISTS licenses (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
license_key VARCHAR(255) NOT NULL UNIQUE,
|
||||
max_activations INT DEFAULT 1,
|
||||
status ENUM('active', 'suspended', 'expired') DEFAULT 'active',
|
||||
owner VARCHAR(255) DEFAULT NULL,
|
||||
address TEXT DEFAULT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS activations (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
license_id INT NOT NULL,
|
||||
fingerprint VARCHAR(255) NOT NULL,
|
||||
domain VARCHAR(255) DEFAULT NULL,
|
||||
product VARCHAR(255) DEFAULT NULL,
|
||||
activated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (license_id) REFERENCES licenses(id) ON DELETE CASCADE
|
||||
);
|
||||
38
index.php
38
index.php
@ -7353,7 +7353,42 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System';
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php elseif ($page === 'licenses'): ?>
|
||||
<?php elseif ($page === 'licenses'):
|
||||
$license_password = 'Meezan@2026';
|
||||
if (isset($_POST['license_password_submit'])) {
|
||||
if ($_POST['license_password'] === $license_password) {
|
||||
$_SESSION['license_auth'] = true;
|
||||
} else {
|
||||
$data['license_error'] = 'Invalid password.';
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($_SESSION['license_auth'])): ?>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-5">
|
||||
<div class="card border-0 shadow-sm rounded-4 text-center p-5">
|
||||
<div class="mb-4">
|
||||
<i class="bi bi-shield-lock-fill text-primary display-1"></i>
|
||||
</div>
|
||||
<h4 class="fw-bold mb-3" data-en="Restricted Access" data-ar="وصول مقيد">Restricted Access</h4>
|
||||
<p class="text-muted mb-4" data-en="Please enter the management password to continue." data-ar="يرجى إدخال كلمة مرور الإدارة للمتابعة.">Please enter the management password to continue.</p>
|
||||
|
||||
<?php if (!empty($data['license_error'])): ?>
|
||||
<div class="alert alert-danger py-2 small"><?= htmlspecialchars($data['license_error']) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="POST">
|
||||
<div class="mb-3">
|
||||
<input type="password" name="license_password" class="form-control form-control-lg text-center" placeholder="••••••••" required autofocus>
|
||||
</div>
|
||||
<button type="submit" name="license_password_submit" class="btn btn-primary w-100 py-3 rounded-pill fw-bold">
|
||||
<span data-en="Verify & Continue" data-ar="تحقق ومتابعة">Verify & Continue</span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="card border-0 shadow-sm rounded-4">
|
||||
<div class="card-header bg-white py-3 d-flex justify-content-between align-items-center border-0">
|
||||
<div>
|
||||
@ -7526,6 +7561,7 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System';
|
||||
<style>
|
||||
#licensesTable td { padding: 1rem 0.75rem; }
|
||||
</style>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php elseif ($page === 'users'): ?>
|
||||
<div class="card border-0 shadow-sm rounded-4 overflow-hidden">
|
||||
|
||||
@ -5,7 +5,7 @@ class LicenseService {
|
||||
|
||||
private static function getApiUrl() {
|
||||
if (self::$remote_api_url === null) {
|
||||
self::$remote_api_url = getenv('LICENSE_API_URL') ?: 'https://omanapp.cloud/meezan_register';
|
||||
self::$remote_api_url = getenv('LICENSE_API_URL') ?: 'https://omanapp.cloud/meezan_register/';
|
||||
}
|
||||
return self::$remote_api_url;
|
||||
}
|
||||
@ -170,7 +170,7 @@ class LicenseService {
|
||||
*/
|
||||
private static function callRemoteApi($endpoint, $params) {
|
||||
$action = ltrim($endpoint, '/');
|
||||
$url = self::getApiUrl() . '/index.php?action=' . $action;
|
||||
$url = rtrim(self::getApiUrl(), '/') . '/index.php?action=' . $action;
|
||||
|
||||
// Check if we are in local development / simulation mode
|
||||
if (strpos($url, 'your-domain.com') !== false) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user