Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 1 | <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" /> |
Andreu | 10cb304 | 2019-09-18 19:55:36 +0200 | [diff] [blame] | 7 | |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 8 | <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> |
Andreu | ed8e1f9 | 2019-09-18 22:26:04 +0200 | [diff] [blame] | 9 | <script src="https://rawgit.com/notifyjs/notifyjs/master/dist/notify.js"></script> |
Andreu | 10cb304 | 2019-09-18 19:55:36 +0200 | [diff] [blame] | 10 | <script src="./js/utils.js"></script> |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 11 | |
Andreu | dca79f4 | 2019-09-18 23:53:19 +0200 | [diff] [blame] | 12 | <?php |
| 13 | require './php/login.php'; |
| 14 | ?> |
Andreu | ed8e1f9 | 2019-09-18 22:26:04 +0200 | [diff] [blame] | 15 | |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 16 | <script> |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame^] | 17 | 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 | }; |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 29 | </script> |
Andreu | dca79f4 | 2019-09-18 23:53:19 +0200 | [diff] [blame] | 30 | |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 31 | </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> |
Andreu | 885889c | 2019-09-19 00:28:20 +0200 | [diff] [blame] | 37 | <div id="state">0</div> |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 38 | |
| 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"> |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame^] | 47 | <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> |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 49 | </div> |
| 50 | |
| 51 | <script> |
Andreu | dca79f4 | 2019-09-18 23:53:19 +0200 | [diff] [blame] | 52 | $(document).ready(function() { |
| 53 | let checking = setInterval(function() { |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame^] | 54 | $.ajax({ url: "./php/checkrequests.php", data: { id: user.id }, type: 'GET', |
Andreu | dca79f4 | 2019-09-18 23:53:19 +0200 | [diff] [blame] | 55 | success: function(data) { |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame^] | 56 | $("#state").load("./php/checkrequests.php?id=" + user.id, function(response, status, xhr) { |
Andreu | 885889c | 2019-09-19 00:28:20 +0200 | [diff] [blame] | 57 | console.log(response); |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame^] | 58 | if (!user.mort) user.mort = check_requests(response, user, victim); |
Andreu | dca79f4 | 2019-09-18 23:53:19 +0200 | [diff] [blame] | 59 | else clearInterval(checking); |
| 60 | }); |
| 61 | }}); |
| 62 | }, 1000); |
| 63 | }); |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 64 | </script> |
| 65 | </body> |
| 66 | </html> |