aboutsummaryrefslogtreecommitdiff
path: root/captain/db.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2021-06-24 16:01:06 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2021-06-24 16:01:06 -0400
commite9460ea44fe7c11dc6d7d668ca9cd1b36418f097 (patch)
treea6f5a0c8f7380a8e242dd1e2782458cd66c7770e /captain/db.f90
parent3d7696972f5025be9612f87c0fe4203e0859641e (diff)
downloadlevitating-e9460ea44fe7c11dc6d7d668ca9cd1b36418f097.tar.gz
levitating-e9460ea44fe7c11dc6d7d668ca9cd1b36418f097.zip
Player tokens can now be set via web interface.
Diffstat (limited to 'captain/db.f90')
-rw-r--r--captain/db.f9025
1 files changed, 25 insertions, 0 deletions
diff --git a/captain/db.f90 b/captain/db.f90
index b789280..315bd10 100644
--- a/captain/db.f90
+++ b/captain/db.f90
@@ -146,6 +146,31 @@ contains
end subroutine update_player_token_db
+ function player_has_token_db(name)
+ implicit none
+
+ character(*), intent(in)::name
+ logical::player_has_token_db
+ type(sqlite3_stmt)::stmt
+
+ character(128)::tk
+
+ player_has_token_db = .false.
+
+ if(stmt%prepare(db, "SELECT token FROM players WHERE name=?") == SQLITE_OK) then
+ if(stmt%bind_text(1, name) == SQLITE_OK ) then
+ if(stmt%step() == SQLITE_ROW) then
+ call stmt%column_text(0, tk)
+ player_has_token_db = (trim(tk) /= "None")
+ end if
+ end if
+ end if
+ call stmt%finalize()
+
+
+ end function player_has_token_db
+
+
subroutine remove_player_db(name)
implicit none