X-Git-Url: http://git.pjr.cc/?p=ga4php.git;a=blobdiff_plain;f=example%2Findex.php;h=ca6920314a4914e778b95dcf6ab922762dcb898d;hp=15c5adc7fae9b7dab7ba2410a6cabc4361f76852;hb=56b0dc03375e2a8facb8ff20c05d9be07dd6bcda;hpb=9b2752526f9f4bfac4831eb61fa63edd60117f77 diff --git a/example/index.php b/example/index.php index 15c5adc..ca69203 100644 --- a/example/index.php +++ b/example/index.php @@ -1,3 +1,56 @@ \ No newline at end of file +require_once("../lib/lib.php"); + +$ga = new GoogleAuthenticator("/tmp/gaexpage.db"); +?> + +

Example Page for GA4PHP

+ +"; + 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 "; + } + echo "
"; + break; + case "authuser": + $username = $_REQUEST["username"]; + $code = $_REQUEST["code"]; + if($ga->authenticateUser($username, $code)) { + echo "Passed!"; + } else { + echo "Failed!"; + } + break; + default: + // do nothing + } +} + +?> + +Create a User: +
+Username:
+Type (ignored for now):
+
+
+
+
+Username:
+Code:
+
+
+
+ \ No newline at end of file