2020-10-11 21:11:46 +03:00
|
|
|
<?php
|
|
|
|
//NOVETUS MASTER SERVER QUERY CODE
|
|
|
|
|
|
|
|
//server name
|
2021-03-24 23:23:23 +02:00
|
|
|
$name = $_GET["name"];
|
2020-10-11 21:11:46 +03:00
|
|
|
//server ip
|
2021-03-24 23:23:23 +02:00
|
|
|
$ip = $_GET["ip"];
|
2020-10-11 21:11:46 +03:00
|
|
|
//server port
|
2021-03-24 23:23:23 +02:00
|
|
|
$port = $_GET["port"];
|
2020-10-11 21:11:46 +03:00
|
|
|
//client name
|
2021-03-24 23:23:23 +02:00
|
|
|
$client = $_GET["client"];
|
2020-10-11 21:11:46 +03:00
|
|
|
//online status
|
2021-03-24 23:23:23 +02:00
|
|
|
$online = $_GET["online"];
|
2020-10-11 21:11:46 +03:00
|
|
|
|
|
|
|
//strings
|
|
|
|
$deleteentry = 1;
|
|
|
|
$status = "Offline";
|
|
|
|
|
|
|
|
//ONLY the $name and $client arguments will show up in the master server!
|
|
|
|
$file = 'serverlist.txt';
|
2021-03-25 01:26:26 +02:00
|
|
|
$text = base64_encode(base64_encode($name).'|'.base64_encode($ip).'|'.base64_encode($port).'|'.base64_encode($client))."\r\n";
|
2020-10-11 21:11:46 +03:00
|
|
|
|
|
|
|
if ($online == 1)
|
|
|
|
{
|
|
|
|
$deleteentry = 0;
|
2021-03-24 23:23:23 +02:00
|
|
|
|
2021-03-25 01:26:26 +02:00
|
|
|
foreach(file($file) as $line)
|
2020-10-11 21:11:46 +03:00
|
|
|
{
|
2021-03-24 23:23:23 +02:00
|
|
|
if (strpos($line, $text) !== false)
|
|
|
|
{
|
|
|
|
$file_contents = file_get_contents($file);
|
|
|
|
$contents = str_replace($line, '', $file_contents);
|
|
|
|
file_put_contents($file, $contents);
|
|
|
|
}
|
2020-10-11 21:11:46 +03:00
|
|
|
}
|
2021-03-24 23:23:23 +02:00
|
|
|
|
2021-03-25 01:26:26 +02:00
|
|
|
file_put_contents($file, $text, FILE_APPEND);
|
2021-03-24 23:23:23 +02:00
|
|
|
|
2020-10-11 21:11:46 +03:00
|
|
|
$status = "Online";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($deleteentry == 1)
|
|
|
|
{
|
2021-03-24 23:23:23 +02:00
|
|
|
foreach(file($file) as $line)
|
|
|
|
{
|
|
|
|
if (strpos($line, $text) !== false)
|
|
|
|
{
|
|
|
|
$file_contents = file_get_contents($file);
|
|
|
|
$contents = str_replace($line, '', $file_contents);
|
|
|
|
file_put_contents($file, $contents);
|
|
|
|
}
|
|
|
|
}
|
2020-10-11 21:11:46 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Display the server info to browsers.
|
2020-10-11 21:30:46 +03:00
|
|
|
echo "$name.<br>A $client server.<br>Server Status: $status";
|
2020-10-11 21:11:46 +03:00
|
|
|
?>
|