login integrat
diff --git a/imgs/1.png b/imgs/1.png
new file mode 100644
index 0000000..4a76f47
--- /dev/null
+++ b/imgs/1.png
Binary files differ
diff --git a/imgs/2.png b/imgs/2.png
new file mode 100644
index 0000000..849788f
--- /dev/null
+++ b/imgs/2.png
Binary files differ
diff --git a/imgs/3.png b/imgs/3.png
new file mode 100644
index 0000000..0a9492f
--- /dev/null
+++ b/imgs/3.png
Binary files differ
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..26cc3d7
--- /dev/null
+++ b/index.html
@@ -0,0 +1,26 @@
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Pàgina de benvinguda</title>
+ <link rel="stylesheet" href="./css/basic.css" />
+ <link rel="stylesheet" href="./css/login.css" />
+ </head>
+ <body>
+ <div id="outter-container">
+ <div id="inner-container">
+ <h1>Selecciona el teu nom</h1>
+ <h3>Per entrar al joc de la Pastanaga Assessina</h3>
+ <form action="login.php" method="POST">
+ <select name="user">
+ <option value="1">Oriol Toll</option>
+ <option value="3">Carlota Corrales</option>
+ <option value="2">Jordi Condom</option>
+ <option value="4">David Ariza</option>
+ <option value="5">Martina Colás</option>
+ </select>
+ <input type="submit" value="Entrar" />
+ </form>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/login.html b/login.html
deleted file mode 100644
index 4d44fec..0000000
--- a/login.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<html>
- <head>
- <title>Pàgina de benvinguda</title>
- <link rel="stylesheet" href="./css/basic.css" />
- <link rel="stylesheet" href="./css/login.css" />
- </head>
- <body>
- <div id="outter-container">
- <div id="inner-container">
- <h1>Selecciona el teu nom</h1>
- <h3>Per entrar al joc de la Pastanaga Assessina</h3>
- <form action="login.php" method="GET">
- <select>
- <option>Oriol Toll</option>
- <option>Carlota Corrales</option>
- <option>Jordi Condom</option>
- <option>David Ariza</option>
- <option>Martina Colás</option>
- </select>
- <input type="submit" value="Entrar" />
- </form>
- </div>
- </div>
- </body>
-</html>
\ No newline at end of file
diff --git a/login.php b/login.php
new file mode 100644
index 0000000..5da29e7
--- /dev/null
+++ b/login.php
@@ -0,0 +1,48 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<?php
+ $servername = "fdb22.awardspace.net";
+ $username = "3155560_users";
+ $password = "btechnoro@fox4news.info";
+
+ // Create connection
+ $conn = new mysqli($servername, $username, $password, "3155560_users");
+ if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
+ $conn->set_charset("utf8");
+
+ $id = $_POST['user'];
+ $query = "SELECT * FROM users WHERE id=".$id;
+
+ if ($result = $conn->query($query)) {
+
+ while ($row = $result->fetch_row()) {
+ echo "<script>let db_info = {'id': ".$row[0];
+ echo ", 'nom':'".$row[1]."', 'curs':".$row[2].", 'grau':".$row[3];
+ echo ", 'quimata':".$row[4].", 'quielmata':".$row[5];
+ echo "}; console.log(db_info);</script>";
+ }
+
+ $result->close();
+ } else {
+ echo "Wrong query";
+ }
+
+ // Close connection
+ $conn->close();
+?>
+</head>
+<body>
+<?php
+// Rebut l'SQL, l'enviem com a JSON a main.html
+echo '
+<script>
+let infoString = JSON.stringify(db_info);
+let infoBase64 = btoa(infoString);
+
+window.location.href = "./main.html?info=" + infoBase64;
+</script>
+';
+?>
+</body>
+</html>
\ No newline at end of file
diff --git a/main.html b/main.html
index b535b2d..84639c1 100644
--- a/main.html
+++ b/main.html
@@ -1,6 +1,7 @@
<html>
<head>
- <title>Pàgina de benvinguda</title>
+ <meta charset="UTF-8">
+ <title>Pàgina de l'usuari</title>
<link rel="stylesheet" href="./css/basic.css" />
<link rel="stylesheet" href="./css/main.css" />
</head>
@@ -22,4 +23,4 @@
<button id="lose">M'han matat</button>
</div>
</body>
-</html>
\ No newline at end of file
+</html>