Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 1 | <?php |
Andreu | 2457e40 | 2019-09-22 00:52:41 +0200 | [diff] [blame] | 2 | require '../credentials.php'; |
Andreu | 20cbd1d | 2019-09-22 00:00:57 +0200 | [diff] [blame] | 3 | require 'utils.php'; |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 4 | |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 5 | // Do the query |
Andreu | efe66eb | 2019-09-21 18:41:49 +0200 | [diff] [blame] | 6 | $queries = [""]; |
Andreu | 2a26cd7 | 2019-09-22 01:58:23 +0200 | [diff] [blame] | 7 | $victimid = "ANY (SELECT quimata FROM (SELECT * FROM users) AS victims WHERE id=".(int)$_POST['user_id'].")"; |
Andreu | abbcb7e | 2019-09-21 18:22:14 +0200 | [diff] [blame] | 8 | |
Andreu | 20cbd1d | 2019-09-22 00:00:57 +0200 | [diff] [blame] | 9 | if ($_POST['msg'] == "REQ KILL") $queries = ["UPDATE users SET requested=1 WHERE id=".$victimid]; // request kill |
| 10 | if ($_POST['msg'] == "REQ DEAD") $queries = ["UPDATE users SET requested=2 WHERE quimata=".(int)$_POST['user_id']]; // request dead |
| 11 | if ($_POST['msg'] == "DENY REQ") $queries = ["UPDATE users SET requested=0 WHERE id=".(int)$_POST['user_id']]; // deny request |
Andreu | 09b8b05 | 2019-09-21 21:47:20 +0200 | [diff] [blame] | 12 | if ($_POST['msg'] == "CONF DEAD") { |
Andreu | 20cbd1d | 2019-09-22 00:00:57 +0200 | [diff] [blame] | 13 | $queries = ["UPDATE users SET requested=0, quimata=".(int)$_POST['user_quimata']." WHERE quimata=".(int)$_POST['user_id'], // assign new victim to killer |
| 14 | "UPDATE users SET quimata=0, mort=1 WHERE id=".(int)$_POST['user_id']]; // confirm victim dead/killed |
Andreu | 885889c | 2019-09-19 00:28:20 +0200 | [diff] [blame] | 15 | } |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 16 | // Fetch the information of the user |
Andreu | efe66eb | 2019-09-21 18:41:49 +0200 | [diff] [blame] | 17 | foreach ($queries as $query) { |
Andreu | 20cbd1d | 2019-09-22 00:00:57 +0200 | [diff] [blame] | 18 | if ($query != "" and $result = query($query)) echo $query; |
Andreu | 2a26cd7 | 2019-09-22 01:58:23 +0200 | [diff] [blame] | 19 | else die("Query failed: " . $result); |
Andreu | efe66eb | 2019-09-21 18:41:49 +0200 | [diff] [blame] | 20 | } |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 21 | ?> |