<?php
exit;
include_once '../_vendors/google-authenticator/FixedBitNotation.php';
include_once '../_vendors/google-authenticator/GoogleAuthenticatorInterface.php';
include_once '../_vendors/google-authenticator/GoogleAuthenticator.php';
include_once '../_vendors/google-authenticator/GoogleQrUrl.php';


$auth = new \Google\Authenticator\GoogleAuthenticator();

$secret = isset($_GET['tk']) ? $_GET['tk'] : $auth->generateSecret();
//$secret = 'WNCPCSYEPUT3A43E';
var_dump($secret);

$qrcode = $auth->getURL('laurabraga', 'pokerweb.com.br', $secret);
echo '<img src="'.$qrcode.'" />';


/*
// GERAR
if(true){
}else{
  $code = '952299'; //código de 6 dígitos gerados pelo app do Google Authenticator
  if($auth->checkCode($secret, $code)){
    echo 'Autorizado!';
  }else{
    echo 'Código incorreto ou expirado!';
  }
}
*/








?>