|
|
|
@ -73,7 +73,7 @@ def get_player(player_id): |
|
|
|
cur = con.cursor() |
|
|
|
|
|
|
|
cur.execute("""select id,firstname,name,ban_end from players |
|
|
|
where id=(?)""", [player_id]) |
|
|
|
where id=%i"""% [player_id]) |
|
|
|
|
|
|
|
row = cur.fetchone() |
|
|
|
con.close() |
|
|
|
@ -88,7 +88,7 @@ def get_player_from_ip(ip): |
|
|
|
machines.id,machines.ip,players.ban_end |
|
|
|
from players |
|
|
|
inner join machines on players.id=machines.player_id |
|
|
|
where machines.ip=(?)""", [ip]) |
|
|
|
where machines.ip=%s"""% [ip]) |
|
|
|
|
|
|
|
row = cur.fetchone() |
|
|
|
con.close() |
|
|
|
@ -109,7 +109,7 @@ def get_player_from_full_name(firstname, name): |
|
|
|
machines.id,machines.ip,players.ban_end |
|
|
|
from players |
|
|
|
inner join machines on players.id=machines.player_id |
|
|
|
where players.firstname=(?) and players.name=(?)""", [firstname, name]) |
|
|
|
where players.firstname=%s and players.name=%s"""% [firstname, name]) |
|
|
|
|
|
|
|
row = cur.fetchone() |
|
|
|
con.close() |
|
|
|
@ -125,7 +125,7 @@ def is_banned(user_id): |
|
|
|
con = connect_sql() |
|
|
|
cur = con.cursor() |
|
|
|
|
|
|
|
cur.execute("""select ban_end from players where id=(?)""", [user_id]) |
|
|
|
cur.execute("""select ban_end from players where id=%i"""% [user_id]) |
|
|
|
|
|
|
|
ban_end = cur.fetchone()[0] |
|
|
|
con.close() |
|
|
|
@ -153,7 +153,7 @@ def get_players_not_banned(): |
|
|
|
cur = con.cursor() |
|
|
|
|
|
|
|
cur.execute("""select id,firstname,name from players |
|
|
|
where (?) > ban_end """, [time()]) |
|
|
|
where %f > ban_end """% [time()]) |
|
|
|
|
|
|
|
rows = cur.fetchall() |
|
|
|
con.close() |
|
|
|
@ -201,7 +201,7 @@ def ban(player_id, target_id, success): |
|
|
|
cur = con.cursor() |
|
|
|
|
|
|
|
cur.execute("""select id,ban_end from players |
|
|
|
where id=(?)""", [banned_player['id']]) |
|
|
|
where id=%i"""% [banned_player['id']]) |
|
|
|
|
|
|
|
con.commit() |
|
|
|
con.close() |
|
|
|
@ -211,8 +211,8 @@ def ban(player_id, target_id, success): |
|
|
|
ban_end = cur.fetchone()[0] |
|
|
|
ban_end = time() + BAN_DURATION |
|
|
|
|
|
|
|
cur.execute("""update players set ban_end=(?) |
|
|
|
where id=(?)""", [ban_end, banned_player['id']]) |
|
|
|
cur.execute("""update players set ban_end=%f |
|
|
|
where id=%i"""% [ban_end, banned_player['id']]) |
|
|
|
|
|
|
|
|
|
|
|
con.commit() |
|
|
|
@ -220,7 +220,7 @@ def ban(player_id, target_id, success): |
|
|
|
con = connect_sql() |
|
|
|
cur = con.cursor() |
|
|
|
cur.execute("""insert into bans (player_id,target_id,success,time) |
|
|
|
values (?,?,?,?)""", [player['id'], target['id'], \ |
|
|
|
values %i,%i,%i,%f"""% [player['id'], target['id'], \ |
|
|
|
success and 1 or 0, time()]) |
|
|
|
con.commit() |
|
|
|
con.close() |
|
|
|
@ -230,8 +230,8 @@ def unban(player_id): |
|
|
|
con = connect_sql() |
|
|
|
cur = con.cursor() |
|
|
|
|
|
|
|
cur.execute("""update players set ban_end=(?) |
|
|
|
where id=(?)""", [time() - BAN_DURATION, player_id]) |
|
|
|
cur.execute("""update players set ban_end=%f |
|
|
|
where id=%i"""% [time() - BAN_DURATION, player_id]) |
|
|
|
|
|
|
|
con.commit() |
|
|
|
con.close() |
|
|
|
@ -241,9 +241,7 @@ def get_bans(player_id): |
|
|
|
cur = con.cursor() |
|
|
|
|
|
|
|
# Bannissements concernant le joueur : |
|
|
|
cur.execute("""select player_id,target_id,success,time from bans |
|
|
|
where target_id=(?) |
|
|
|
or player_id=(?)""", [player_id, player_id]) |
|
|
|
cur.execute("""select player_id,target_id,success,time from bans where target_id=%i or player_id=%i""" % (player_id, player_id)) |
|
|
|
|
|
|
|
rows = cur.fetchall() |
|
|
|
con.close() |
|
|
|
@ -312,7 +310,7 @@ def banned_ip(): |
|
|
|
|
|
|
|
cur.execute("""select machines.ip from players |
|
|
|
inner join machines on players.id=machines.player_id |
|
|
|
where players.ban_end>(?)""", [time()]) |
|
|
|
where players.ban_end>%f"""% [time()]) |
|
|
|
|
|
|
|
rows = cur.fetchall() |
|
|
|
con.close() |
|
|
|
|