mirror of https://github.com/dnomd343/kms-server
dnomd343
2 years ago
3 changed files with 38 additions and 15 deletions
@ -0,0 +1,14 @@ |
|||
<?php |
|||
|
|||
function genStr(int $length, string $fillStr = ' '): string { // generate a string of specified length |
|||
return str_pad('', $length, $fillStr); |
|||
} |
|||
|
|||
function lenUtf8(string $str): int { // get string length (Chinese -> 2) |
|||
return strlen(iconv('utf-8', 'gb2312', $str)); |
|||
} |
|||
|
|||
function getKeys(bool $isWinServer = false): array { // get kms keys asset |
|||
$keysAsset = json_decode(file_get_contents('../assets/kms-keys.json'), true); |
|||
return $isWinServer ? array_reverse($keysAsset['win-server']) : $keysAsset['win']; |
|||
} |
@ -0,0 +1,22 @@ |
|||
<?php |
|||
|
|||
function showKeysWeb(array $kmsKeys, string $header): void { // show kms keys in html |
|||
echo '<!DOCTYPE html><html><head><meta charset="utf-8">'; |
|||
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">'; |
|||
echo '<link rel="stylesheet" href="./assets/style.css" /></head>'; |
|||
echo "<title>$header</title><body><div>"; |
|||
foreach ($kmsKeys as $title => $keys) { |
|||
echo "<h2>$title</h2>"; |
|||
echo '<table><thead><tr><th>操作系统</th><th>KMS密钥</th></tr></thead><tbody>'; |
|||
foreach ($keys as $caption => $key) { |
|||
echo "<tr><td>$caption</td><td>$key</td></tr>"; |
|||
} |
|||
echo '</tbody></table>'; |
|||
} |
|||
echo '</div></body></html>'; |
|||
} |
|||
|
|||
require_once 'Basis.php'; |
|||
|
|||
$keys = getKeys(); |
|||
showKeysWeb($keys, 'Windows KMS Keys'); |
Loading…
Reference in new issue