updating serials error
This commit is contained in:
parent
6bc4ca3136
commit
3447cdbc2a
@ -111,10 +111,16 @@ if ($endpoint === 'verify') {
|
|||||||
$status = $license['status'] ?? 'suspended';
|
$status = $license['status'] ?? 'suspended';
|
||||||
|
|
||||||
if ($status === 'active') {
|
if ($status === 'active') {
|
||||||
|
// Count current activations for this license
|
||||||
|
$stmt = $pdo->prepare("SELECT COUNT(*) FROM activations WHERE license_id = ?");
|
||||||
|
$stmt->execute([$license['id']]);
|
||||||
|
$current_activations = (int)$stmt->fetchColumn();
|
||||||
|
|
||||||
echo json_encode([
|
echo json_encode([
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'max_activations' => (int)$license['max_activations'],
|
'max_activations' => (int)$license['max_activations'],
|
||||||
'max_counters' => (int)$license['max_counters']
|
'max_counters' => (int)$license['max_counters'],
|
||||||
|
'current_activations' => $current_activations
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
echo json_encode(['success' => false, 'error' => 'License is no longer active.']);
|
echo json_encode(['success' => false, 'error' => 'License is no longer active.']);
|
||||||
|
|||||||
@ -114,6 +114,18 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
$stmt->execute([$key, $max_activations, $max_counters, $owner, $address]);
|
$stmt->execute([$key, $max_activations, $max_counters, $owner, $address]);
|
||||||
$message = "New license issued successfully: <strong>$key</strong>";
|
$message = "New license issued successfully: <strong>$key</strong>";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'update_limits':
|
||||||
|
$id = (int)$_POST['id'];
|
||||||
|
$max_activations = (int)$_POST['max_activations'];
|
||||||
|
$max_counters = (int)$_POST['max_counters'];
|
||||||
|
$owner = trim($_POST['owner'] ?? '');
|
||||||
|
$address = trim($_POST['address'] ?? '');
|
||||||
|
|
||||||
|
$stmt = $pdo->prepare("UPDATE licenses SET max_activations = ?, max_counters = ?, owner = ?, address = ? WHERE id = ?");
|
||||||
|
$stmt->execute([$max_activations, $max_counters, $owner, $address, $id]);
|
||||||
|
$message = "License limits updated successfully.";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@ -163,6 +175,7 @@ try {
|
|||||||
.search-container { position: relative; max-width: 300px; }
|
.search-container { position: relative; max-width: 300px; }
|
||||||
.search-container i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
|
.search-container i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
|
||||||
.search-container input { padding-left: 2.5rem; background: #f8fafc; }
|
.search-container input { padding-left: 2.5rem; background: #f8fafc; }
|
||||||
|
.extra-small { font-size: 0.7rem; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -196,6 +209,9 @@ try {
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
<div class="alert alert-info border-0 rounded-0 m-0 small py-2 px-4">
|
||||||
|
<i class="bi bi-info-circle-fill me-2"></i> <strong>Tip:</strong> <u>Machines Limit</u> controls how many separate computers can use the key. <u>Counters Limit</u> is an internal value used by the software features.
|
||||||
|
</div>
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div class="d-flex align-items-center gap-3">
|
<div class="d-flex align-items-center gap-3">
|
||||||
<h5 class="mb-0 fw-bold">Licenses Dashboard</h5>
|
<h5 class="mb-0 fw-bold">Licenses Dashboard</h5>
|
||||||
@ -261,6 +277,9 @@ try {
|
|||||||
</td>
|
</td>
|
||||||
<td class="text-end">
|
<td class="text-end">
|
||||||
<div class="d-flex justify-content-end gap-2">
|
<div class="d-flex justify-content-end gap-2">
|
||||||
|
<button class="action-btn" title="Edit Limits" data-bs-toggle="modal" data-bs-target="#editModal-<?= $l['id'] ?>">
|
||||||
|
<i class="bi bi-pencil"></i>
|
||||||
|
</button>
|
||||||
<button class="action-btn" title="View Activations" data-bs-toggle="modal" data-bs-target="#modal-<?= $l['id'] ?>">
|
<button class="action-btn" title="View Activations" data-bs-toggle="modal" data-bs-target="#modal-<?= $l['id'] ?>">
|
||||||
<i class="bi bi-laptop"></i>
|
<i class="bi bi-laptop"></i>
|
||||||
</button>
|
</button>
|
||||||
@ -283,6 +302,48 @@ try {
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<!-- Edit Modal -->
|
||||||
|
<div class="modal fade" id="editModal-<?= $l['id'] ?>" tabindex="-1">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title fw-bold">Edit License: <?= htmlspecialchars($l['license_key']) ?></h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||||
|
</div>
|
||||||
|
<form method="POST">
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="hidden" name="action" value="update_limits">
|
||||||
|
<input type="hidden" name="id" value="<?= $l['id'] ?>">
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-6">
|
||||||
|
<label class="form-label">Machines Limit</label>
|
||||||
|
<input type="number" name="max_activations" class="form-control" value="<?= $l['max_activations'] ?>" min="1">
|
||||||
|
<div class="extra-small text-muted">Number of allowed PCs</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<label class="form-label">Counters Limit</label>
|
||||||
|
<input type="number" name="max_counters" class="form-control" value="<?= $l['max_counters'] ?>" min="1">
|
||||||
|
<div class="extra-small text-muted">Internal software limit</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label">Owner Name</label>
|
||||||
|
<input type="text" name="owner" class="form-control" value="<?= htmlspecialchars($l['owner'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label">Address / Notes</label>
|
||||||
|
<textarea name="address" class="form-control" rows="2"><?= htmlspecialchars($l['address'] ?? '') ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer border-0">
|
||||||
|
<button type="button" class="btn btn-light rounded-pill px-4" data-bs-dismiss="modal">Cancel</button>
|
||||||
|
<button type="submit" class="btn btn-primary rounded-pill px-4">Save Changes</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Activations Modal -->
|
<!-- Activations Modal -->
|
||||||
<div class="modal fade" id="modal-<?= $l['id'] ?>" tabindex="-1">
|
<div class="modal fade" id="modal-<?= $l['id'] ?>" tabindex="-1">
|
||||||
<div class="modal-dialog modal-dialog-centered modal-lg">
|
<div class="modal-dialog modal-dialog-centered modal-lg">
|
||||||
@ -361,10 +422,12 @@ try {
|
|||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<label class="form-label">Machines Limit</label>
|
<label class="form-label">Machines Limit</label>
|
||||||
<input type="number" name="max_activations" class="form-control" value="1" min="1">
|
<input type="number" name="max_activations" class="form-control" value="1" min="1">
|
||||||
|
<div class="extra-small text-muted text-primary fw-semibold">Controls how many PCs can activate</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<label class="form-label">Counters Limit</label>
|
<label class="form-label">Counters Limit</label>
|
||||||
<input type="number" name="max_counters" class="form-control" value="1" min="1">
|
<input type="number" name="max_counters" class="form-control" value="1" min="1">
|
||||||
|
<div class="extra-small text-muted">Internal value returned to software</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<label class="form-label">Owner Name</label>
|
<label class="form-label">Owner Name</label>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user