X-Git-Url: http://git.pjr.cc/?p=ga4php.git;a=blobdiff_plain;f=example%2Findex.php;fp=example%2Findex.php;h=78caa960a2c2e4f85710012c8fab3630e154e0f4;hp=1699691ed1dcb11bcf4733ebe2364e520878d22e;hb=db6663c9a9c95424733e3b3c14822a4f0f654054;hpb=50ec224ca5ec919ee34e4b7482f1fb6c0c9cde75
diff --git a/example/index.php b/example/index.php
index 1699691..78caa96 100644
--- a/example/index.php
+++ b/example/index.php
@@ -1,6 +1,14 @@
@@ -13,14 +21,17 @@ if(isset($_REQUEST["action"])) {
case "createuser":
$username = $_REQUEST["username"];
$pr = preg_match('/^[a-zA-Z0-9@\.]+$/',"$username");
+ $ttype = $_REQUEST["ttype"];
echo "
";
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 {
- $url = $ga->setupUser($username);
- echo "QRCode for user \"$username\" is or type in $url (actually its just the code on the end of the url)";
+ $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)";
}
echo "
";
break;
@@ -43,9 +54,6 @@ if(isset($_REQUEST["action"])) {
echo "Failed!";
}
break;
- case "destroy":
- unlink("/tmp/gaexpage.db");
- break;
default:
// do nothing
}
@@ -57,7 +65,7 @@ if(isset($_REQUEST["action"])) {
Create a User: