summaryrefslogtreecommitdiffstats
path: root/example.php
diff options
context:
space:
mode:
Diffstat (limited to 'example.php')
-rw-r--r--example.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/example.php b/example.php
new file mode 100644
index 0000000..1855972
--- /dev/null
+++ b/example.php
@@ -0,0 +1,28 @@
+<?php
+include_once("GoogleAuthenticator.php");
+
+$secret = 'XVQ2UIGO75XRUKJO';
+$time = floor(time() / 30);
+$code = "846474";
+
+$g = new GoogleAuthenticator();
+
+print "Current Code is: ";
+print $g->getCode($secret);
+
+print "\n";
+
+print "Check if $code is valid: ";
+
+if ($g->checkCode($secret,$code)) {
+ print "YES \n";
+} else {
+ print "NO \n";
+}
+
+$secret = $g->generateSecret();
+print "Get a new Secret: $secret \n";
+
+print "The QR Code for this secret (to scan with the Google Authenticator App: \n";
+print $g->getURL('chregu','example.org',$secret);
+print "\n"; \ No newline at end of file