blob: f62abd9f6367c7a1942422fd9c242be943f8297c [file] [log] [blame]
Andreu66ad5cf2019-09-18 17:15:44 +02001<html>
2 <head>
3 <meta charset="UTF-8">
4 <title>Pàgina de benvinguda</title>
avm99963db383ed2019-09-22 02:14:42 +02005
6 <meta name="viewport" content="width=device-width, initial-scale=1">
7
Andreu66ad5cf2019-09-18 17:15:44 +02008 <link rel="stylesheet" href="./css/basic.css" />
9 <link rel="stylesheet" href="./css/login.css" />
avm99963db383ed2019-09-22 02:14:42 +020010
Andreu0b2f8432019-09-18 20:09:59 +020011 <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
Andreu543e70c2019-09-22 14:08:49 +020012 <script src="https://rawgit.com/notifyjs/notifyjs/master/dist/notify.js"></script>
13
14 <script src="./js/utils.js"></script>
15 <script src="./js/animations.js"></script>
Andreu66ad5cf2019-09-18 17:15:44 +020016 </head>
17 <body>
18 <div id="outter-container">
19 <div id="inner-container">
20 <h1>Selecciona el teu nom</h1>
avm99963db383ed2019-09-22 02:14:42 +020021 <p>Per entrar al joc de la Pastanaga Assessina</p>
Andreu09b8b052019-09-21 21:47:20 +020022 <form action="./php/login.php" method="POST">
Andreu0b2f8432019-09-18 20:09:59 +020023 <select name="user" id="list">
Andreu66ad5cf2019-09-18 17:15:44 +020024 </select>
avm99963db383ed2019-09-22 02:14:42 +020025
Andreu20cbd1d2019-09-22 00:00:57 +020026 <input disabled required placeholder="Clau d'accés..." id="password" type="password" name="password"/>
Andreu66ad5cf2019-09-18 17:15:44 +020027 <input type="submit" value="Entrar" />
28 </form>
29 </div>
30 </div>
avm99963db383ed2019-09-22 02:14:42 +020031
Andreu0b2f8432019-09-18 20:09:59 +020032 <script>
Andreuabbcb7e2019-09-21 18:22:14 +020033 $.post("./ajax/getusers.php", function(data, status){
Andreu0b2f8432019-09-18 20:09:59 +020034 $("#list").html(data);
Andreuef5af2d2019-09-22 01:24:47 +020035
36 userid = <?=isset($_COOKIE['user']) ? $_COOKIE['user'] : -1 ?>;
Andreu2a26cd72019-09-22 01:58:23 +020037 username = $('option[value=' + userid + ']').text();
Andreuef5af2d2019-09-22 01:24:47 +020038
39 if (userid > 0) {
Andreuef5af2d2019-09-22 01:24:47 +020040 redir = confirm("Has entrat com a usuari " + username + " anteriorment, vols tornar-ho a fer?");
41 if (redir) window.location.href = 'main.php';
42 }
Andreu0b2f8432019-09-18 20:09:59 +020043 });
avm99963db383ed2019-09-22 02:14:42 +020044
Andreu20cbd1d2019-09-22 00:00:57 +020045 $('select').on('change', function() {
46 let nopassword = $('select option:selected').hasClass('nopassword');
47 $('#password').prop('disabled', nopassword);
48 });
Andreu543e70c2019-09-22 14:08:49 +020049
50 $(document).ready(function() {
51 // Notify of messages
52 if (getUrlParameter("passwordchanged")) read_message("La teva clau d'accés ha canviat", "error");
53 if (getUrlParameter("wrongpassword")) read_message("La clau d'accés no és correcta", "error");
54
55 });
Andreu0b2f8432019-09-18 20:09:59 +020056 </script>
Andreu66ad5cf2019-09-18 17:15:44 +020057 </body>
58</html>