blob: 0fe24b77af0df44e88b69d3f406c9fed639ac37b [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>
5 <link rel="stylesheet" href="./css/basic.css" />
6 <link rel="stylesheet" href="./css/login.css" />
Andreu0b2f8432019-09-18 20:09:59 +02007
8 <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
Andreu66ad5cf2019-09-18 17:15:44 +02009 </head>
10 <body>
11 <div id="outter-container">
12 <div id="inner-container">
13 <h1>Selecciona el teu nom</h1>
14 <h3>Per entrar al joc de la Pastanaga Assessina</h3>
Andreu09b8b052019-09-21 21:47:20 +020015 <form action="./php/login.php" method="POST">
Andreu0b2f8432019-09-18 20:09:59 +020016 <select name="user" id="list">
Andreu66ad5cf2019-09-18 17:15:44 +020017 </select>
18
Andreu20cbd1d2019-09-22 00:00:57 +020019 <input disabled required placeholder="Clau d'accés..." id="password" type="password" name="password"/>
Andreu66ad5cf2019-09-18 17:15:44 +020020 <input type="submit" value="Entrar" />
21 </form>
22 </div>
23 </div>
Andreu0b2f8432019-09-18 20:09:59 +020024
25 <script>
Andreuabbcb7e2019-09-21 18:22:14 +020026 $.post("./ajax/getusers.php", function(data, status){
Andreu0b2f8432019-09-18 20:09:59 +020027 $("#list").html(data);
Andreuef5af2d2019-09-22 01:24:47 +020028
29 userid = <?=isset($_COOKIE['user']) ? $_COOKIE['user'] : -1 ?>;
30
31 if (userid > 0) {
32 username = $('option[value=' + userid + ']').text();
33 redir = confirm("Has entrat com a usuari " + username + " anteriorment, vols tornar-ho a fer?");
34 if (redir) window.location.href = 'main.php';
35 }
Andreu0b2f8432019-09-18 20:09:59 +020036 });
Andreu20cbd1d2019-09-22 00:00:57 +020037
38 $('select').on('change', function() {
39 let nopassword = $('select option:selected').hasClass('nopassword');
40 $('#password').prop('disabled', nopassword);
41 });
Andreu0b2f8432019-09-18 20:09:59 +020042 </script>
Andreu66ad5cf2019-09-18 17:15:44 +020043 </body>
44</html>