X-Git-Url: http://git.pjr.cc/?p=ga4php.git;a=blobdiff_plain;f=example%2Findex.php;fp=example%2Findex.php;h=b750dbc53f99b3b77b1a36d5462962e35d818048;hp=78caa960a2c2e4f85710012c8fab3630e154e0f4;hb=30d86631e9cf0adda2fc14c01ea1bcc6c91356bf;hpb=f88ed4325723f38ed064d4abb07485ab990e6464
diff --git a/example/index.php b/example/index.php
index 78caa96..b750dbc 100644
--- a/example/index.php
+++ b/example/index.php
@@ -1,19 +1,42 @@
query($sql);
+}
+
-$ga = new GoogleAuthenticator("/tmp/gaexpage.db");
?>
Example Page for GA4PHP
+home
";
if(strlen($username)<3) {
echo "Sorry, username must be at least 3 chars";
} else if($pr<1) {
echo "Sorry, username can only contain a-z, A-Z, 0-9 @ and .";
} else {
- $key = $ga->setupUser($username, $ttype);
- $keyinhex = $ga->helperb322hex($key);
- $url = urlencode($ga->createURL($username, $key, $ttype));
- echo "QRCode for user \"$username\" is or type in $key (google authenticator) or $keyinhex (for most other otp's)";
+ //$key = $ga->setUser($username, "", $ttype);
+ //$keyinhex = $ga->helperb322hex($key);
+ //$url = urlencode($ga->createURL($username, $key, $ttype));
+ //echo "QRCode for user \"$username\" is or type in $key (google authenticator) or $keyinhex (for most other otp's)";
+ $sql = "insert into users values (NULL, '$username', 'TOTP', 'ASDF', '0')";
+ $dbobject->query($sql);
}
echo "
";
break;
+ case "provisiontoken":
+ $username = $_REQUEST["username"];
+ $ttype = $_REQUEST["ttype"];
+ $key = $ga->setUser($username, "", $ttype);
+ $keyinhex = $ga->helperb322hex($key);
+ $url = urlencode($ga->createURL($username, $key, $ttype));
+ echo "QRCode for user \"$username\" is or type in $key (google authenticator) or $keyinhex (for most other otp's), $ttype";
+ break;
case "authuser":
$username = $_REQUEST["username"];
$code = $_REQUEST["code"];
@@ -65,6 +97,19 @@ if(isset($_REQUEST["action"])) {
Create a User:
+
+Provision Token
+