forked from Business/AccountHub
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
673 B
PHTML
32 lines
673 B
PHTML
7 years ago
|
<?php
|
||
|
|
||
|
require __DIR__ . "/required.php";
|
||
|
require __DIR__ . "/lib/login.php";
|
||
|
|
||
|
use Endroid\QrCode\QrCode;
|
||
|
use OTPHP\TOTP;
|
||
|
|
||
|
if ($_GET['show'] == '1') {
|
||
|
|
||
|
$totp = new TOTP(
|
||
|
"admin@netsyms.com", // The label (string)
|
||
|
"ZBUJDTW5D5E6KBMDICAJSKRCX6VGQZCZ" // The secret encoded in base 32 (string)
|
||
|
);
|
||
|
|
||
|
echo "Current OTP: " . $totp->now();
|
||
|
|
||
|
die();
|
||
|
} else {
|
||
|
|
||
|
$user = "skylarmt";
|
||
|
|
||
|
$totp = newTOTP($user);
|
||
|
|
||
|
// Create a QR code
|
||
|
$qrCode = new QrCode($totp);
|
||
|
$qrCode->setSize(300);
|
||
|
|
||
|
// now we can output the QR code
|
||
|
header('Content-Type: ' . $qrCode->getContentType(QrCode::IMAGE_TYPE_PNG));
|
||
|
$qrCode->render(null, 'png');
|
||
|
}
|