Andreu | dca79f4 | 2019-09-18 23:53:19 +0200 | [diff] [blame^] | 1 | <?php |
| 2 | // Get the id |
| 3 | $id = $_GET['id']; |
| 4 | |
| 5 | // Define MySQL login variables |
| 6 | $servername = "localhost"; // "fdb22.awardspace.net"; |
| 7 | $username = "root"; // "3155560_users"; |
| 8 | $password = ""; // "btechnoro@fox4news.info"; |
| 9 | |
| 10 | // Create connection |
| 11 | $conn = new mysqli($servername, $username, $password, "pastanaga"); |
| 12 | if ($conn->connect_error) die("Connection failed: " . $conn->connect_error); |
| 13 | $conn->set_charset("utf8"); |
| 14 | |
| 15 | // Do the query |
| 16 | $query = "SELECT requested FROM users WHERE id=".$id; |
| 17 | $state = 0; |
| 18 | |
| 19 | // Fetch the information of the user |
| 20 | if ($result = $conn->query($query)) { |
| 21 | while ($row = $result->fetch_row()) $state = $row[0]; |
| 22 | $result->close(); |
| 23 | } else { |
| 24 | die("Wrong query: " . $query); |
| 25 | } |
| 26 | |
| 27 | // Close connection |
| 28 | $conn->close(); |
| 29 | |
| 30 | // Print the state |
| 31 | echo $state; |
| 32 | ?> |