minor mods to script
[ga4php.git] / example / old / tokenstore.php
1 <?php
2
3 // ok, so this will be our overloading class
4 require_once("../../lib/ga4php.php");
5
6 class myGoogleAuth extends GoogleAuthenticator {
7         
8         function getData($username) {
9                 global $dbobject;
10                 
11                 $res = $dbobject->query("select users_tokendata from users where users_username='$username'");
12                 foreach($res as $row) {
13                         $data = $row["users_tokendata"];
14                 }
15                 
16                 error_log("data was: $data");
17                 
18                 return $data;
19         }
20         
21         function putData($username, $data) {
22                 global $dbobject;
23                 
24                 $res = $dbobject->query("update users set users_tokendata='$data' where users_username='$username'");
25
26                 return $res;
27         }
28         
29         function getUsers() {
30                 global $dbobject;
31                 
32                 $res = $dbobject->query("select users_username from users");
33                 $i=0;
34                 $ar = array();
35                 
36                 foreach($res as $row) {
37                         $ar[$i] = $row["users_username"];
38                         $i++;
39                 }
40                 
41                 return $ar;
42         }
43 }
44
45 ?>