-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.php
283 lines (229 loc) · 11 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<?php
// ------------------- CONTROLLER -------------------
session_start();
require_once('system/data.php');
if(isset($_SESSION['userid']) && time() < strtotime('2019-12-11 08:00')){
$user = mysqli_fetch_assoc(get_user_by_id($_SESSION['userid']));
$user_id = $user['id'];
}else{
header('Location: login.php');
}
// ---------------------- VIEW ----------------------
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Bundesraten</title>
<!-- Bootstrap Verlinkung -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="css/control.css">
<script src="js/control.js"></script>
</head>
<body>
<div class="container">
<!-- einfaches Bootstrap-Menü -->
<nav class="navbar navbar-expand-lg navbar-dark bg-secondary">
<a class="navbar-brand" href="index.php">Bundesraten</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="login.php">Logout</a>
</li>
</ul>
</div>
</nav>
<section class="content">
<?php if (does_tipp_exist($user_id)) { ?>
<div class="alert alert-info msg" role="alert">
Du hast deinen Tipp bereits abgegeben.
</div>
<div id="tipped">
<h1>Dein Tipp</h1>
<ul>
<li>Tipp 1: <b><span id="tipp1"></span></b> mit <span id="tipp1stimmen"></span> Stimmen</li>
<li>Tipp 2: <b><span id="tipp2"></span></b> mit <span id="tipp2stimmen"></span> Stimmen</li>
<li>Tipp 3: <b><span id="tipp3"></span></b> mit <span id="tipp3stimmen"></span> Stimmen</li>
<li>Tipp 4: <b><span id="tipp4"></span></b> mit <span id="tipp4stimmen"></span> Stimmen</li>
<li>Tipp 5: <b><span id="tipp5"></span></b> mit <span id="tipp5stimmen"></span> Stimmen</li>
<li>Tipp 6: <b><span id="tipp6"></span></b> mit <span id="tipp6stimmen"></span> Stimmen</li>
<li>Tipp 7: <b><span id="tipp7"></span></b> mit <span id="tipp7stimmen"></span> Stimmen</li>
</ul>
</div>
<?php } else { ?>
<!-- START Exposition Bundesräte -->
<h1>Tipp abgeben</h1>
<p class="mb-3"> Folgende Kandidatinnen und Kandidaten stehen zur Wahl: </p>
<div class="container">
<div class="row mb-5">
<div class="col-sm-3">
<div class="card">
<img src="img/amherd.jpg" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Viola Amherd</h5>
<p>Bundesrätin seit 2019, CVP/VS</p>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="card">
<img src="img/parmelin.jpg" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Guy Parmelin</h5>
<p>Bundesrat seit 2016, SVP/VD</p>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="card">
<img src="img/sommaruga.jpg" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Simonetta Sommaruga</h5>
<p>Bundesrätin seit 2010, SP/BE</p>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="card">
<img src="img/maurer.jpg" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Ueli Maurer</h5>
<p>Bundesrat seit 2009, SVP/ZH</p>
</div>
</div>
</div>
</div>
<div class="row mb-5">
<div class="col-sm-3">
<div class="card">
<img src="img/berset.jpg" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Alain Berset</h5>
<p>Bundesrat seit 2012, SP/FR</p>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="card">
<img src="img/cassis.png" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Ignazio Cassis</h5>
<p>Bundesrat seit 2017, FDP/TI</p>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="card">
<img src="img/kellersutter.jpg" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Karin Keller-Sutter</h5>
<p>Bundesrätin seit 2019, FDP/SG</p>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="card">
<img src="img/rytz.jpg" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Regula Rytz</h5>
<p>Nationalrätin und Präsidentin der Grünen</p>
</div>
</div>
</div>
</div>
</div>
<!-- ENDE Exposition Bundesräte -->
<!-- START Gameinfo -->
<div class="row">
<div class="col-md-6">
<div class="form-group mb-5">
<div id="" class="alert alert-info msg" role="alert"> Trage hier deine Tipps ein. Es können ebenfalls Personen gewählt werden, die nicht kandidieren. </div>
</div>
</div>
<div class="col-md-6">
<div class="form-group mb-5">
<div id="" class="alert alert-info msg" role="alert"> Jede Person kann mit 0-246 Stimmen der National- und Ständeräte gewählt werden. </div>
</div>
</div>
</div>
<!-- ENDE Gameinfo -->
<!-- START Tippformular -->
<form action="" method="post" id="tipp">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="id_tipp1">Tipp #1: </label>
<input type="text" name="tipp1" class="form-control" id="id_tipp1" required>
</div>
<div class="form-group">
<label for="id_tipp2">Tipp #2: </label>
<input type="text" name="tipp2" class="form-control" id="id_tipp2" required>
</div>
<div class="form-group">
<label for="id_tipp3">Tipp #3: </label>
<input type="text" name="tipp3" class="form-control" id="id_tipp3" required>
</div>
<div class="form-group">
<label for="id_tipp4">Tipp #4: </label>
<input type="text" name="tipp4" class="form-control" id="id_tipp4" required>
</div>
<div class="form-group">
<label for="id_tipp5">Tipp #5: </label>
<input type="text" name="tipp5" class="form-control" id="id_tipp5" required>
</div>
<div class="form-group">
<label for="id_tipp6">Tipp #6: </label>
<input type="text" name="tipp6" class="form-control" id="id_tipp6" required>
</div>
<div class="form-group">
<label for="id_tipp7">Tipp #7: </label>
<input type="text" name="tipp7" class="form-control" id="id_tipp7" required>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="id_tipp1stimmen">Anzahl Stimmen für Tipp #1: </label>
<input type="number" min="0" max="246" name="tipp1stimmen" class="form-control" id="id_tipp1stimmen" required>
</div>
<div class="form-group">
<label for="id_tipp1stimmen">Anzahl Stimmen für Tipp #2: </label>
<input type="number" min="0" max="246" name="tipp2stimmen" class="form-control" id="id_tipp2stimmen" required>
</div>
<div class="form-group">
<label for="id_tipp1stimmen">Anzahl Stimmen für Tipp #3: </label>
<input type="number" min="0" max="246" name="tipp3stimmen" class="form-control" id="id_tipp3stimmen" required>
</div>
<div class="form-group">
<label for="id_tipp1stimmen">Anzahl Stimmen für Tipp #4: </label>
<input type="number" min="0" max="246" name="tipp4stimmen" class="form-control" id="id_tipp4stimmen" required>
</div>
<div class="form-group">
<label for="id_tipp1stimmen">Anzahl Stimmen für Tipp #5: </label>
<input type="number" min="0" max="246" name="tipp5stimmen" class="form-control" id="id_tipp5stimmen" required>
</div>
<div class="form-group">
<label for="id_tipp1stimmen">Anzahl Stimmen für Tipp #6: </label>
<input type="number" min="0" max="246" name="tipp6stimmen" class="form-control" id="id_tipp6stimmen" required>
</div>
<div class="form-group">
<label for="id_tipp1stimmen">Anzahl Stimmen für Tipp #7: </label>
<input type="number" min="0" max="246" name="tipp7stimmen" class="form-control" id="id_tipp7stimmen" required>
</div>
</div>
</div>
<div id="" class="alert alert-danger msg" role="alert"> <p>Du kannst nur <strong>1x</strong> deine Tipps abgeben. Wähle weise.</p></div>
<div id="show" class="alert alert-info msg" role="alert"></div>
<button type="submit" name="tipp_submit" class="btn btn-primary mb-5" value="einloggen">Tipps verbindlich abgeben!</button>
</form>
<!-- ENDE Tippformular -->
<?php }; ?>
</section>
</div>
</body>
</html>