LoGD Standardrelease steht hier zum Download zur Verfügung!
<?php
/*
2024-05-07 aragon change of logdnet call, because something seems buggy
2024-05-19 aragon update, just commented the method call, udpate logic
*/
require_once "common.php";
function fetchlogdnet()
{
try {
$servers = file(getsetting("logdnetserver", "http://lotgd.net/") . "logdnet.php?op=net");
foreach ($servers as $val) {
$row = unserialize($val);
// $desc = stripslashes(HTMLEntities($row['description']));
$desc = $row['description'];
$desc = str_replace("``", "`", $desc);
if (trim($desc) == "") {
$desc = "Another LoGD Server";
}
$ver = strip_tags($row['version']);
//$ver = HTMLEntities($ver);
if (trim($ver) == "" || $ver == null) {
$ver = "`iUnknown Version`i";
}
//$ver = strip_tags($ver);
//$ver = str_replace("</font>",$ver);
// if (substr($row['address'],0,7)!="http://"){
// }else{
output("<tr>", true);
output("<td valign='top'><a href='" . HTMLEntities($row['address']) . "' target='_blank'>" . $desc . "`0</a></td>", true);
output("<td valign='top'>`&" . $ver . "</td>", true);
output("</tr>", true);
// }
}
} catch (Exception $ex) {
output("could not fetch logdnet servers ...");
}
}
function addServer($addy, $desc = '', $version = null)
{
$sql = "INSERT INTO logdnet (address,description,lastupdate) VALUES ('" . $addy . "','" . soap($desc) . "',now())";
$result = db_query($sql);
}
function listLogdServers()
{
$sql = "SELECT address,description FROM logdnet WHERE lastupdate > '" . date("Y-m-d H:i:s", strtotime("-7 days")) . "' ORDER BY priority DESC";
$result = db_query($sql);
while ($row = db_fetch_assoc($result)) {
output("<tr>", true);
output("<td valign='top'><a href='" . $row['address'] . "' target='_blank'>" . ($row['description'] ?? 'unknown') . "`0</a></td>", true);
output("<td valign='top'>`&unknown</td>", true);
output("</tr>", true);
}
}
$op = $_GET['op'] ?? null;
$addy = $_GET['addy'] ?? "";
$desc = $_GET['desc'] ?? "";
$version = $_GET['version'] ?? "";
if ($op == "") {
$sql = "SELECT lastupdate,serverid FROM logdnet WHERE address='" . $addy . "'";
$result = db_query($sql);
$row = db_fetch_assoc($result);
if (db_num_rows($result) > 0) {
if (strtotime($row['lastupdate']) < strtotime("-1 minutes")) {
//echo strtotime($row[lastupdate])."<br>".strtotime("-5 minutes");
$sql = "UPDATE logdnet SET priority=priority*0.99";
db_query($sql);
//use PHP server time for lastupdate in case mysql server and PHP server have different times.
$sql = "UPDATE logdnet SET priority=priority+1,description='" . soap($desc) . "',lastupdate='" . date("Y-m-d H:i:s") . "' WHERE serverid={$row['serverid']}";
//echo $sql;
db_query($sql);
echo "Ok - upgedated";
} else {
echo "Ok - noch zu früh für ein Update";
}
} else {
addServer($addy, $desc);
echo "Ok - hinzugefügt";
}
} elseif ($op == "net") {
$sql = "SELECT address,description FROM logdnet WHERE lastupdate > '" . date("Y-m-d H:i:s", strtotime("-7 days")) . "' ORDER BY priority DESC";
$result = db_query($sql);
for ($i = 0; $i < db_num_rows($result); $i++) {
$row = db_fetch_assoc($result);
$row = serialize($row);
echo $row . "\n";
}
} else {
page_header("LoGD Netz");
//$sql = "SELECT * FROM logdnet ORDER BY priority DESC";
//$result=db_query($sql);
addnav("Zurück zum Login", "index.php");
output("`@Eine Liste mit anderen LoGD Servern, die im LoGD-Netz registriert sind. (Sortiert nach Logins)`n`n");
output('<style> table.logdnet { border-collapse: collapse; padding: .1rem; } table.logdnet, table.logdnet tr td {border: 1px solid; }</style>', true);
output("<table class=\"logdnet\">", true);
output("<thead><tr class=\"trhead\"><td>`@`bServername und Link`b`0</td><td >`@`bVersion`b`0</td></tr></thead>", true);
output("<tbody>", true);
listLogdServers();
// fetchlogdnet();
output("</tody>", true);
output("</table>", true);
page_footer();
}