blob: c4e370dc3e96dfc2f83e7e545deac60a9258e65f [file] [log] [blame]
Andreu78e5bb02019-09-22 13:38:04 +02001<?php
2 require './credentials.php';
3 require './php/utils.php';
Adrià Vilanova Martínez13cf0cd2022-11-20 01:02:20 +01004 require_once('./php/security.php');
Andreu20af6c22019-09-24 18:33:50 +02005
Adrià Vilanova Martínezd3394e12022-11-19 15:45:58 +01006 date_default_timezone_set("Europe/Madrid");
Andreu03d030d2019-09-25 21:52:01 +02007
Adrià Vilanova Martínez13cf0cd2022-11-20 01:02:20 +01008 Security::checkIsSignedIn();
Andreu09b8b052019-09-21 21:47:20 +02009?>
Andreu66ad5cf2019-09-18 17:15:44 +020010<html>
11 <head>
12 <meta charset="UTF-8">
Andreu0d0f9fd2019-09-23 03:56:08 +020013 <title>PastanagAPP</title>
avm99963db383ed2019-09-22 02:14:42 +020014
15 <meta name="viewport" content="width=device-width, initial-scale=1">
Adrià Vilanova Martínez71e9f872022-11-20 01:54:50 +010016 <link rel="manifest" href="/bin/manifest.json">
Andreu0d0f9fd2019-09-23 03:56:08 +020017
18 <!-- Apple web app -->
19 <link rel="apple-touch-icon" href="./bin/images/icons/icon-72x72.png">
20 <meta name="apple-mobile-web-app-title" content="PastanagAPP">
21 <meta name="apple-mobile-web-app-capable" content="yes">
22 <meta name="apple-mobile-web-app-status-bar-style" content="green">
23
avm99963db383ed2019-09-22 02:14:42 +020024
Andreu4b2fbd92019-09-22 22:30:25 +020025 <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans" />
26
Andreu66ad5cf2019-09-18 17:15:44 +020027 <link rel="stylesheet" href="./css/basic.css" />
28 <link rel="stylesheet" href="./css/main.css" />
avm99963db383ed2019-09-22 02:14:42 +020029
Andreu66ad5cf2019-09-18 17:15:44 +020030 <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
Andreued8e1f92019-09-18 22:26:04 +020031 <script src="https://rawgit.com/notifyjs/notifyjs/master/dist/notify.js"></script>
avm99963db383ed2019-09-22 02:14:42 +020032
Andreu10cb3042019-09-18 19:55:36 +020033 <script src="./js/utils.js"></script>
Andreuefe66eb2019-09-21 18:41:49 +020034 <script src="./js/animations.js"></script>
avm99963db383ed2019-09-22 02:14:42 +020035
36 <?php
Adrià Vilanova Martínez13cf0cd2022-11-20 01:02:20 +010037 $user = get_users($_SESSION["id"]);
Andreu09b8b052019-09-21 21:47:20 +020038 $victim = get_users($user->quimata);
Andreu0530b302019-09-24 04:18:20 +020039 if ($user->mort) die("<script>window.location.href = './dead.php'</script>");
Adrià Vilanova Martínez7b206bb2022-12-10 17:29:52 +010040
41 // @TODO: Reenable photos
42 /*$bits = dec2bits($user->bits);
43 $bit_counter = 0;*/
Andreudca79f42019-09-18 23:53:19 +020044 ?>
avm99963db383ed2019-09-22 02:14:42 +020045
Andreu66ad5cf2019-09-18 17:15:44 +020046 <script>
Andreued491672019-09-20 13:09:18 +020047 let user = {
Andreu99501052019-09-22 20:09:08 +020048 'id': <?=(int)$user->id?>,
49 'quimata': <?=(int)$user->quimata?>,
50 'requested': <?=(int)$user->requested?>,
51 'mort': <?=(int)$user->mort?>,
avm99963db383ed2019-09-22 02:14:42 +020052
Adrià Vilanova Martínez13cf0cd2022-11-20 01:02:20 +010053 'nom': "<?=Security::htmlsafe($user->nomcomplet)?>",
Andreu99501052019-09-22 20:09:08 +020054 'curs': <?=(int)$user->curs?>,
55 'grau': <?=(int)$user->grau?>
Andreued491672019-09-20 13:09:18 +020056 };
Andreu66ad5cf2019-09-18 17:15:44 +020057 </script>
avm99963db383ed2019-09-22 02:14:42 +020058
Andreu66ad5cf2019-09-18 17:15:44 +020059 </head>
60 <body>
61 <div id="outter-container">
62 <div id="inner-container">
Adrià Vilanova Martínez163f5aa2022-11-20 01:17:20 +010063 <a href="/php/logout.php" class="goback">Tancar sessió</a><br />
Adrià Vilanova Martínez13cf0cd2022-11-20 01:02:20 +010064 <h2>Hola <name id="user_name"><?=Security::htmlsafe($user->nom())?></name>,</h2>
avm99963db383ed2019-09-22 02:14:42 +020065
Andreu4b2fbd92019-09-22 22:30:25 +020066 <div class="formulari_contrasenya">
Andreua0fc8272019-09-23 00:35:25 +020067 <p>Sembla que no tens clau d'accés, la gent podrà entrar al teu compte...</p>
Andreu20cbd1d2019-09-22 00:00:57 +020068 <form action="./php/change_password.php" method="POST">
Adrià Vilanova Martínez13cf0cd2022-11-20 01:02:20 +010069 <input type="hidden" value="<?=(int)$user->id?>" name="userid">
Andreu543e70c2019-09-22 14:08:49 +020070 <input type="password" placeholder="Nova clau d'accés..." name="password" /><br />
71 <input type="password" placeholder="Repeteix la clau d'accés" name="confirmation"/><br />
Andreu4b2fbd92019-09-22 22:30:25 +020072 <input type="submit" value="Posar clau d'accés">
Andreu20cbd1d2019-09-22 00:00:57 +020073 </form>
74 </div>
avm99963db383ed2019-09-22 02:14:42 +020075
76 <p>La teva víctima és:</p>
77
Andreu04f79ef2019-09-22 18:52:19 +020078 <div class="victima">
79 <table>
80 <tr>
Adrià Vilanova Martínez7b206bb2022-12-10 17:29:52 +010081 <?php
82 // @TODO: Reenable photos
83 /*
Andreu779c3b72019-09-24 03:14:35 +020084 <td class="table_img">
85 <div id="victim_img">
Andreu Huguetf1334172020-09-15 17:29:22 +020086 <div class="grid-container">
87 <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div>
88 <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div>
89 <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div>
90 <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div>
91 <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div>
92 <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div>
93 <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div>
94 <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div>
95 <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div>
96 </div>
Andreu779c3b72019-09-24 03:14:35 +020097 </div>
98 </td>
Adrià Vilanova Martínez7b206bb2022-12-10 17:29:52 +010099 */
100 ?>
Andreu0d0f9fd2019-09-23 03:56:08 +0200101 <td class="table_text">
Adrià Vilanova Martínez13cf0cd2022-11-20 01:02:20 +0100102 <div id="victim_name"><?=Security::htmlsafe($victim->nomcomplet)?></div>
Andreu04f79ef2019-09-22 18:52:19 +0200103 <div id="victim_curs_i_grau">
Adrià Vilanova Martínez13cf0cd2022-11-20 01:02:20 +0100104 <span id="victim_curs"><?=Security::htmlsafe($victim->nomcurs())?></span>
Andreu04f79ef2019-09-22 18:52:19 +0200105 -
Adrià Vilanova Martínez13cf0cd2022-11-20 01:02:20 +0100106 <span id="victim_grau"><?=Security::htmlsafe($victim->nomgrau())?></span>
Andreu04f79ef2019-09-22 18:52:19 +0200107 </div>
108 <div id="butons" class="options">
109 <button id="win" onclick="js: send_request(user, 'REQ KILL');">L'he matat</button>
110 </div>
111 </td>
112 </tr>
113 </table>
114 </div>
Andreu03d030d2019-09-25 21:52:01 +0200115
Andreu Huguet0d5d7312020-09-15 21:12:43 +0200116 <?php
Adrià Vilanova Martínez13cf0cd2022-11-20 01:02:20 +0100117 $query_seen_victim = "SELECT COUNT(*) FROM missatges WHERE `seen` = 0 AND (`receiver_id` = " . (int)$user->id . " AND `sender_id` = " . (int)$user->quimata . ")";
118 $query_seen_killer = "SELECT COUNT(*) FROM missatges WHERE `seen` = 0 AND (`receiver_id` = " . (int)$user->id . " AND `sender_id` != " . (int)$user->quimata . ")";
Andreu Huguet0d5d7312020-09-15 21:12:43 +0200119 ?>
Adrià Vilanova Martínez13cf0cd2022-11-20 01:02:20 +0100120
Andreu03d030d2019-09-25 21:52:01 +0200121 <div>
122 <p>Podeu posar aquesta pàgina com a icona apretant el botó de "Add to Home Screen" del vostre navegador.</p>
Andreu Huguet0d5d7312020-09-15 21:12:43 +0200123 <a href="./ranking.php">Anar al rànquing</a><br />
124 <a href="./victim-chat.php">Xatejar amb la teva víctima (<?= query($query_seen_victim)->fetch_row()[0] ?>)</a><br />
125 <a href="./killer-chat.php">Xatejar amb el teu assassí (<?= query($query_seen_killer)->fetch_row()[0] ?>)</a>
Andreu03d030d2019-09-25 21:52:01 +0200126 </div>
Andreu66ad5cf2019-09-18 17:15:44 +0200127 </div>
128 </div>
avm99963db383ed2019-09-22 02:14:42 +0200129
Andreu66ad5cf2019-09-18 17:15:44 +0200130 <script>
Andreudca79f42019-09-18 23:53:19 +0200131 $(document).ready(function() {
Andreuabbcb7e2019-09-21 18:22:14 +0200132 // Set interval of checking
Adrià Vilanova Martínez67727cd2022-11-20 01:31:53 +0100133 update_info(user);
Andreu96f1bcd2019-09-22 00:33:09 +0200134 // Set to hidden or not the password prompt
Andreu543e70c2019-09-22 14:08:49 +0200135 if (<?=$user->md5password=="" ? 1 : 0?>) {
136 $.notify("No tens clau d'accés", "info");
137 $(".formulari_contrasenya").show();
138 }
Andreu03d030d2019-09-25 21:52:01 +0200139 // Notify of messages
140 if (getUrlParameter("wrongconfirmation")) read_message("Les contrasenyes no coincideixen", "error");
141 if (getUrlParameter("errordb")) read_message("Hi ha hagut un problema a la base de dades, torna-ho a intentar", "error");
142 if (getUrlParameter("successpassword")) read_message("La teva clau d'accés s'ha guardat", "success");
Andreudca79f42019-09-18 23:53:19 +0200143 });
Andreu66ad5cf2019-09-18 17:15:44 +0200144 </script>
145 </body>
146</html>