Dynamic messaging
diff --git a/js/confirmation.js b/js/confirmation.js
deleted file mode 100644
index 9f74bfb..0000000
--- a/js/confirmation.js
+++ /dev/null
@@ -1,18 +0,0 @@
-if (mort) {
-	// User is dead
-	document.write("Venga niño, pitjor que el Condom, MORT.");
-} else {				
-	let dead = false;
-	let killed = false;
-	
-	if (requested != 0) {
-		// Check for requests
-		if(requested == 1) dead = confirm("El teu assassí ha dit que t'ha matat, és veritat?");
-		if(requested == 2) killed = confirm("En/na " + victimnom + " ha dit que l'has matat, és veritat?");
-		
-		// Confirm/deny request
-		if (dead) send_request(userid, 3); // confirm death
-		else if (killed) send_request(victimid, 3); // confirm kill
-		else send_request(userid, 4); // deny kill/death
-	}
-}
diff --git a/js/utils.js b/js/utils.js
index c0d538a..d560bb0 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -24,3 +24,22 @@
 		}
 	});
 }
+
+function check_requests(requested, victimnom, victimid, userid) {			
+	let dead = false;
+	let killed = false;
+	
+	if (requested != 0) {
+		// Check for requests
+		if(requested == 1) dead = confirm("El teu assassí ha dit que t'ha matat, és veritat?");
+		if(requested == 2) killed = confirm("En/na " + victimnom + " ha dit que l'has matat, és veritat?");
+		
+		// Confirm/deny request
+		if (dead) send_request(userid, 3); // confirm death
+		else if (killed) send_request(victimid, 3); // confirm kill
+		else send_request(userid, 4); // deny kill/death
+	}	
+
+	// Reset
+	return requested = 0;
+}
diff --git a/main.php b/main.php
index 4d34a59..c4b261c 100644
--- a/main.php
+++ b/main.php
@@ -9,7 +9,9 @@
 		<script src="https://rawgit.com/notifyjs/notifyjs/master/dist/notify.js"></script>
 		<script src="./js/utils.js"></script>
 		
-		<? require './php/login.php'; ?>
+		<?php 
+			require './php/login.php';
+		?>
 		
 		<script>
 			let mort = <?=$user->mort?>;
@@ -18,14 +20,14 @@
 			let victimid = <?=$victim->id?>;
 			let victimnom = "<?=$victim->nom()?>";
 		</script>
-		
-		<script src="./js/confirmation.js"></script>
+	
 	</head>
 	<body>
 		<div id="outter-container">
 			<div id="inner-container">
 				<h2>Hola <name id="user_name"><?=$user->nom()?></name>,</h2>
 				<h3>La teva víctima és:</h3>
+				<div style="display:none;" id="state">0</div>
 				
 				<div class="victima">
 					<img width="300px" src="./imgs/<?=$victim->id?>.png" />
@@ -40,7 +42,17 @@
 		</div>
 		
 		<script>
-			
+			$(document).ready(function() {
+				let checking = setInterval(function() {
+					$.ajax({ url: "./php/checkrequests.php", data: { id: userid }, type: 'GET',
+						success: function(data) {
+							$("#state").load("./php/checkrequests.php?id=" + userid, function() {
+								if (!mort) requested = check_requests($("#state").html(), victimnom, victimid, userid);
+								else clearInterval(checking);
+							});
+						}});
+				}, 1000);
+			});
 		</script>
 	</body>
 </html>
diff --git a/php/checkrequests.php b/php/checkrequests.php
new file mode 100644
index 0000000..4995ac4
--- /dev/null
+++ b/php/checkrequests.php
@@ -0,0 +1,32 @@
+<?php
+	// Get the id
+	$id = $_GET['id'];
+	
+	// Define MySQL login variables
+	$servername = "localhost"; // "fdb22.awardspace.net";
+	$username = "root"; // "3155560_users";
+	$password = ""; // "btechnoro@fox4news.info";
+
+	// Create connection
+	$conn = new mysqli($servername, $username, $password, "pastanaga");
+	if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
+	$conn->set_charset("utf8");
+	
+	// Do the query
+	$query = "SELECT requested FROM users WHERE id=".$id;
+	$state = 0;
+
+	// Fetch the information of the user
+	if ($result = $conn->query($query)) {
+		while ($row = $result->fetch_row()) $state = $row[0];
+		$result->close();
+	} else {
+		die("Wrong query: " . $query);
+	}
+
+	// Close connection
+	$conn->close();
+	
+	// Print the state
+	echo $state;
+?>