require_once 'PHPGangsta/GoogleAuthenticator.php';
$ga = new PHPGangsta_GoogleAuthenticator();
$secret = "OWADPDDCLWMB2L56";
//$secret = $ga->createSecret();
//echo "Secret is: ".$secret."
\n";
$name = 'www.m-7.nl';
$qrCodeUrl = $ga->getQRCodeGoogleUrl($name, $secret);
//echo "Google Charts URL for the QR-Code: ".$qrCodeUrl."
\n";
echo "
\n";
echo "Secret: $secret
\n";
echo "$name
\n";
$TOTP = $ga->getCode($secret);
echo "TOTP $TOTP
\n";
//echo "NaN
\n";
echo "
\n";
/*
$checkResult = $ga->verifyCode($secret, $TOTP, 2); // 2 = 2*30sec clock tolerance
if ($checkResult) {
echo "OK
\n";
} else {
echo "FAILED
\n";
}
*/
?>