113 lines
4.1 KiB
HTML
113 lines
4.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>License Manager Admin</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<style>
|
|
body { background-color: #f8f9fa; padding-top: 50px; }
|
|
.card { box-shadow: 0 4px 6px rgba(0,0,0,0.1); border: none; }
|
|
.header { margin-bottom: 30px; text-align: center; }
|
|
.response-area { background: #2d2d2d; color: #50fa7b; padding: 15px; border-radius: 5px; font-family: monospace; display: none; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="container">
|
|
<div class="row justify-content-center">
|
|
<div class="col-md-8 col-lg-6">
|
|
<div class="header">
|
|
<h2>License Manager</h2>
|
|
<p class="text-muted">Issue and Manage Licenses</p>
|
|
</div>
|
|
|
|
<div class="card p-4">
|
|
<form id="issueForm">
|
|
<div class="mb-3">
|
|
<label for="secret" class="form-label">Server Secret</label>
|
|
<input type="password" class="form-control" id="secret" placeholder="Enter SERVER_SECRET from config.php" required>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6 mb-3">
|
|
<label for="prefix" class="form-label">License Prefix</label>
|
|
<input type="text" class="form-control" id="prefix" value="MYAPP" placeholder="e.g. PRO">
|
|
</div>
|
|
<div class="col-md-6 mb-3">
|
|
<label for="activations" class="form-label">Max Activations</label>
|
|
<input type="number" class="form-control" id="activations" value="1" min="1">
|
|
</div>
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary w-100">Generate License Key</button>
|
|
</form>
|
|
|
|
<div id="responseArea" class="mt-4 response-area">
|
|
<h6 class="text-white-50">Server Response:</h6>
|
|
<pre id="outputContent" class="mb-0"></pre>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="text-center mt-3">
|
|
<small class="text-muted">Upload this file to the same directory as <code>index.php</code></small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.getElementById('issueForm').addEventListener('submit', async function(e) {
|
|
e.preventDefault();
|
|
|
|
const secret = document.getElementById('secret').value;
|
|
const prefix = document.getElementById('prefix').value;
|
|
const activations = document.getElementById('activations').value;
|
|
const responseArea = document.getElementById('responseArea');
|
|
const outputContent = document.getElementById('outputContent');
|
|
const btn = this.querySelector('button');
|
|
|
|
// UI Loading State
|
|
btn.disabled = true;
|
|
btn.textContent = 'Generating...';
|
|
responseArea.style.display = 'none';
|
|
|
|
try {
|
|
const res = await fetch('index.php', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
action: 'issue',
|
|
secret: secret,
|
|
prefix: prefix,
|
|
max_activations: parseInt(activations)
|
|
})
|
|
});
|
|
|
|
const data = await res.json();
|
|
|
|
outputContent.textContent = JSON.stringify(data, null, 2);
|
|
responseArea.style.display = 'block';
|
|
|
|
if (data.success) {
|
|
outputContent.style.color = '#50fa7b'; // Green
|
|
} else {
|
|
outputContent.style.color = '#ff5555'; // Red
|
|
}
|
|
|
|
} catch (error) {
|
|
responseArea.style.display = 'block';
|
|
outputContent.textContent = 'Error: ' + error.message;
|
|
outputContent.style.color = '#ff5555';
|
|
} finally {
|
|
btn.disabled = false;
|
|
btn.textContent = 'Generate License Key';
|
|
}
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|