mirror of https://github.com/TildeNIC/site.git
added banner exchange banner
This commit is contained in:
parent
f1064e37f8
commit
ce7cb2fc14
|
@ -1,141 +1,148 @@
|
||||||
<?php
|
<?php
|
||||||
require_once 'initdb.php';
|
require_once 'initdb.php';
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
// Logout handling
|
// Logout handling
|
||||||
if (isset($_GET['action']) && $_GET['action'] == 'logout') {
|
if (isset($_GET['action']) && $_GET['action'] == 'logout') {
|
||||||
session_destroy();
|
session_destroy();
|
||||||
header('Location: /');
|
header('Location: /');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to get DNS server information from BIND files
|
// Function to get DNS server information from BIND files
|
||||||
function getDnsServersInfo() {
|
function getDnsServersInfo() {
|
||||||
$masterFile = '../dottilde/db.master.tilde';
|
$masterFile = '../dottilde/db.master.tilde';
|
||||||
$servers = [];
|
$servers = [];
|
||||||
$nsFilter = ['ns1', 'ns2', 'ns3']; // Add more nameserver identifiers as needed
|
$nsFilter = ['ns1', 'ns2', 'ns3']; // Add more nameserver identifiers as needed
|
||||||
|
|
||||||
// Manually assigned geographical areas for each nameserver
|
// Manually assigned geographical areas for each nameserver
|
||||||
$nsGeographicalAreas = [
|
$nsGeographicalAreas = [
|
||||||
'ns1' => 'Quebec, Canada', // Replace with actual locations
|
'ns1' => 'Quebec, Canada', // Replace with actual locations
|
||||||
'ns2' => 'Frankfurt, Germany',
|
'ns2' => 'Frankfurt, Germany',
|
||||||
'ns3' => 'Sydney, Australia',
|
'ns3' => 'Sydney, Australia',
|
||||||
// Add more as needed
|
// Add more as needed
|
||||||
];
|
];
|
||||||
|
|
||||||
if (file_exists($masterFile)) {
|
if (file_exists($masterFile)) {
|
||||||
$content = file_get_contents($masterFile);
|
$content = file_get_contents($masterFile);
|
||||||
// Regex to match A records (IPv4)
|
// Regex to match A records (IPv4)
|
||||||
preg_match_all('/(\S+)\s+IN\s+A\s+(\S+)/', $content, $aMatches);
|
preg_match_all('/(\S+)\s+IN\s+A\s+(\S+)/', $content, $aMatches);
|
||||||
// Regex to match AAAA records (IPv6)
|
// Regex to match AAAA records (IPv6)
|
||||||
preg_match_all('/(\S+)\s+IN\s+AAAA\s+(\S+)/', $content, $aaaaMatches);
|
preg_match_all('/(\S+)\s+IN\s+AAAA\s+(\S+)/', $content, $aaaaMatches);
|
||||||
|
|
||||||
$ipv4Records = array_combine($aMatches[1], $aMatches[2]);
|
$ipv4Records = array_combine($aMatches[1], $aMatches[2]);
|
||||||
$ipv6Records = array_combine($aaaaMatches[1], $aaaaMatches[2]);
|
$ipv6Records = array_combine($aaaaMatches[1], $aaaaMatches[2]);
|
||||||
|
|
||||||
foreach ($nsFilter as $nsName) {
|
foreach ($nsFilter as $nsName) {
|
||||||
$ipv4 = isset($ipv4Records[$nsName]) ? $ipv4Records[$nsName] : 'IPv4 not found';
|
$ipv4 = isset($ipv4Records[$nsName]) ? $ipv4Records[$nsName] : 'IPv4 not found';
|
||||||
$ipv6 = isset($ipv6Records[$nsName]) ? $ipv6Records[$nsName] : 'IPv6 not found';
|
$ipv6 = isset($ipv6Records[$nsName]) ? $ipv6Records[$nsName] : 'IPv6 not found';
|
||||||
$geographicalArea = isset($nsGeographicalAreas[$nsName]) ? $nsGeographicalAreas[$nsName] : 'Unknown Location';
|
$geographicalArea = isset($nsGeographicalAreas[$nsName]) ? $nsGeographicalAreas[$nsName] : 'Unknown Location';
|
||||||
|
|
||||||
$servers[] = [
|
$servers[] = [
|
||||||
'hostname' => $nsName,
|
'hostname' => $nsName,
|
||||||
'ipv4' => $ipv4,
|
'ipv4' => $ipv4,
|
||||||
'ipv6' => $ipv6,
|
'ipv6' => $ipv6,
|
||||||
'location' => $geographicalArea
|
'location' => $geographicalArea
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $servers;
|
return $servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dnsServers = getDnsServersInfo();
|
$dnsServers = getDnsServersInfo();
|
||||||
|
|
||||||
// Modified checkServerStatus function
|
// Modified checkServerStatus function
|
||||||
function checkServerStatus($server) {
|
function checkServerStatus($server) {
|
||||||
$port = 53; // DNS port, change if necessary
|
$port = 53; // DNS port, change if necessary
|
||||||
$timeout = 30; // Timeout in seconds
|
$timeout = 30; // Timeout in seconds
|
||||||
|
|
||||||
// Debug: Output the server being checked
|
// Debug: Output the server being checked
|
||||||
# echo "Checking status of server: $server<br>";
|
# echo "Checking status of server: $server<br>";
|
||||||
|
|
||||||
$fp = @fsockopen($server, $port, $errno, $errstr, $timeout);
|
$fp = @fsockopen($server, $port, $errno, $errstr, $timeout);
|
||||||
|
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
# echo "Server $server is Online<br>"; // Debug: Server is online
|
# echo "Server $server is Online<br>"; // Debug: Server is online
|
||||||
return "Online";
|
return "Online";
|
||||||
} else {
|
} else {
|
||||||
# echo "Server $server is Offline - Error: $errstr ($errno)<br>"; // Debug: Server is offline
|
# echo "Server $server is Offline - Error: $errstr ($errno)<br>"; // Debug: Server is offline
|
||||||
return "Offline";
|
return "Offline";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>|--===TildeNIC ===--| Bringing .tilde to the Tildeverse!</title>
|
<title>|--===TildeNIC ===--| Bringing .tilde to the Tildeverse!</title>
|
||||||
<link rel="stylesheet" href="css/styles.css">
|
<link rel="stylesheet" href="css/styles.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<nav>
|
<nav>
|
||||||
<?php if (!isset($_SESSION['username'])): ?>
|
<?php if (!isset($_SESSION['username'])): ?>
|
||||||
<a href="/?page=main">Home</a> |
|
<a href="/?page=main">Home</a> |
|
||||||
<a href="/?page=login">Login</a> |
|
<a href="/?page=login">Login</a> |
|
||||||
<a href="/?page=register">Register</a> |
|
<a href="/?page=register">Register</a> |
|
||||||
<a href="/?page=whois">WHOIS</a>
|
<a href="/?page=whois">WHOIS</a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<a href="/?page=main">Home</a> |
|
<a href="/?page=main">Home</a> |
|
||||||
<a href="/?page=user_domains">My Account</a> |
|
<a href="/?page=user_domains">My Account</a> |
|
||||||
<a href="/?page=domain_register">Register Domain</a> |
|
<a href="/?page=domain_register">Register Domain</a> |
|
||||||
<a href="/?page=whois">WHOIS</a> |
|
<a href="/?page=whois">WHOIS</a> |
|
||||||
<a href="/?page=main&action=logout">Logout</a><br><br>
|
<a href="/?page=main&action=logout">Logout</a><br><br>
|
||||||
<span>Welcome, <?php echo htmlspecialchars($_SESSION['username']); ?></span>
|
<span>Welcome, <?php echo htmlspecialchars($_SESSION['username']); ?></span>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h1>Welcome to TildeNIC</h1>
|
<h1>Welcome to TildeNIC</h1>
|
||||||
<div class="info-section">
|
<div class="info-section">
|
||||||
<p>TildeNIC is where you can request your .tilde top level domain. To do so, you need to first change your DNS over to one of the resolvers we offer, or you can self-host one.</p>
|
<p>TildeNIC is where you can request your .tilde top level domain. To do so, you need to first change your DNS over to one of the resolvers we offer, or you can self-host one.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://tildegit.org/tildenic/.tilde/wiki/Setting-up-a-.tilde-DNS-server" target="_blank">Self-host information</a></li>
|
<li><a href="https://tildegit.org/tildenic/.tilde/wiki/Setting-up-a-.tilde-DNS-server" target="_blank">Self-host information</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<h3>
|
<h3>
|
||||||
<a href="https://opennic.org/" target="_blank">OpenNIC Information</a>
|
<a href="https://opennic.org/" target="_blank">OpenNIC Information</a>
|
||||||
</h3>
|
</h3>
|
||||||
<p>
|
<p>
|
||||||
Domains offered by OpenNIC are also able to be resolved using our servers, Such as:
|
Domains offered by OpenNIC are also able to be resolved using our servers, Such as:
|
||||||
<ul>
|
<ul>
|
||||||
<li>.geek</li>
|
<li>.geek</li>
|
||||||
<li>.bbs</li>
|
<li>.bbs</li>
|
||||||
<li>.gopher and more.</li>
|
<li>.gopher and more.</li>
|
||||||
</ul>
|
</ul>
|
||||||
Will all resolve using our dns servers. For more information about OpenNIC you can visit <a href="https://opennic.org/" target="_blank">http://opennic.org</a>
|
Will all resolve using our dns servers. For more information about OpenNIC you can visit <a href="https://opennic.org/" target="_blank">http://opennic.org</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="server-list">
|
<div class="server-list">
|
||||||
<h2>TildeNIC Available DNS Servers</h2>
|
<h2>TildeNIC Available DNS Servers</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach ($dnsServers as $server): ?>
|
<?php foreach ($dnsServers as $server): ?>
|
||||||
<li>
|
<li>
|
||||||
<?php echo htmlspecialchars($server['hostname']); ?> -
|
<?php echo htmlspecialchars($server['hostname']); ?> -
|
||||||
IPv4: <?php echo htmlspecialchars($server['ipv4']); ?>,
|
IPv4: <?php echo htmlspecialchars($server['ipv4']); ?>,
|
||||||
IPv6: <?php echo htmlspecialchars($server['ipv6']); ?>,
|
IPv6: <?php echo htmlspecialchars($server['ipv6']); ?>,
|
||||||
Location: <?php echo htmlspecialchars($server['location']); ?> -
|
Location: <?php echo htmlspecialchars($server['location']); ?> -
|
||||||
<span class="status <?php echo checkServerStatus($server['hostname']) === 'Online' ? 'online' : 'offline'; ?>">
|
<span class="status <?php echo checkServerStatus($server['hostname']) === 'Online' ? 'online' : 'offline'; ?>">
|
||||||
<?php echo checkServerStatus($server['hostname']); ?>
|
<?php echo checkServerStatus($server['hostname']); ?>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
<footer>
|
||||||
|
<!-- Tildeverse Banner Exchange code begin -->
|
||||||
|
<div style="text-align: center;">
|
||||||
|
<iframe src="https://banner.tildeverse.org/work.php?ID=tildenic" width="468" height="60" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" target="_blank"></iframe>
|
||||||
|
</div>
|
||||||
|
<!-- Tildeverse Banner Exchange code end -->
|
||||||
|
</footer>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue