http-root/app/pswd.php
2026-10-01 03:13:29 +09:00

12 lines
473 B
PHP

<?php
$_shared = $_SERVER["DOCUMENT_ROOT"]."/templates";
require "$_shared/lib.php";
$_title = "Password generator";
require "$_shared/header.php";
$str = strtr(base64_encode(random_bytes(15)), '+/', '-_');
$str[random_int(0, 19)] = random_int(0, 1) ? '-' : '_';
echo "<button onclick='navigator.clipboard.writeText(\"$str\").then(
() => { result.innerHTML = \"Copied\"; } );'>Copy</button><br>\n";
echo "<span id='result'></span>\n";
require "$_shared/footer.php";
?>