Browse Source

feat: add help message

master
dnomd343 2 years ago
parent
commit
30b4485a5b
  1. 22
      src/KeysWeb.php
  2. 36
      src/KmsWeb.php
  3. 17
      src/kmsCli.php

22
src/KeysWeb.php

@ -1,22 +0,0 @@
<?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');

36
src/KmsWeb.php

@ -0,0 +1,36 @@
<?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>';
}
function showHelpWeb(string $site) {
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>Windows Activation</title>';
echo '<body><div><h2>Windows KMS Activation</h2><pre>';
echo '<code> slmgr /upk\n slmgr /ipk KMS_KEY\n slmgr /skms ' . $site . '\n slmgr /ato\n slmgr /dlv </code>';
echo '</pre><p><a href="http://' . $site . '/office">KMS (Office)</a><br>';
echo '<a href="http://' . $site . '/win">KMS_KEY (Windows)</a><br>';
echo '<a href="http://' . $site . '/win-server">KMS_KEY (Windows Server)</a></p></div></body></html>';
}
require_once 'Basis.php';
//$keys = getKeys();
//showKeysWeb($keys, 'Windows KMS Keys');
showHelpWeb('kms.343.re');

17
src/KeysCli.php → src/kmsCli.php

@ -18,3 +18,20 @@ function showKeysCli(array $kmsKeys, bool $isGbk = false): void { // show kms ke
} }
echo $isGbk ? iconv('utf-8', 'gb2312', $ret) : $ret; // utf-8 or gbk echo $isGbk ? iconv('utf-8', 'gb2312', $ret) : $ret; // utf-8 or gbk
} }
function showHelpCli(string $site): void {
$length = strlen($site);
echo "\n" . genStr(floor(($length - 2) / 2)) . "Activation Command\n";
echo "┏" . genStr($length + 14, '-') . "┓\n";
echo "| slmgr /upk" . genStr($length + 3) . "|\n";
echo "| slmgr /ipk KMS_KEY" . genStr($length - 5) . "|\n";
echo "| slmgr /skms $site |\n";
echo "| slmgr /ato" . genStr($length + 3) . "|\n";
echo "| slmgr /dlv" . genStr($length + 3) . "|\n";
echo "┗" . genStr($length + 14, '-') . "┛\n\n";
echo "Office -> http://$site/office\n\n";
echo "KMS_KEY -> http://$site/win\n";
echo " -> http://$site/win-server\n\n";
echo "KMS_KEY(GBK) -> http://$site/win/gbk\n";
echo " -> http://$site/win-server/gbk\n\n";
}
Loading…
Cancel
Save