blob: cf88aa9efb2b52184393d0509095815fcfa96fbb [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>
Andreued8e1f92019-09-18 22:26:04 +020017 let mort = <?=$user->mort?>;
18 let requested = <?=$user->requested?>;
19 let userid = <?=$user->id?>;
20 let victimid = <?=$victim->id?>;
21 let victimnom = "<?=$victim->nom()?>";
Andreu66ad5cf2019-09-18 17:15:44 +020022 </script>
Andreudca79f42019-09-18 23:53:19 +020023
Andreu66ad5cf2019-09-18 17:15:44 +020024 </head>
25 <body>
26 <div id="outter-container">
27 <div id="inner-container">
28 <h2>Hola <name id="user_name"><?=$user->nom()?></name>,</h2>
29 <h3>La teva víctima és:</h3>
Andreudca79f42019-09-18 23:53:19 +020030 <div style="display:none;" id="state">0</div>
Andreu66ad5cf2019-09-18 17:15:44 +020031
32 <div class="victima">
33 <img width="300px" src="./imgs/<?=$victim->id?>.png" />
34 <h2 id="victim_name"><?=$victim->nomcomplet?></h2>
35 <h3><span id="victim_curs"><?=$victim->curs?></span>-<span id="victim_grau"><?=$victim->grau?></span></h3>
36 </div>
37 </div>
38 </div>
39 <div id="butons">
40 <button id="win" onclick="js: send_request(<?=$victim->id?>,1);">L'he matat</button>
41 <button id="lose" onclick="js: send_request(<?=$user->id?>,2);">M'han matat</button>
42 </div>
43
44 <script>
Andreudca79f42019-09-18 23:53:19 +020045 $(document).ready(function() {
46 let checking = setInterval(function() {
47 $.ajax({ url: "./php/checkrequests.php", data: { id: userid }, type: 'GET',
48 success: function(data) {
Andreub98502e2019-09-18 23:55:24 +020049 $("#state").load("./php/checkrequests.php?id=" + userid, function(response, status, xhr) {
50 if (!mort) requested = check_requests(response, victimnom, victimid, userid);
Andreudca79f42019-09-18 23:53:19 +020051 else clearInterval(checking);
52 });
53 }});
54 }, 1000);
55 });
Andreu66ad5cf2019-09-18 17:15:44 +020056 </script>
57 </body>
58</html>