Username fixed
diff --git a/index.php b/index.php
index 3e29c26..faf3c3e 100644
--- a/index.php
+++ b/index.php
@@ -52,12 +52,12 @@
 		<script src="./js/autocomplete.js"></script>
 		<script>
 			fetch("./ajax/getusers.php").then(result => result.json()).then(users => {
-				console.log(users);
 				autocomplete(document.getElementById("search-input"), users, "search");
-			
+				console.log(users);
+				
 				userid = <?=isset($_COOKIE['user']) ? (int)$_COOKIE['user'] : -1 ?>;
-				username = $('option[value=' + userid + ']').text();
-		
+				username = get_user_name(users, userid);
+
 				if (userid > 0) {
 					redir = confirm("Has entrat com a usuari " + username + " anteriorment, vols tornar-ho a fer?");
 					if (redir) window.location.href = 'main.php';
diff --git a/js/utils.js b/js/utils.js
index 47ab686..cc6e2a6 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -67,3 +67,8 @@
 			console.log(response);
 	}});	
 }
+
+function get_user_name(users, userid) {
+	for (let user of users) if (user.id == userid) return user.nomcomplet;
+	return "";
+}