Fully operational SQL
diff --git a/php/checkrequests.php b/php/checkrequests.php
deleted file mode 100644
index 4995ac4..0000000
--- a/php/checkrequests.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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;
-?>
diff --git a/php/getusers.php b/php/getusers.php
deleted file mode 100644
index b23c8c0..0000000
--- a/php/getusers.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-	// 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 * FROM users";
-
-	// Fetch the information of the user
-	if ($result = $conn->query($query)) {
-		while ($row = $result->fetch_row()) {
-			$id = $row[0];
-			$nomcomplet = $row[1];
-			$curs = $row[2];
-			$grau = $row[3];
-			$quimata = $row[4];
-			
-			// Echo the options
-			echo "<option value='".$id."'>".$nomcomplet."</option>\n";
-		}
-		$result->close();
-	} else {
-		die("Wrong query: " . $query);
-	}
-
-	// Close connection
-	$conn->close();
-?>
diff --git a/php/login.php b/php/login.php
index 2dd713e..4dd5ee7 100644
--- a/php/login.php
+++ b/php/login.php
@@ -1,55 +1,6 @@
 <?php
-	class User{
-		public $id;
-		public $nomcomplet;
-		public $curs;
-		public $grau;
-		public $quimata;
-		
-		public function nom() {
-			$noms = explode(" ", $this->nomcomplet);
-			return $noms[0];
-		}
-	}
-	
-	function get_user($id) {
-		$user = new User();
-		
-		// 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 * FROM users WHERE id=".$id;
-
-		// Fetch the information of the user
-		if ($result = $conn->query($query)) {
-			while ($row = $result->fetch_row()) {
-				$user->id = $row[0];
-				$user->nomcomplet = $row[1];
-				$user->curs = $row[2];
-				$user->grau = $row[3];
-				$user->quimata = $row[4];
-				$user->requested = $row[5];
-				$user->mort = $row[6];
-			}
-			$result->close();
-		} else {
-			die("Wrong query: " . $query);
-		}
-
-		// Close connection
-		$conn->close();
-		
-		return $user;
-	}
-	
-	$user = get_user($_GET['user']);
-	$victim = get_user($user->quimata);
+	require 'utils.php';
+	$user = get_users($_GET['user']);
+	$victim = get_users($user->quimata);
+	if ($user->mort) die("Puto mort de merda");
 ?>
diff --git a/php/request.php b/php/request.php
index 1a34cdf..ae4e3bb 100644
--- a/php/request.php
+++ b/php/request.php
@@ -12,18 +12,16 @@
 	// Do the query
 	$query = "";
 	$query2 = "";
-	if ($_GET['msg'] == "REQ KILL") $query = "UPDATE users SET requested=1 WHERE id=".(int)$_GET['victim_id']; // request kill
+	
+	$victimid = "ANY (SELECT quimata FROM users WHERE id=".(int)$_GET['user_id'].")";
+	
+	if ($_GET['msg'] == "REQ KILL") $query = "UPDATE users SET requested=1 WHERE id=".$victimid; // request kill
 	if ($_GET['msg'] == "REQ DEAD") $query = "UPDATE users SET requested=2 WHERE quimata=".(int)$_GET['user_id']; // request dead
 	if ($_GET['msg'] == "CONF DEAD") {
 		// User gets killed
-		$query = "UPDATE users SET requested=0, quimata=".(int)$_GET['user_quimata']." WHERE quimata=".$_GET['user_id']; // assign new victim to killer
+		$query = "UPDATE users SET requested=0, quimata=".(int)$_GET['user_quimata']." WHERE quimata=".(int)$_GET['user_id']; // assign new victim to killer
 		$query2 = "UPDATE users SET quimata=0, mort=1 WHERE id=".(int)$_GET['user_id']; // confirm victim dead/killed
 	}
-	if ($_GET['msg'] == "CONF KILL") {
-		// Victim gets killed
-		$query = "UPDATE users SET requested=0, quimata=".(int)$_GET['victim_quimata']." WHERE quimata=".$_GET['victim_id']; // assign new victim to killer
-		$query2 = "UPDATE users SET quimata=0, mort=1 WHERE id=".(int)$_GET['victim_id']; // confirm victim dead/killed
-	}
 	if ($_GET['msg'] == "DENY REQ") $query = "UPDATE users SET requested=0 WHERE id=".(int)$_GET['user_id']; // deny request
 
 	// Fetch the information of the user
diff --git a/php/utils.php b/php/utils.php
new file mode 100644
index 0000000..c6147fd
--- /dev/null
+++ b/php/utils.php
@@ -0,0 +1,58 @@
+<?php
+	class User{
+		public $id;
+		public $nomcomplet;
+		public $curs;
+		public $grau;
+		public $quimata;
+		
+		public function nom() {
+			$noms = explode(" ", $this->nomcomplet);
+			return $noms[0];
+		}
+	}
+	
+	function get_users($id = 0) {
+		$users = [];
+		
+		// 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 * FROM users";
+		if ($id > 0) $query .= " WHERE id=".$id;
+
+		// Fetch the information of the user
+		if ($result = $conn->query($query)) {
+			while ($row = $result->fetch_row()) {
+				$user = new User();
+				
+				$user->id = $row[0];
+				$user->nomcomplet = $row[1];
+				$user->curs = $row[2];
+				$user->grau = $row[3];
+				$user->quimata = $row[4];
+				$user->requested = $row[5];
+				$user->mort = $row[6];
+				
+				array_push($users, $user);
+			}
+			$result->close();
+		} else {
+			die("Wrong query: " . $query);
+		}
+
+		// Close connection
+		$conn->close();
+		
+		if ($id > 0) return $users[0];
+		else return $users;
+	}
+?>