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 | abbcb7e | 2019-09-21 18:22:14 +0200 | [diff] [blame^] | 15 | |
| 16 | $victimid = "ANY (SELECT quimata FROM users WHERE id=".(int)$_GET['user_id'].")"; |
| 17 | |
| 18 | if ($_GET['msg'] == "REQ KILL") $query = "UPDATE users SET requested=1 WHERE id=".$victimid; // request kill |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame] | 19 | if ($_GET['msg'] == "REQ DEAD") $query = "UPDATE users SET requested=2 WHERE quimata=".(int)$_GET['user_id']; // request dead |
| 20 | if ($_GET['msg'] == "CONF DEAD") { |
| 21 | // User gets killed |
Andreu | abbcb7e | 2019-09-21 18:22:14 +0200 | [diff] [blame^] | 22 | $query = "UPDATE users SET requested=0, quimata=".(int)$_GET['user_quimata']." WHERE quimata=".(int)$_GET['user_id']; // assign new victim to killer |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame] | 23 | $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] | 24 | } |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame] | 25 | 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] | 26 | |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 27 | // Fetch the information of the user |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame] | 28 | if ($query != "" and $result = $conn->query($query)) echo $query; |
Andreu | 57f3ca9 | 2019-09-18 19:40:42 +0200 | [diff] [blame] | 29 | else die("Wrong query: " . $query); |
Andreu | ed49167 | 2019-09-20 13:09:18 +0200 | [diff] [blame] | 30 | if ($query2 != "" and $result = $conn->query($query2)) echo "\n" . $query2; |
| 31 | else echo "\nNo second query"; |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 32 | |
| 33 | // Close connection |
| 34 | $conn->close(); |
| 35 | ?> |