Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Credentials
- =================================================== */
- $servername = "localhost";
- $database = "database";
- $username = "username";
- $password = "password";
- /* Create connection
- =================================================== */
- $conn = new mysqli($servername, $database, $username, $password);
- /* Check's connection
- =================================================== */
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- ?>
- <?php
- /* Get's main informations
- =================================================== */
- $sr_ip = $_GET["ip"];
- $sr_port = 9339;
- /* Create Status
- =================================================== */
- if ($sr_status = @fsockopen($sr_ip,$sr_port,$errno,$errstr)) {
- fclose($sr_status);
- $sql = "UPDATE status='Online' WHERE ip='" . $sr_ip ."'";
- if ($conn->query($sql) === TRUE) {
- echo '<span style="color:green;">Online</span>';
- }
- } else {
- $sql = "UPDATE status='offline' WHERE ip='" . $sr_ip ."'";
- if ($conn->query($sql) === TRUE) {
- echo '<span style="color:red;">Offline</span>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement