blob: 820a18e853520970517137dbd018a7c41e2d3fd3 [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?>,
Andreuabbcb7e2019-09-21 18:22:14 +020021 'mort': <?=$user->mort?>,
22
23 'nom': "<?=$user->nomcomplet?>",
24 'curs': <?=$user->curs?>,
25 'grau': <?=$user->grau?>
Andreued491672019-09-20 13:09:18 +020026 };
Andreu66ad5cf2019-09-18 17:15:44 +020027 </script>
Andreudca79f42019-09-18 23:53:19 +020028
Andreu66ad5cf2019-09-18 17:15:44 +020029 </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>
Andreu885889c2019-09-19 00:28:20 +020035 <div id="state">0</div>
Andreu66ad5cf2019-09-18 17:15:44 +020036
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>
Andreuabbcb7e2019-09-21 18:22:14 +020044 <div id="butons" class="options">
45 <button id="win" onclick="js: send_request(user, 'REQ KILL');">L'he matat</button>
Andreu66ad5cf2019-09-18 17:15:44 +020046 </div>
47
48 <script>
Andreudca79f42019-09-18 23:53:19 +020049 $(document).ready(function() {
Andreuabbcb7e2019-09-21 18:22:14 +020050 // Set interval of checking
Andreudca79f42019-09-18 23:53:19 +020051 let checking = setInterval(function() {
Andreuabbcb7e2019-09-21 18:22:14 +020052 $.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);
Andreudca79f42019-09-18 23:53:19 +020069 });
Andreu66ad5cf2019-09-18 17:15:44 +020070 </script>
71 </body>
72</html>