Files
web/scripts/pi-hole/php/api_token.php
RD WebDesign a3234d1306 Replacing tabs with 4 spaces
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2022-08-01 01:28:30 -03:00

51 lines
869 B
PHP

<?php
require "auth.php";
require "password.php";
check_cors();
?>
<html>
<head>
<style>
body {
background: #fff;
margin: 10px 0;
}
.qrcode {
text-align: center;
margin: 0 0 1em;
}
.qrcode svg {
max-width: 100%;
height: auto;
}
.token {
font-size: 14px;
word-break: break-word;
}
</style>
</head>
<body>
<?php
if($auth) {
if(strlen($pwhash) > 0) {
echo '<div class="qrcode">';
require_once("../../vendor/qrcode.php");
$qr = QRCode::getMinimumQRCode($pwhash, QR_ERROR_CORRECT_LEVEL_Q);
// The size of each block (in pixels) should be an integer
$qr->printSVG(10);
echo "</div>";
echo 'Raw API Token: <code class="token">' . $pwhash . "</code></div>";
} else {
echo "<p>No password set</p>";
}
} else {
echo "<p>Not authorized!</p>";
}
?>
</body>
</html>