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