X-Git-Url: http://git.pjr.cc/?p=ga4php.git;a=blobdiff_plain;f=authserver%2Fauthd%2Fauthd.php;h=67036a7ec754139e35d35627bd109ba99e5e494f;hp=3f723e59ab546a20939c46d62ff73f4bd4dc5981;hb=1e9b1b3a5c4dd1f033ae5f3145d7bb7bcd73a4d6;hpb=e2e22b45b14cae630587bc662a8bfcda98b04510 diff --git a/authserver/authd/authd.php b/authserver/authd/authd.php index 3f723e5..67036a7 100644 --- a/authserver/authd/authd.php +++ b/authserver/authd/authd.php @@ -48,7 +48,26 @@ if($pid == -1) { $authval = $myga->authenticateUser($username, $passcode); msg_send($cl_queue, MSG_AUTH_USER_TOKEN, $authval); break; - + case MSG_GET_OTK_ID: + if(!isset($msg["username"])) { + msg_send($cl_queue, MSG_GET_OTK_ID, false); + } else { + $username = $msg["username"]; + $sql = "select users_otk from users where users_username='$username'"; + $dbo = getDatabase(); + $res = $dbo->query($sql); + $otkid = ""; + foreach($res as $row) { + $otkid = $row["users_otk"]; + } + + if($otkid == "") { + msg_send($cl_queue, MSG_GET_OTK_ID, false); + } else { + msg_send($cl_queue, MSG_GET_OTK_ID, $otkid); + } + } + break; case MSG_GET_OTK_PNG: if(!isset($msg["otk"])) { msg_send($cl_queue, MSG_GET_OTK_PNG, false); @@ -64,6 +83,8 @@ if($pid == -1) { if($username == "") { msg_send($cl_queue, MSG_GET_OTK_PNG, false); + } else if($username != $msg["username"]) { + msg_send($cl_queue, MSG_GET_OTK_PNG, false); } else { $hand = fopen("otks/$otk.png", "rb"); $data = fread($hand, filesize("otks/$otk.png"));