blob: 16378a947b299aafed3c70a1aae9c399bfb88ff7 [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>
Andreu66ad5cf2019-09-18 17:15:44 +020012 </head>
13 <body>
14 <div id="outter-container">
15 <div id="inner-container">
16 <h1>Selecciona el teu nom</h1>
avm99963db383ed2019-09-22 02:14:42 +020017 <p>Per entrar al joc de la Pastanaga Assessina</p>
Andreu09b8b052019-09-21 21:47:20 +020018 <form action="./php/login.php" method="POST">
Andreu0b2f8432019-09-18 20:09:59 +020019 <select name="user" id="list">
Andreu66ad5cf2019-09-18 17:15:44 +020020 </select>
avm99963db383ed2019-09-22 02:14:42 +020021
Andreu20cbd1d2019-09-22 00:00:57 +020022 <input disabled required placeholder="Clau d'accés..." id="password" type="password" name="password"/>
Andreu66ad5cf2019-09-18 17:15:44 +020023 <input type="submit" value="Entrar" />
24 </form>
25 </div>
26 </div>
avm99963db383ed2019-09-22 02:14:42 +020027
Andreu0b2f8432019-09-18 20:09:59 +020028 <script>
Andreuabbcb7e2019-09-21 18:22:14 +020029 $.post("./ajax/getusers.php", function(data, status){
Andreu0b2f8432019-09-18 20:09:59 +020030 $("#list").html(data);
Andreuef5af2d2019-09-22 01:24:47 +020031
32 userid = <?=isset($_COOKIE['user']) ? $_COOKIE['user'] : -1 ?>;
Andreu2a26cd72019-09-22 01:58:23 +020033 username = $('option[value=' + userid + ']').text();
Andreuef5af2d2019-09-22 01:24:47 +020034
35 if (userid > 0) {
Andreuef5af2d2019-09-22 01:24:47 +020036 redir = confirm("Has entrat com a usuari " + username + " anteriorment, vols tornar-ho a fer?");
37 if (redir) window.location.href = 'main.php';
38 }
Andreu0b2f8432019-09-18 20:09:59 +020039 });
avm99963db383ed2019-09-22 02:14:42 +020040
Andreu20cbd1d2019-09-22 00:00:57 +020041 $('select').on('change', function() {
42 let nopassword = $('select option:selected').hasClass('nopassword');
43 $('#password').prop('disabled', nopassword);
44 });
Andreu0b2f8432019-09-18 20:09:59 +020045 </script>
Andreu66ad5cf2019-09-18 17:15:44 +020046 </body>
47</html>