fixed a minor thing with the hotp skew
[ga4php.git] / authserver / lib / lib.php
index cf4c39e..dbdd35f 100644 (file)
@@ -11,6 +11,8 @@ define("MSG_AUTH_USER_PASSWORD", 4);
 define("MSG_SET_USER_PASSWORD", 5);
 define("MSG_SET_USER_REALNAME", 6);
 define("MSG_SET_USER_TOKEN", 7);
+define("MSG_SET_USER_TOKEN_TYPE", 8);
+define("MSG_GET_USERS", 9);
 
 if(file_exists("../../lib/ga4php.php")) require_once("../../lib/ga4php.php");
 if(file_exists("../lib/ga4php.php")) require_once("../lib/ga4php.php");
@@ -42,6 +44,7 @@ function closeDatabase($db) {
 
 class gaasGA extends GoogleAuthenticator {
        function getData($username) {
+               echo "called into getdata\n";
                
                // get our database connection
                $dbObject = getDatabase();
@@ -53,14 +56,17 @@ class gaasGA extends GoogleAuthenticator {
                $result = $dbObject->query($sql);
                
                // check the result
+               echo "next1\n";
                if(!$result) return false;
                
                // now just retreieve all the data (there should only be one, but whatever)
+               echo "next2\n";
                $tokendata = false;
                foreach($result as $row) {
                        $tokendata = $row["users_tokendata"];
                }
-               
+
+               echo "next3, $username, $tokendata\n";
                // now we have our data, we just return it. If we got no data
                // we'll just return false by default
                return $tokendata;
@@ -75,7 +81,7 @@ class gaasGA extends GoogleAuthenticator {
                
                // we need to check if the user exists, and if so put the data, if not create the data
                $sql = "select * from users where users_username='$username'";
-               $res = $dbOject->query($sql);
+               $res = $dbObject->query($sql);
                if($res->fetchColumn() > 0) {
                        // do update
                        $sql = "update users set users_tokendata='$data' where users_username='$username'";
@@ -116,4 +122,4 @@ class gaasGA extends GoogleAuthenticator {
        }       
 }
 
-?>
\ No newline at end of file
+?>