blob: 5bf67658fdfdc0ba02fd69283a0e78ec9bb2ae7e [file] [log] [blame]
Andreu66ad5cf2019-09-18 17:15:44 +02001<html>
2 <head>
3 <meta charset="UTF-8">
4 <title>Pàgina de l'usuari</title>
5 <link rel="stylesheet" href="./css/basic.css" />
6 <link rel="stylesheet" href="./css/main.css" />
Andreu10cb3042019-09-18 19:55:36 +02007
Andreu66ad5cf2019-09-18 17:15:44 +02008 <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
Andreued8e1f92019-09-18 22:26:04 +02009 <script src="https://rawgit.com/notifyjs/notifyjs/master/dist/notify.js"></script>
Andreu10cb3042019-09-18 19:55:36 +020010 <script src="./js/utils.js"></script>
Andreu66ad5cf2019-09-18 17:15:44 +020011
Andreudca79f42019-09-18 23:53:19 +020012 <?php
13 require './php/login.php';
14 ?>
Andreued8e1f92019-09-18 22:26:04 +020015
Andreu66ad5cf2019-09-18 17:15:44 +020016 <script>
Andreued491672019-09-20 13:09:18 +020017 let user = {
18 'id': <?=$user->id?>,
19 'quimata': <?=$user->quimata?>,
20 'requested': <?=$user->requested?>,
21 'mort': <?=$user->mort?>
22 };
23
24 let victim = {
25 'id': <?=$victim->id?>,
26 'quimata': <?=$victim->quimata?>,
27 'nom': "<?=$victim->nom()?>"
28 };
Andreu66ad5cf2019-09-18 17:15:44 +020029 </script>
Andreudca79f42019-09-18 23:53:19 +020030
Andreu66ad5cf2019-09-18 17:15:44 +020031 </head>
32 <body>
33 <div id="outter-container">
34 <div id="inner-container">
35 <h2>Hola <name id="user_name"><?=$user->nom()?></name>,</h2>
36 <h3>La teva víctima és:</h3>
Andreu885889c2019-09-19 00:28:20 +020037 <div id="state">0</div>
Andreu66ad5cf2019-09-18 17:15:44 +020038
39 <div class="victima">
40 <img width="300px" src="./imgs/<?=$victim->id?>.png" />
41 <h2 id="victim_name"><?=$victim->nomcomplet?></h2>
42 <h3><span id="victim_curs"><?=$victim->curs?></span>-<span id="victim_grau"><?=$victim->grau?></span></h3>
43 </div>
44 </div>
45 </div>
46 <div id="butons">
Andreued491672019-09-20 13:09:18 +020047 <button id="win" onclick="js: send_request(user, victim, 'REQ KILL');">L'he matat</button>
48 <button id="lose" onclick="js: send_request(user, victim, 'REQ DEAD');">M'han matat</button>
Andreu66ad5cf2019-09-18 17:15:44 +020049 </div>
50
51 <script>
Andreudca79f42019-09-18 23:53:19 +020052 $(document).ready(function() {
53 let checking = setInterval(function() {
Andreued491672019-09-20 13:09:18 +020054 $.ajax({ url: "./php/checkrequests.php", data: { id: user.id }, type: 'GET',
Andreudca79f42019-09-18 23:53:19 +020055 success: function(data) {
Andreued491672019-09-20 13:09:18 +020056 $("#state").load("./php/checkrequests.php?id=" + user.id, function(response, status, xhr) {
Andreu885889c2019-09-19 00:28:20 +020057 console.log(response);
Andreued491672019-09-20 13:09:18 +020058 if (!user.mort) user.mort = check_requests(response, user, victim);
Andreudca79f42019-09-18 23:53:19 +020059 else clearInterval(checking);
60 });
61 }});
62 }, 1000);
63 });
Andreu66ad5cf2019-09-18 17:15:44 +020064 </script>
65 </body>
66</html>