This commit is contained in:
parent
1a3ac2353b
commit
631db58ff0
19
game.cgi
19
game.cgi
|
@ -13,6 +13,8 @@ game_id = get_game_id(user_id) or "[Not Set]"
|
|||
|
||||
word=os.getenv("QUERY_STRING").upper()
|
||||
|
||||
print("# Gemini Boggle")
|
||||
|
||||
conn=create_connection()
|
||||
with conn:
|
||||
cur = conn.cursor()
|
||||
|
@ -49,10 +51,20 @@ with conn:
|
|||
if i!=-1:
|
||||
if g[i]=='0':
|
||||
g[i]='1'
|
||||
|
||||
add_plays(game_id,user_id,words)
|
||||
|
||||
set_game_graph(game_id,','.join(g))
|
||||
|
||||
pw=get_words(game_id,user_id)
|
||||
if not pw:
|
||||
pw=word
|
||||
else:
|
||||
pw=pw.split(',')
|
||||
pw.append(word)
|
||||
pw=','.join(pw)
|
||||
|
||||
add_plays(game_id,user_id,pw)
|
||||
|
||||
|
||||
l=len(word)
|
||||
if l==3 or l==4: p=1
|
||||
elif l==5: p=2
|
||||
|
@ -107,7 +119,8 @@ if stats=='PLAY':
|
|||
elif stats=='STOP':
|
||||
print("game is finished")
|
||||
|
||||
print("=> new_game.cgi new game")
|
||||
print("=> list.cgi list")
|
||||
print("=> rank.cgi ranking")
|
||||
print("=> lobby.cgi lobby")
|
||||
print("=> login.cgi login")
|
||||
print("=> new_game.cgi new game")
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import random
|
||||
|
||||
from helpers import get_client_cert
|
||||
from db import *
|
||||
|
||||
TLS_CLIENT_HASH = get_client_cert()
|
||||
user_id = check_hash(TLS_CLIENT_HASH)
|
||||
user_name = get_name(user_id) or "[Not Set]"
|
||||
game_id = get_game_id(user_id)
|
||||
|
||||
print("# List")
|
||||
|
||||
print("=> game.cgi back to game")
|
||||
|
||||
conn=create_connection()
|
||||
with conn:
|
||||
cur = conn.cursor()
|
||||
cur.execute("SELECT name,words FROM users,plays WHERE plays.user_id=id and plays.game_id=?",(game_id,))
|
||||
rows = cur.fetchall()
|
||||
for row in rows:
|
||||
print("## "+row[0])
|
||||
print(row[1])
|
|
@ -8,6 +8,7 @@ from db import *
|
|||
TLS_CLIENT_HASH = get_client_cert()
|
||||
user_id = check_hash(TLS_CLIENT_HASH)
|
||||
user_name = get_name(user_id) or "[Not Set]"
|
||||
game_id = get_game_id(user_id)
|
||||
|
||||
print("# Lobby")
|
||||
|
||||
|
@ -15,9 +16,14 @@ print("username:",user_name)
|
|||
print("score:",get_score(user_id))
|
||||
print()
|
||||
|
||||
print("=> new_game.cgi new game")
|
||||
|
||||
|
||||
if game_id:
|
||||
print("=> game.cgi back to game")
|
||||
|
||||
print("=> rank.cgi ranking")
|
||||
print("=> login.cgi login")
|
||||
print("=> new_game.cgi new game")
|
||||
|
||||
print()
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ from db import *
|
|||
TLS_CLIENT_HASH = get_client_cert()
|
||||
user_id = check_hash(TLS_CLIENT_HASH)
|
||||
user_name = get_name(user_id) or "[Not Set]"
|
||||
game_id = get_game_id(user_id)
|
||||
|
||||
print("# Welcome: User Logged In")
|
||||
print()
|
||||
|
@ -29,8 +30,11 @@ print("=> update-auth-code.cgi Generate an auth code to add another cert to your
|
|||
print("=> add-cert.cgi Add another cert to your account (with auth code)")
|
||||
print()
|
||||
|
||||
print("=> new_game.cgi new game")
|
||||
if game_id:
|
||||
print("=> game.cgi back to game")
|
||||
|
||||
print("=> rank.cgi ranking")
|
||||
print("=> lobby.cgi lobby")
|
||||
print("=> new_game.cgi new game")
|
||||
|
||||
#vim:fenc=utf-8:ts=4:sw=4:sta:noet:sts=4:fdm=marker:ai
|
||||
|
|
7
rank.cgi
7
rank.cgi
|
@ -8,10 +8,15 @@ from db import *
|
|||
TLS_CLIENT_HASH = get_client_cert()
|
||||
user_id = check_hash(TLS_CLIENT_HASH)
|
||||
user_name = get_name(user_id) or "[Not Set]"
|
||||
game_id = get_game_id(user_id)
|
||||
|
||||
if game_id:
|
||||
print("=> game.cgi back to game")
|
||||
|
||||
|
||||
print("=> new_game.cgi new game")
|
||||
print("=> lobby.cgi lobby")
|
||||
print("=> login.cgi login")
|
||||
print("=> new_game.cgi new game")
|
||||
|
||||
conn=create_connection()
|
||||
with conn:
|
||||
|
|
Loading…
Reference in New Issue