Andreu | 09b8b05 | 2019-09-21 21:47:20 +0200 | [diff] [blame] | 1 | <?php |
| 2 | if (!isset($_COOKIE['user'])) { |
Andreu | 96f1bcd | 2019-09-22 00:33:09 +0200 | [diff] [blame] | 3 | header("Location: ./index.php"); |
Andreu | 09b8b05 | 2019-09-21 21:47:20 +0200 | [diff] [blame] | 4 | die(); |
| 5 | } |
| 6 | ?> |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 7 | <html> |
| 8 | <head> |
| 9 | <meta charset="UTF-8"> |
| 10 | <title>Pàgina de l'usuari</title> |
avm99963 | db383ed | 2019-09-22 02:14:42 +0200 | [diff] [blame] | 11 | |
| 12 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 13 | |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 14 | <link rel="stylesheet" href="./css/basic.css" /> |
| 15 | <link rel="stylesheet" href="./css/main.css" /> |
avm99963 | db383ed | 2019-09-22 02:14:42 +0200 | [diff] [blame] | 16 | |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 17 | <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> |
Andreu | ed8e1f9 | 2019-09-18 22:26:04 +0200 | [diff] [blame] | 18 | <script src="https://rawgit.com/notifyjs/notifyjs/master/dist/notify.js"></script> |
avm99963 | db383ed | 2019-09-22 02:14:42 +0200 | [diff] [blame] | 19 | |
Andreu | 10cb304 | 2019-09-18 19:55:36 +0200 | [diff] [blame] | 20 | <script src="./js/utils.js"></script> |
Andreu | efe66eb | 2019-09-21 18:41:49 +0200 | [diff] [blame] | 21 | <script src="./js/animations.js"></script> |
avm99963 | db383ed | 2019-09-22 02:14:42 +0200 | [diff] [blame] | 22 | |
| 23 | <?php |
Andreu | 2457e40 | 2019-09-22 00:52:41 +0200 | [diff] [blame] | 24 | require './credentials.php'; |
Andreu | 09b8b05 | 2019-09-21 21:47:20 +0200 | [diff] [blame] | 25 | require './php/utils.php'; |
| 26 | $user = get_users($_COOKIE['user']); |
| 27 | $victim = get_users($user->quimata); |
Andreu | 4ed7496 | 2019-09-22 00:06:15 +0200 | [diff] [blame] | 28 | if ($user->mort) header("Location: ./dead.php"); |
Andreu | dca79f4 | 2019-09-18 23:53:19 +0200 | [diff] [blame] | 29 | ?> |
avm99963 | db383ed | 2019-09-22 02:14:42 +0200 | [diff] [blame] | 30 | |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 31 | <script> |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame] | 32 | let user = { |
| 33 | 'id': <?=$user->id?>, |
| 34 | 'quimata': <?=$user->quimata?>, |
| 35 | 'requested': <?=$user->requested?>, |
Andreu | abbcb7e | 2019-09-21 18:22:14 +0200 | [diff] [blame] | 36 | 'mort': <?=$user->mort?>, |
avm99963 | db383ed | 2019-09-22 02:14:42 +0200 | [diff] [blame] | 37 | |
Andreu | abbcb7e | 2019-09-21 18:22:14 +0200 | [diff] [blame] | 38 | 'nom': "<?=$user->nomcomplet?>", |
| 39 | 'curs': <?=$user->curs?>, |
| 40 | 'grau': <?=$user->grau?> |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame] | 41 | }; |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 42 | </script> |
avm99963 | db383ed | 2019-09-22 02:14:42 +0200 | [diff] [blame] | 43 | |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 44 | </head> |
| 45 | <body> |
| 46 | <div id="outter-container"> |
| 47 | <div id="inner-container"> |
| 48 | <h2>Hola <name id="user_name"><?=$user->nom()?></name>,</h2> |
avm99963 | db383ed | 2019-09-22 02:14:42 +0200 | [diff] [blame] | 49 | |
Andreu | 96f1bcd | 2019-09-22 00:33:09 +0200 | [diff] [blame] | 50 | <div class="formulari_contrasenya" style="display: none;"> |
Andreu | 20cbd1d | 2019-09-22 00:00:57 +0200 | [diff] [blame] | 51 | <p>Sembla que no tens contrasenya, la gent podrà entrar a la teva compta...</p> |
| 52 | <form action="./php/change_password.php" method="POST"> |
| 53 | <input type="hidden" value="<?=$_COOKIE['user']?>" name="userid"> |
| 54 | <input type="password" placeholder="Nova contrasenya..." name="password" /><br /> |
| 55 | <input type="password" placeholder="Repeteix la contrasenya" name="confirmation"/><br /> |
| 56 | <input type="submit"> |
| 57 | </form> |
| 58 | </div> |
avm99963 | db383ed | 2019-09-22 02:14:42 +0200 | [diff] [blame] | 59 | |
| 60 | <p>La teva víctima és:</p> |
| 61 | |
| 62 | <table class="victima"> |
| 63 | <tr> |
| 64 | <td><img id="victim_img" src="./imgs/<?=$victim->id?>.png" /></td> |
| 65 | <td> |
| 66 | <div id="victim_name"><?=$victim->nomcomplet?></div> |
| 67 | <div id="victim_curs_i_grau"><span id="victim_curs"><?=$victim->curs?></span>-<span id="victim_grau"><?=$victim->grau?></span></div> |
| 68 | <div id="butons" class="options"> |
| 69 | <button id="win" onclick="js: send_request(user, 'REQ KILL');">L'he matat</button> |
| 70 | </div> |
| 71 | </td> |
| 72 | </tr> |
| 73 | </table> |
| 74 | |
| 75 | <div style="clear: both;"></div> |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 76 | </div> |
| 77 | </div> |
avm99963 | db383ed | 2019-09-22 02:14:42 +0200 | [diff] [blame] | 78 | |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 79 | <script> |
Andreu | dca79f4 | 2019-09-18 23:53:19 +0200 | [diff] [blame] | 80 | $(document).ready(function() { |
Andreu | abbcb7e | 2019-09-21 18:22:14 +0200 | [diff] [blame] | 81 | // Set interval of checking |
Andreu | efe66eb | 2019-09-21 18:41:49 +0200 | [diff] [blame] | 82 | let checking = setInterval(function() { update_info(user); }, 1500); |
Andreu | 96f1bcd | 2019-09-22 00:33:09 +0200 | [diff] [blame] | 83 | // Set to hidden or not the password prompt |
| 84 | if (<?=$user->md5password=="" ? 1 : 0?>) $(".formulari_contrasenya").show(); |
Andreu | dca79f4 | 2019-09-18 23:53:19 +0200 | [diff] [blame] | 85 | }); |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 86 | </script> |
| 87 | </body> |
| 88 | </html> |