T'étais sur le net..

This commit is contained in:
Metzthernets 2018-01-13 00:30:16 +01:00 committed by root
parent cbdab94c97
commit 728464bfa0
31 changed files with 78 additions and 138 deletions

2
README
View file

@ -1,4 +1,4 @@
Le serveur a besoin des droits en écriture sur la base SQLite3 et le répertoire Le serveur a besoin des droits en écriture sur la base SQLite3 et le répertoire
la contenant. la contenant.
Histoire : bbc -> lhark -> guimoz Histoire : bbc -> lhark -> guimoz -> Klafyvel + volgarr + Yoann

View file

@ -1,2 +1,4 @@
Luc Absil Luc Absil
Louis-Guillaume Dubois Matthieu Michelet
Clara Husson
Melchior Garapin

View file

@ -8,28 +8,37 @@ def connect_sql():
passwd="q5kBLchS6ooAZDSxMeJG2gdf4gmJcfS5", # your password passwd="q5kBLchS6ooAZDSxMeJG2gdf4gmJcfS5", # your password
db="roulette") # name of the data base db="roulette") # name of the data base
def process():
# Connexion à la base SQLite locale
con = connect_sql()
cur = con.cursor()
print("Drop tables")
cur.execute('''drop table if exists players''')
cur.execute('''drop table if exists machines''')
print("create tables")
cur.execute('''create table players (id int,firstname text,name text, ban_end float)''')
cur.execute('''create table machines (id int,player_id int,ip text)''')
print("select players")
cur.execute("""select id from players""")
players = cur.fetchall()
players = [player[0] for player in players]
# Connexion à la base SQLite locale print("select machines")
con = connect_sql() cur.execute("""select ip from machines""")
cur = con.cursor() machines = cur.fetchall()
# cur.execute('''create table players (id,prenom,nom, etat)''') machines = [machine[0] for machine in machines]
# cur.execute('''create table machines (id,uid_user,ip)''') u = User.objects.filter(school=1)
cur.execute("""select id from players""") print("Let's go !!!")
players = cur.fetchall() for x,user in enumerate(u):
players = [player[0] for player in players] print("Avancement : {}%".format(round(x/len(u)*100, 2)), end="\r")
cur.execute("""select ip from machines""")
machines = cur.fetchall()
machines = [machine[0] for machine in machines]
for user in User.objects.filter(school=1):
if user.has_access() and (user.is_adherent() or user.end_adhesion()): if user.has_access() and (user.is_adherent() or user.end_adhesion()):
if user.uid_number not in players: if user.uid_number not in players:
cur.execute("""insert into players values (?,?,?,?)""",(user.uid_number, user.name, user.surname, 0)) s = """insert into players values ({},"{}","{}",{});""".format(user.uid_number, user.name, user.surname, 0)
print(user.surname+' '+user.name) cur.execute(s)
for m in Machine.objects.filter(user= user): for m in Machine.objects.filter(user= user):
for i in Interface.objects.filter(machine = m): for i in Interface.objects.filter(machine = m):
if i.ipv4.ipv4 not in machines: if i.ipv4.ipv4 not in machines:
cur.execute("""insert into machines values (?,?,?) """,(i.id, user.uid_number, i.ipv4.ipv4)) s = """insert into machines values ({},{},"{}") ;""".format(i.id, user.uid_number, i.ipv4.ipv4)
cur.execute(s)
con.close() con.commit()
con.close()

View file

@ -171,8 +171,8 @@ def get_players_not_banned():
def cheat(player_id, target_id): def cheat(player_id, target_id):
success = random.choice([True, False]) success = random.choice([True, False])
try: try:
# ok = [line.strip().partition(' ') for line in IMMUNITY] ok = [line.strip().partition(' ') for line in IMMUNITY]
# ok = [get_player_from_full_name(names[0], names[2])['id'] for names in ok] ok = [get_player_from_full_name(names[0], names[2])['id'] for names in ok]
ko = [line.strip().partition(' ') for line in ASSHOLES] ko = [line.strip().partition(' ') for line in ASSHOLES]
ko = [get_player_from_full_name(names[0], names[2])['id'] for names in ko] ko = [get_player_from_full_name(names[0], names[2])['id'] for names in ko]
@ -181,8 +181,8 @@ def cheat(player_id, target_id):
success = True success = True
elif player_id in ko: elif player_id in ko:
success = False success = False
# elif target_id in ok: elif target_id in ok:
# success = False success = False
except TypeError: except TypeError:
pass pass

2
state
View file

@ -1 +1 @@
down up

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

1
static/img/banner.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

0
static/style.cs Normal file
View file

View file

