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 | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 15 | if ($_GET['msg'] == 1) $query = "UPDATE users SET requested=".$_GET['msg']." WHERE id=".$_GET['id']; // request kill |
| 16 | if ($_GET['msg'] == 2) $query = "UPDATE users SET requested=".$_GET['msg']." WHERE quimata=".$_GET['id']; // request dead |
Andreu | 885889c | 2019-09-19 00:28:20 +0200 | [diff] [blame^] | 17 | if ($_GET['msg'] == 3) { |
| 18 | $query = "UPDATE users SET mort=1 WHERE id=".$_GET['id']; // confirm dead/killed |
| 19 | $query2 = "UPDATE users SET requested=0 WHERE quimata=".$_GET['id']; // erase request from killer |
| 20 | } |
Andreu | 10cb304 | 2019-09-18 19:55:36 +0200 | [diff] [blame] | 21 | if ($_GET['msg'] == 4) $query = "UPDATE users SET requested=0 WHERE id=".$_GET['id']; // deny request |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 22 | |
| 23 | // Fetch the information of the user |
Andreu | 885889c | 2019-09-19 00:28:20 +0200 | [diff] [blame^] | 24 | if ($result = $conn->query($query)) echo $query; |
Andreu | 57f3ca9 | 2019-09-18 19:40:42 +0200 | [diff] [blame] | 25 | else die("Wrong query: " . $query); |
Andreu | 885889c | 2019-09-19 00:28:20 +0200 | [diff] [blame^] | 26 | if ($result = $conn->query($query2)) echo "\n" . $query2; |
Andreu | 66ad5cf | 2019-09-18 17:15:44 +0200 | [diff] [blame] | 27 | |
| 28 | // Close connection |
| 29 | $conn->close(); |
| 30 | ?> |