Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 1 | <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" /> |
Andreu | 0b2f843 | 2019-09-18 20:09:59 +0200 | [diff] [blame] | 7 | |
| 8 | <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 9 | </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> |
Andreu | 09b8b05 | 2019-09-21 21:47:20 +0200 | [diff] [blame] | 15 | <form action="./php/login.php" method="POST"> |
Andreu | 0b2f843 | 2019-09-18 20:09:59 +0200 | [diff] [blame] | 16 | <select name="user" id="list"> |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 17 | </select> |
| 18 | |
Andreu | 20cbd1d | 2019-09-22 00:00:57 +0200 | [diff] [blame] | 19 | <input disabled required placeholder="Clau d'accés..." id="password" type="password" name="password"/> |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 20 | <input type="submit" value="Entrar" /> |
| 21 | </form> |
| 22 | </div> |
| 23 | </div> |
Andreu | 0b2f843 | 2019-09-18 20:09:59 +0200 | [diff] [blame] | 24 | |
| 25 | <script> |
Andreu | abbcb7e | 2019-09-21 18:22:14 +0200 | [diff] [blame] | 26 | $.post("./ajax/getusers.php", function(data, status){ |
Andreu | 0b2f843 | 2019-09-18 20:09:59 +0200 | [diff] [blame] | 27 | $("#list").html(data); |
Andreu | ef5af2d | 2019-09-22 01:24:47 +0200 | [diff] [blame^] | 28 | |
| 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 | } |
Andreu | 0b2f843 | 2019-09-18 20:09:59 +0200 | [diff] [blame] | 36 | }); |
Andreu | 20cbd1d | 2019-09-22 00:00:57 +0200 | [diff] [blame] | 37 | |
| 38 | $('select').on('change', function() { |
| 39 | let nopassword = $('select option:selected').hasClass('nopassword'); |
| 40 | $('#password').prop('disabled', nopassword); |
| 41 | }); |
Andreu | 0b2f843 | 2019-09-18 20:09:59 +0200 | [diff] [blame] | 42 | </script> |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 43 | </body> |
| 44 | </html> |