| <?php |
| require './credentials.php'; |
| require './php/utils.php'; |
| require_once('./php/security.php'); |
| |
| date_default_timezone_set("Europe/Madrid"); |
| |
| Security::checkIsSignedIn(); |
| ?> |
| <html> |
| <head> |
| <meta charset="UTF-8"> |
| <title>PastanagAPP</title> |
| |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <link rel="manifest" href="/bin/manifest.json"> |
| |
| <!-- Apple web app --> |
| <link rel="apple-touch-icon" href="./bin/images/icons/icon-72x72.png"> |
| <meta name="apple-mobile-web-app-title" content="PastanagAPP"> |
| <meta name="apple-mobile-web-app-capable" content="yes"> |
| <meta name="apple-mobile-web-app-status-bar-style" content="green"> |
| |
| <link rel="preconnect" href="https://fonts.googleapis.com"> |
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> |
| <link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400;0,500;1,400;1,500" rel="stylesheet"> |
| |
| <link rel="stylesheet" href="./css/basic.css" /> |
| <link rel="stylesheet" href="./css/main.css" /> |
| |
| <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> |
| <script src="https://rawgit.com/notifyjs/notifyjs/master/dist/notify.js"></script> |
| |
| <script src="./js/utils.js"></script> |
| <script src="./js/animations.js"></script> |
| |
| <?php |
| $user = get_users($_SESSION["id"]); |
| if ($user->mort) die("<script>window.location.href = './dead.php'</script>"); |
| |
| // @TODO: Reenable photos |
| /*$bits = dec2bits($user->bits); |
| $bit_counter = 0;*/ |
| ?> |
| |
| <script> |
| let user = { |
| 'id': <?=(int)$user->id?>, |
| 'quimata': <?=(int)$user->quimata?>, |
| 'requested': <?=(int)$user->requested?>, |
| 'mort': <?=(int)$user->mort?>, |
| |
| 'nom': "<?=Security::htmlsafe($user->nomcomplet)?>", |
| 'curs': <?=(int)$user->curs?>, |
| 'grau': <?=(int)$user->grau?> |
| }; |
| </script> |
| |
| </head> |
| <body> |
| <div id="outter-container"> |
| <div id="inner-container"> |
| <a href="/php/logout.php" class="goback">Tancar sessió</a><br /> |
| <h2>Hola <name id="user_name"><?=Security::htmlsafe($user->nom())?></name>,</h2> |
| |
| <div class="formulari_contrasenya"> |
| <p>Sembla que no tens clau d'accés, la gent podrà entrar al teu compte...</p> |
| <form action="./php/change_password.php" method="POST"> |
| <input type="hidden" value="<?=(int)$user->id?>" name="userid"> |
| <input type="password" placeholder="Nova clau d'accés..." name="password" /><br /> |
| <input type="password" placeholder="Repeteix la clau d'accés" name="confirmation"/><br /> |
| <input type="submit" value="Posar clau d'accés"> |
| </form> |
| </div> |
| |
| <?php |
| if (!Credentials::isAllVsAllModeEnabled()) { |
| $victim = get_users($user->quimata); |
| ?> |
| <p>La teva víctima és:</p> |
| |
| <div class="victima"> |
| <table> |
| <tr> |
| <?php |
| // @TODO: Reenable photos |
| /* |
| <td class="table_img"> |
| <div id="victim_img"> |
| <div class="grid-container"> |
| <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div> |
| <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div> |
| <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div> |
| <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div> |
| <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div> |
| <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div> |
| <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div> |
| <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div> |
| <div class="grid-item <?=(int)$bits[$bit_counter++] ? 'black' : ''?>"></div> |
| </div> |
| </div> |
| </td> |
| */ |
| ?> |
| <td class="table_text"> |
| <div id="victim_name"><?=Security::htmlsafe($victim->nomcomplet)?></div> |
| <div id="victim_curs_i_grau"> |
| <span id="victim_curs"><?=Security::htmlsafe($victim->nomcurs())?></span> |
| - |
| <span id="victim_grau"><?=Security::htmlsafe($victim->nomgrau())?></span> |
| </div> |
| <div id="butons" class="options"> |
| <button id="win" onclick="js: send_request(user, 'REQ KILL');">L'he matat</button> |
| </div> |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <?php |
| $query_seen_victim = "SELECT COUNT(*) FROM missatges WHERE `seen` = 0 AND (`receiver_id` = " . (int)$user->id . " AND `sender_id` = " . (int)$user->quimata . ")"; |
| $query_seen_killer = "SELECT COUNT(*) FROM missatges WHERE `seen` = 0 AND (`receiver_id` = " . (int)$user->id . " AND `sender_id` != " . (int)$user->quimata . ")"; |
| ?> |
| |
| <div> |
| <p>Podeu posar aquesta pàgina com a icona apretant el botó de "Add to Home Screen" del vostre navegador.</p> |
| <a href="./ranking.php">Anar al rànquing</a><br /> |
| <a href="./victim-chat.php">Xatejar amb la teva víctima (<?= query($query_seen_victim)->fetch_row()[0] ?>)</a><br /> |
| <a href="./killer-chat.php">Xatejar amb el teu assassí (<?= query($query_seen_killer)->fetch_row()[0] ?>)</a> |
| </div> |
| <?php |
| } else { |
| ?> |
| <p>Tots contra tots! Ara pots matar a qualsevol persona que continuï viva (les de la següent llista).</p> |
| <p>Quan matis alguna persona, selecciona-la i fes clic al botó "L'he assassinat/da".</p> |
| <form action="php/request.php" method="POST" onsubmit="return confirm('Estàs segura que has assassinat aquesta persona? Per agilitzar el procediment l\'altra persona no haurà de confirmar la mort i obtindràs els punts directament.\n\nL\'ús inadecuat comportarà una penalització.');"> |
| <?php |
| $users = get_users(); |
| foreach ($users as $user) { |
| if ($user->mort) continue; |
| ?> |
| <p><input type="radio" name="mort" value="<?=(int)$user->id?>" required<?=$user->id == $_SESSION['id'] ? ' disabled' : ''?>> <?=Security::htmlsafe($user->nomcomplet)?> - <?=Security::htmlsafe($user->nomcurs())?> - <?=Security::htmlsafe($user->nomgrau())?></p> |
| <?php |
| } |
| ?> |
| <input type="hidden" name="msg" value="INSTAKILL"> |
| <button>L'he assassinat/da</button> |
| <?php |
| } |
| ?> |
| </div> |
| </div> |
| |
| <script> |
| $(document).ready(function() { |
| // Set interval of checking |
| update_info(user); |
| |
| // Set to hidden or not the password prompt |
| if (<?=$user->md5password=="" ? 1 : 0?>) { |
| $.notify("No tens clau d'accés", "info"); |
| $(".formulari_contrasenya").show(); |
| } |
| // Notify of messages |
| if (getUrlParameter("wrongconfirmation")) read_message("Les contrasenyes no coincideixen", "error"); |
| if (getUrlParameter("errordb")) read_message("Hi ha hagut un problema a la base de dades, torna-ho a intentar", "error"); |
| if (getUrlParameter("successpassword")) read_message("La teva clau d'accés s'ha guardat", "success"); |
| if (getUrlParameter("killsuccess")) read_message("La mort s'ha guardat correctament", "success"); |
| }); |
| </script> |
| </body> |
| </html> |