check.php 542 B

1234567891011121314151617181920212223
  1. <?php
  2. use RobThree\Auth\TwoFactorAuth;
  3. require_once __DIR__ . "/../vendor/autoload.php";
  4. if (isset($argv[1]) && isset($argv[2])) {
  5. $secret = $argv[1];
  6. $token = $argv[2];
  7. } elseif (isset($_GET["secret"]) && isset($_GET["token"])) {
  8. $secret = htmlspecialchars($_GET["secret"]);
  9. $token = htmlspecialchars($_GET["token"]);
  10. } else {
  11. echo "ERROR: Secret or Token is not set as argument!";
  12. exit();
  13. }
  14. $tfa = new TwoFactorAuth("Hestia Control Panel");
  15. // Verify code
  16. $result = $tfa->verifyCode($secret, $token);
  17. if ($result) {
  18. echo "ok";
  19. }