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?>, |
Andreu | abbcb7e | 2019-09-21 18:22:14 +0200 | [diff] [blame^] | 21 | 'mort': <?=$user->mort?>, |
| 22 | |
| 23 | 'nom': "<?=$user->nomcomplet?>", |
| 24 | 'curs': <?=$user->curs?>, |
| 25 | 'grau': <?=$user->grau?> |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame] | 26 | }; |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 27 | </script> |
Andreu | dca79f4 | 2019-09-18 23:53:19 +0200 | [diff] [blame] | 28 | |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 29 | </head> |
| 30 | <body> |
| 31 | <div id="outter-container"> |
| 32 | <div id="inner-container"> |
| 33 | <h2>Hola <name id="user_name"><?=$user->nom()?></name>,</h2> |
| 34 | <h3>La teva víctima és:</h3> |
Andreu | 885889c | 2019-09-19 00:28:20 +0200 | [diff] [blame] | 35 | <div id="state">0</div> |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 36 | |
| 37 | <div class="victima"> |
| 38 | <img width="300px" src="./imgs/<?=$victim->id?>.png" /> |
| 39 | <h2 id="victim_name"><?=$victim->nomcomplet?></h2> |
| 40 | <h3><span id="victim_curs"><?=$victim->curs?></span>-<span id="victim_grau"><?=$victim->grau?></span></h3> |
| 41 | </div> |
| 42 | </div> |
| 43 | </div> |
Andreu | abbcb7e | 2019-09-21 18:22:14 +0200 | [diff] [blame^] | 44 | <div id="butons" class="options"> |
| 45 | <button id="win" onclick="js: send_request(user, 'REQ KILL');">L'he matat</button> |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 46 | </div> |
| 47 | |
| 48 | <script> |
Andreu | dca79f4 | 2019-09-18 23:53:19 +0200 | [diff] [blame] | 49 | $(document).ready(function() { |
Andreu | abbcb7e | 2019-09-21 18:22:14 +0200 | [diff] [blame^] | 50 | // Set interval of checking |
Andreu | dca79f4 | 2019-09-18 23:53:19 +0200 | [diff] [blame] | 51 | let checking = setInterval(function() { |
Andreu | abbcb7e | 2019-09-21 18:22:14 +0200 | [diff] [blame^] | 52 | $.ajax({ |
| 53 | url: "./ajax/checkrequests.php", |
| 54 | data: { id: user.id }, |
| 55 | type: 'GET', |
| 56 | success: function(response, status, xhr) { |
| 57 | let info = JSON.parse(response); |
| 58 | if (!user.mort) user.mort = check_requests(info, user); |
| 59 | else location.reload(); |
| 60 | |
| 61 | if (info.quimata != user.quimata) { |
| 62 | change_victim(info); |
| 63 | user = info; |
| 64 | } |
| 65 | |
| 66 | console.log(response); |
| 67 | }}); |
| 68 | }, 1500); |
Andreu | dca79f4 | 2019-09-18 23:53:19 +0200 | [diff] [blame] | 69 | }); |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 70 | </script> |
| 71 | </body> |
| 72 | </html> |