@ -1,5 +1,5 @@
body { body {
background: #3b5998; background: #2ecc71;
color: white; color: white;
text-align: center; text-align: center;
font-family: helvetica, sans; font-family: helvetica, sans;
@ -19,8 +19,8 @@ a {
} }
#banner { #banner {
height: 301px; height: 100px;
background: center center url('img/metzquetaires_or.png') no-repeat; background: center center url('img/banner.svg') no-repeat;
padding: 10px 10px; padding: 10px 10px;
} }
@ -34,45 +34,7 @@ a {
padding-right: 12px; padding-right: 12px;
padding-top: 10px; padding-top: 10px;
padding-bottom: 10px; padding-bottom: 10px;
} border-radius:10px;
#content_container div.corner {
height: 70px;
width: 70px;
background-repeat: no-repeat;
position: absolute;
}
#content_topleft {
top: 0px;
left: 0px;
background-image: url('img/corner_topleft.png');
background-color: #3b5998;
z-index: 1;
}
#content_topright {
top: 0px;
right: 0px;
background-image: url('img/corner_topright.png');
background-color: #3b5998;
z-index: 2;
}
#content_bottomleft {
bottom: 0px;
left: 0px;
background-image: url('img/corner_bottomleft.png');
background-color: #3b5998;
z-index: 3;
}
#content_bottomright {
bottom: 0px;
right: 0px;
background-image: url('img/corner_bottomright.png');
background-color: #3b5998;
z-index: 4;
} }
#content { #content {

View file

