From 925e8f408e16294f55bffbdfc12ab4fbd7cc41ed Mon Sep 17 00:00:00 2001 From: paulr Date: Wed, 17 Nov 2010 00:49:47 +1100 Subject: [PATCH] moving the old example out of the way for now --- example/index.php | 179 -------------------------------------------- example/old/index.php | 179 ++++++++++++++++++++++++++++++++++++++++++++ example/old/tokenstore.php | 45 +++++++++++ example/tokenstore.php | 45 ----------- 4 files changed, 224 insertions(+), 224 deletions(-) delete mode 100644 example/index.php create mode 100644 example/old/index.php create mode 100644 example/old/tokenstore.php delete mode 100644 example/tokenstore.php diff --git a/example/index.php b/example/index.php deleted file mode 100644 index d70e542..0000000 --- a/example/index.php +++ /dev/null @@ -1,179 +0,0 @@ -query($sql); -} - - -require_once("tokenstore.php"); - -$ga = new myGoogleAuth(); - - - - -?> - -

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->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', '$fullname', '0')"; - $dbobject->query($sql); - } - echo "
"; - break; - case "provisiontoken": - error_log("in provision"); - $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"]; - if($ga->authenticateUser($username, $code)) { - echo "Passed!"; - } else { - echo "Failed!"; - } - break; - case "resync": - $username = $_REQUEST["username"]; - $code1 = $_REQUEST["code1"]; - $code2 = $_REQUEST["code2"]; - if($ga->resyncCode($username, $code1, $code2)) { - echo "Passed!"; - } else { - echo "Failed!"; - } - break; - default: - // do nothing - } -} - -?> -

Our Users

- - -query("select * from users"); -foreach($res as $row) { - $username = $row["users_username"]; - $fullname = $row["users_fullname"]; - echo ""; -} - -?> -
UsernameFullName
$username$fullname
-

Destroy the DB

-This is not UNDOABLE - but this is a test system, so you dont care - -

Create a User:

-
-Username:
-Full Name:
-
-
- - -
- - -

Provision Token

-
-Username:
-Type:
-
-
- - -
- - -

Test Token

-
-Username:
-Code:
-
-
- - -
- - -

Resync Code (only valid for HOTP codes)

-
-Username:
-Code one:
-Code two:
-
-
-
- \ No newline at end of file diff --git a/example/old/index.php b/example/old/index.php new file mode 100644 index 0000000..d70e542 --- /dev/null +++ b/example/old/index.php @@ -0,0 +1,179 @@ +query($sql); +} + + +require_once("tokenstore.php"); + +$ga = new myGoogleAuth(); + + + + +?> + +

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->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', '$fullname', '0')"; + $dbobject->query($sql); + } + echo "
"; + break; + case "provisiontoken": + error_log("in provision"); + $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"]; + if($ga->authenticateUser($username, $code)) { + echo "Passed!"; + } else { + echo "Failed!"; + } + break; + case "resync": + $username = $_REQUEST["username"]; + $code1 = $_REQUEST["code1"]; + $code2 = $_REQUEST["code2"]; + if($ga->resyncCode($username, $code1, $code2)) { + echo "Passed!"; + } else { + echo "Failed!"; + } + break; + default: + // do nothing + } +} + +?> +

Our Users

+ + +query("select * from users"); +foreach($res as $row) { + $username = $row["users_username"]; + $fullname = $row["users_fullname"]; + echo ""; +} + +?> +
UsernameFullName
$username$fullname
+

Destroy the DB

+This is not UNDOABLE - but this is a test system, so you dont care + +

Create a User:

+
+Username:
+Full Name:
+
+
+ + +
+ + +

Provision Token

+
+Username:
+Type:
+
+
+ + +
+ + +

Test Token

+
+Username:
+Code:
+
+
+ + +
+ + +

Resync Code (only valid for HOTP codes)

+
+Username:
+Code one:
+Code two:
+
+
+
+ \ No newline at end of file diff --git a/example/old/tokenstore.php b/example/old/tokenstore.php new file mode 100644 index 0000000..97b8ae7 --- /dev/null +++ b/example/old/tokenstore.php @@ -0,0 +1,45 @@ +query("select users_tokendata from users where users_username='$username'"); + foreach($res as $row) { + $data = $row["users_tokendata"]; + } + + error_log("data was: $data"); + + return $data; + } + + function putData($username, $data) { + global $dbobject; + + $res = $dbobject->query("update users set users_tokendata='$data' where users_username='$username'"); + + return $res; + } + + function getUsers() { + global $dbobject; + + $res = $dbobject->query("select users_username from users"); + $i=0; + $ar = array(); + + foreach($res as $row) { + $ar[$i] = $row["users_username"]; + $i++; + } + + return $ar; + } +} + +?> diff --git a/example/tokenstore.php b/example/tokenstore.php deleted file mode 100644 index 97b8ae7..0000000 --- a/example/tokenstore.php +++ /dev/null @@ -1,45 +0,0 @@ -query("select users_tokendata from users where users_username='$username'"); - foreach($res as $row) { - $data = $row["users_tokendata"]; - } - - error_log("data was: $data"); - - return $data; - } - - function putData($username, $data) { - global $dbobject; - - $res = $dbobject->query("update users set users_tokendata='$data' where users_username='$username'"); - - return $res; - } - - function getUsers() { - global $dbobject; - - $res = $dbobject->query("select users_username from users"); - $i=0; - $ar = array(); - - foreach($res as $row) { - $ar[$i] = $row["users_username"]; - $i++; - } - - return $ar; - } -} - -?> -- 1.7.0.4