Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 1 | <?php |
| 2 | // Define MySQL login variables |
Andreu | ed8e1f9 | 2019-09-18 22:26:04 +0200 | [diff] [blame] | 3 | $servername = "localhost"; // "fdb22.awardspace.net"; |
| 4 | $username = "root"; // "3155560_users"; |
| 5 | $password = ""; // "btechnoro@fox4news.info"; |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 6 | |
| 7 | // Create connection |
Andreu | ed8e1f9 | 2019-09-18 22:26:04 +0200 | [diff] [blame] | 8 | $conn = new mysqli($servername, $username, $password, "pastanaga"); |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 9 | if ($conn->connect_error) die("Connection failed: " . $conn->connect_error); |
| 10 | $conn->set_charset("utf8"); |
| 11 | |
| 12 | // Do the query |
| 13 | $query = ""; |
Andreu | 885889c | 2019-09-19 00:28:20 +0200 | [diff] [blame] | 14 | $query2 = ""; |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame^] | 15 | if ($_GET['msg'] == "REQ KILL") $query = "UPDATE users SET requested=1 WHERE id=".(int)$_GET['victim_id']; // request kill |
| 16 | if ($_GET['msg'] == "REQ DEAD") $query = "UPDATE users SET requested=2 WHERE quimata=".(int)$_GET['user_id']; // request dead |
| 17 | if ($_GET['msg'] == "CONF DEAD") { |
| 18 | // User gets killed |
| 19 | $query = "UPDATE users SET requested=0, quimata=".(int)$_GET['user_quimata']." WHERE quimata=".$_GET['user_id']; // assign new victim to killer |
| 20 | $query2 = "UPDATE users SET quimata=0, mort=1 WHERE id=".(int)$_GET['user_id']; // confirm victim dead/killed |
Andreu | 885889c | 2019-09-19 00:28:20 +0200 | [diff] [blame] | 21 | } |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame^] | 22 | if ($_GET['msg'] == "CONF KILL") { |
| 23 | // Victim gets killed |
| 24 | $query = "UPDATE users SET requested=0, quimata=".(int)$_GET['victim_quimata']." WHERE quimata=".$_GET['victim_id']; // assign new victim to killer |
| 25 | $query2 = "UPDATE users SET quimata=0, mort=1 WHERE id=".(int)$_GET['victim_id']; // confirm victim dead/killed |
| 26 | } |
| 27 | if ($_GET['msg'] == "DENY REQ") $query = "UPDATE users SET requested=0 WHERE id=".(int)$_GET['user_id']; // deny request |
Andreu | ffefd22 | 2019-09-19 11:09:44 +0200 | [diff] [blame] | 28 | |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 29 | // Fetch the information of the user |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame^] | 30 | if ($query != "" and $result = $conn->query($query)) echo $query; |
Andreu | 57f3ca9 | 2019-09-18 19:40:42 +0200 | [diff] [blame] | 31 | else die("Wrong query: " . $query); |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame^] | 32 | if ($query2 != "" and $result = $conn->query($query2)) echo "\n" . $query2; |
| 33 | else echo "\nNo second query"; |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 34 | |
| 35 | // Close connection |
| 36 | $conn->close(); |
| 37 | ?> |