@ -29,7 +29,7 @@ $(function () {
plotShadow: false plotShadow: false
}, },
title: { title: {
text: 'Etat du Rezo', text: 'État du Rézo',
align: 'center', align: 'center',
verticalAlign: 'middle', verticalAlign: 'middle',
y: 60 y: 60
@ -54,7 +54,7 @@ $(function () {
}, },
series: [{ series: [{
type: 'pie', type: 'pie',
name: 'Pourcentage', name: 'État du Rézo',
innerSize: '50%', innerSize: '50%',
data: [ data: [
{ {

View file

@ -2,11 +2,7 @@
{% block content %} {% block content %}
<h2>Toi aussi, joue au rézoman !</h2> <h2>Toi aussi, joue au rézoman !</h2>
<p> <p>
La rezo-roulette metzquetaire vous offre un répit temporaire. Profite bien {{ user['firstname']+' '+user['name'] }} ;-) La Rézoroulette Metzthernet vous offre un répit temporaire. Profite bien {{ user['firstname']+' '+user['name'] }} ;-)
</p>
<p>
Rétablissement de la roulette vers midi.
</p> </p>
<div id="container" style="min-width: 310px; max-width: 600px; margin: 0 auto"></div> <div id="container" style="min-width: 310px; max-width: 600px; margin: 0 auto"></div>
@ -35,7 +31,7 @@ $(function () {
plotShadow: false plotShadow: false
}, },
title: { title: {
text: 'Etat du Rezo', text: 'État du Rézo',
align: 'center', align: 'center',
verticalAlign: 'middle', verticalAlign: 'middle',
y: 60 y: 60
@ -60,7 +56,7 @@ $(function () {
}, },
series: [{ series: [{
type: 'pie', type: 'pie',
name: 'Pourcentage', name: 'État du Rézo',
innerSize: '50%', innerSize: '50%',
data: [ data: [
{ {

View file

@ -1,7 +1,7 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% block content %} {% block content %}
<br> <br>
<h2>Toi aussi, joue au rézoman avec la rezo-roulette Les Metzquetaires !</h2> <h2>plop lolilol babeuloula</h2>
<p id="play" style="text-align: center; font-size: 1.5em"> <p id="play" style="text-align: center; font-size: 1.5em">
<a href="{{url_for('play')}}">Jouer</a> <a href="{{url_for('play')}}">Jouer</a>
</p> </p>
@ -32,7 +32,7 @@
plotShadow: false plotShadow: false
}, },
title: { title: {
text: 'Etat du Rezo', text: 'État du Rézo',
align: 'center', align: 'center',
verticalAlign: 'middle', verticalAlign: 'middle',
y: 60 y: 60
@ -57,7 +57,7 @@
}, },
series: [{ series: [{
type: 'pie', type: 'pie',
name: 'Etat du Rezo', name: 'État du Rézo',
innerSize: '50%', innerSize: '50%',
data: [ data: [
{ {

View file

@ -1,10 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>Rezo-roulette Metzquetaires</title> <title>Rézoroulette Metzthernet</title>
<meta http-equiv="content-type" <meta charset="utf-8"/>
content="text/html;charset=utf-8" />
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" /> <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" />
<script type="text/javascript" src="{{ url_for('static', filename='javascript.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='javascript.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='highcharts.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='highcharts.js') }}"></script>
@ -19,10 +17,6 @@
</div> </div>
<div id="content_container"> <div id="content_container">
<div id="content_topleft" class="corner">
</div>
<div id="content_topright" class="corner">
</div>
<div id="content"> <div id="content">
{% with messages = get_flashed_messages() %} {% with messages = get_flashed_messages() %}
{% if messages %} {% if messages %}
@ -35,11 +29,7 @@
{% endwith %} {% endwith %}
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>
<div id="content_bottomleft" class="corner"> <div id="footer">Contact technique : <a href="mailto:metzthernet@gmail.com">metzthernet@gmail.com</a></div>
</div>
<div id="content_bottomright" class="corner">
</div>
<div id="footer">contact technique : <a href="mailto:roulette@metzquetaires.fr">roulette@metzquetaires.fr</a></div>
</div> </div>
</div> </div>
</body> </body>

View file

@ -1,10 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>Rezo-roulette Metzquetaires</title> <title>Rézoroulette Metzthernet</title>
<meta http-equiv="content-type" <meta charset="utf-8"/>
content="text/html;charset=utf-8" />
<meta http-equiv="refresh" content="60"> <meta http-equiv="refresh" content="60">
<link rel="stylesheet" href="{{ url_for('static', filename='style_red.css') }}" /> <link rel="stylesheet" href="{{ url_for('static', filename='style_red.css') }}" />
<script type="text/javascript" src="{{ url_for('static', filename='javascript.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='javascript.js') }}"></script>
@ -20,10 +18,6 @@
</div> </div>
<div id="content_container"> <div id="content_container">
<div id="content_topleft" class="corner">
</div>
<div id="content_topright" class="corner">
</div>
<div id="content"> <div id="content">
{% with messages = get_flashed_messages() %} {% with messages = get_flashed_messages() %}
{% if messages %} {% if messages %}
@ -36,11 +30,7 @@
{% endwith %} {% endwith %}
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>
<div id="content_bottomleft" class="corner"> <div id="footer">Contact technique : <a href="mailto:metzthernet@gmail.com">metzthernet@gmail.com</a></div>
</div>
<div id="content_bottomright" class="corner">
</div>
<div id="footer">contact technique : <a href="mailto:roulette@metzquetaires.fr">roulette@metzquetaires.fr</a></div>
</div> </div>
</div> </div>
</body> </body>

View file

@ -1,10 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>Rezo-roulette</title> <title>Rézoroulette</title>
<meta http-equiv="content-type" <meta charset="utf-8" />
content="text/html;charset=utf-8" />
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" /> <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" />
<script type="text/javascript" src="{{ url_for('static', filename='javascript.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='javascript.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='highcharts.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='highcharts.js') }}"></script>
@ -17,10 +15,6 @@
<div id="body_bis"> <div id="body_bis">
<div id="content_container"> <div id="content_container">
<div id="content_topleft" class="corner">
</div>
<div id="content_topright" class="corner">
</div>
<div id="content"> <div id="content">
{% with messages = get_flashed_messages() %} {% with messages = get_flashed_messages() %}
{% if messages %} {% if messages %}
@ -33,10 +27,6 @@
{% endwith %} {% endwith %}
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>
<div id="content_bottomleft" class="corner">
</div>
<div id="content_bottomright" class="corner">
</div>
</div> </div>
</div> </div>
</body> </body>

View file

@ -17,7 +17,7 @@ $(function () {
plotShadow: false plotShadow: false
}, },
title: { title: {
text: 'Etat du Rezo', text: 'État du Rézo',
align: 'center', align: 'center',
verticalAlign: 'middle', verticalAlign: 'middle',
y: 60 y: 60
@ -42,7 +42,7 @@ $(function () {
}, },
series: [{ series: [{
type: 'pie', type: 'pie',
name: 'Etat du Rezo', name: 'État du Rézo',
innerSize: '50%', innerSize: '50%',
data: [ data: [
{ {

View file

@ -30,7 +30,7 @@ $(function () {
plotShadow: false plotShadow: false
}, },
title: { title: {
text: 'Etat du Rezo', text: 'État du Rézo',
align: 'center', align: 'center',
verticalAlign: 'middle', verticalAlign: 'middle',
y: 60 y: 60
@ -55,7 +55,7 @@ $(function () {
}, },
series: [{ series: [{
type: 'pie', type: 'pie',
name: 'Etat du Rezo', name: 'État du Rézo',
innerSize: '50%', innerSize: '50%',
data: [ data: [
{ {

View file

@ -1,8 +1,8 @@
{% extends "layout_precampagne.html" %} {% extends "layout_precampagne.html" %}
{% block content %} {% block content %}
<h2>Pas de précampagne!</h2> <h2>Pas de précampagne !</h2>
<p> <p>
Reviens plus tard {{ user['firstname']+' '+user['name'] }} pour jouer à la rezo-roulette Reviens plus tard {{ user['firstname']+' '+user['name'] }} pour jouer à la Rézoroulette.
</p> </p>
<div id="container" style="min-width: 310px; max-width: 600px; margin: 0 auto"></div> <div id="container" style="min-width: 310px; max-width: 600px; margin: 0 auto"></div>
<script type="text/javascript"> <script type="text/javascript">
@ -14,7 +14,7 @@ $(function () {
plotShadow: false plotShadow: false
}, },
title: { title: {
text: 'Etat du Rezo', text: 'État du Rézo',
align: 'center', align: 'center',
verticalAlign: 'middle', verticalAlign: 'middle',
y: 60 y: 60
@ -39,7 +39,7 @@ $(function () {
}, },
series: [{ series: [{
type: 'pie', type: 'pie',
name: 'Etat du Rezo', name: 'État du Rézo',
innerSize: '50%', innerSize: '50%',
data: [ data: [
{ {