<?php

session_start();
include "FixedBitNotation.php";
include "GoogleAuthenticator.php";
$Auth = new GAuthen();
$New_Secret = $Auth->generateSecret();
$BarcodeURL = $Auth->getURL('', 'local', $New_Secret);
$_SESSION['SecretCode'] = $New_Secret;
?>
	<a href="Setup.php">Setup</a> | <a href="index.php">Main</a>
	
	<br><br><br><br>
Manual Account Setup: <?php 
echo $New_Secret;
?>
 <br><br>

Setup Via Barcode: <br>
	<img src="<?php 
echo $BarcodeURL;
?>
" height="200" width="200"></img>
<?php

session_start();
include "FixedBitNotation.php";
include "GoogleAuthenticator.php";
$Auth = new GAuthen();
if (!isset($_POST['Submit'])) {
    header("Location: index.php");
    exit;
}
echo $_SESSION['SecretCode'];
echo "<br><bR>";
echo $_POST['Code'];
echo "<br><br>";
echo $Auth->getCode($_SESSION['SecretCode']);
echo "<bR><br>";
if ($Auth->checkCode($_SESSION['SecretCode'], $_POST['Code'])) {
    echo "Successfully Authenticated";
} else {
    echo "Problem With Authentication. Please Ensure you have entered the correct Key";
}