check.php 611 B

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