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> |
avm99963 | db383ed | 2019-09-22 02:14:42 +0200 | [diff] [blame] | 5 | |
| 6 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 7 | |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 8 | <link rel="stylesheet" href="./css/basic.css" /> |
| 9 | <link rel="stylesheet" href="./css/login.css" /> |
avm99963 | db383ed | 2019-09-22 02:14:42 +0200 | [diff] [blame] | 10 | |
Andreu | 0b2f843 | 2019-09-18 20:09:59 +0200 | [diff] [blame] | 11 | <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 12 | </head> |
| 13 | <body> |
| 14 | <div id="outter-container"> |
| 15 | <div id="inner-container"> |
| 16 | <h1>Selecciona el teu nom</h1> |
avm99963 | db383ed | 2019-09-22 02:14:42 +0200 | [diff] [blame] | 17 | <p>Per entrar al joc de la Pastanaga Assessina</p> |
Andreu | 09b8b05 | 2019-09-21 21:47:20 +0200 | [diff] [blame] | 18 | <form action="./php/login.php" method="POST"> |
Andreu | 0b2f843 | 2019-09-18 20:09:59 +0200 | [diff] [blame] | 19 | <select name="user" id="list"> |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 20 | </select> |
avm99963 | db383ed | 2019-09-22 02:14:42 +0200 | [diff] [blame] | 21 | |
Andreu | 20cbd1d | 2019-09-22 00:00:57 +0200 | [diff] [blame] | 22 | <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] | 23 | <input type="submit" value="Entrar" /> |
| 24 | </form> |
| 25 | </div> |
| 26 | </div> |
avm99963 | db383ed | 2019-09-22 02:14:42 +0200 | [diff] [blame] | 27 | |
Andreu | 0b2f843 | 2019-09-18 20:09:59 +0200 | [diff] [blame] | 28 | <script> |
Andreu | abbcb7e | 2019-09-21 18:22:14 +0200 | [diff] [blame] | 29 | $.post("./ajax/getusers.php", function(data, status){ |
Andreu | 0b2f843 | 2019-09-18 20:09:59 +0200 | [diff] [blame] | 30 | $("#list").html(data); |
Andreu | ef5af2d | 2019-09-22 01:24:47 +0200 | [diff] [blame] | 31 | |
| 32 | userid = <?=isset($_COOKIE['user']) ? $_COOKIE['user'] : -1 ?>; |
Andreu | 2a26cd7 | 2019-09-22 01:58:23 +0200 | [diff] [blame] | 33 | username = $('option[value=' + userid + ']').text(); |
Andreu | ef5af2d | 2019-09-22 01:24:47 +0200 | [diff] [blame] | 34 | |
| 35 | if (userid > 0) { |
Andreu | ef5af2d | 2019-09-22 01:24:47 +0200 | [diff] [blame] | 36 | redir = confirm("Has entrat com a usuari " + username + " anteriorment, vols tornar-ho a fer?"); |
| 37 | if (redir) window.location.href = 'main.php'; |
| 38 | } |
Andreu | 0b2f843 | 2019-09-18 20:09:59 +0200 | [diff] [blame] | 39 | }); |
avm99963 | db383ed | 2019-09-22 02:14:42 +0200 | [diff] [blame] | 40 | |
Andreu | 20cbd1d | 2019-09-22 00:00:57 +0200 | [diff] [blame] | 41 | $('select').on('change', function() { |
| 42 | let nopassword = $('select option:selected').hasClass('nopassword'); |
| 43 | $('#password').prop('disabled', nopassword); |
| 44 | }); |
Andreu | 0b2f843 | 2019-09-18 20:09:59 +0200 | [diff] [blame] | 45 | </script> |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 46 | </body> |
| 47 | </html> |