bye phar
All checks were successful
Build, Push, Publish / Build & Release (push) Successful in 16m52s
All checks were successful
Build, Push, Publish / Build & Release (push) Successful in 16m52s
This commit is contained in:
@@ -6,7 +6,7 @@ if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
|
||||
}
|
||||
|
||||
include '../dbconfig.php';
|
||||
require '../vendor/aws.phar';
|
||||
require '../vendor/autoload.php';
|
||||
|
||||
use Aws\Route53\Route53Client;
|
||||
use Aws\Exception\AwsException;
|
||||
@@ -40,10 +40,10 @@ if ($aws_result = $link->query($aws_sql)) {
|
||||
// Initialize the Route53 client
|
||||
try {
|
||||
$route53 = new Route53Client([
|
||||
'version' => 'latest',
|
||||
'region' => $region,
|
||||
'version' => 'latest',
|
||||
'region' => $region,
|
||||
'credentials' => [
|
||||
'key' => $access_key_id,
|
||||
'key' => $access_key_id,
|
||||
'secret' => $secret_access_key,
|
||||
],
|
||||
]);
|
||||
@@ -86,7 +86,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['add_ddns'])) {
|
||||
'ResourceRecordSet' => [
|
||||
'Name' => $ddns_fqdn . '.',
|
||||
'Type' => 'A',
|
||||
'TTL' => (int)$ttl,
|
||||
'TTL' => (int) $ttl,
|
||||
'ResourceRecords' => [
|
||||
[
|
||||
'Value' => $initial_ip,
|
||||
@@ -101,7 +101,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['add_ddns'])) {
|
||||
// Create the DNS record in Route53
|
||||
$result = $route53->changeResourceRecordSets([
|
||||
'HostedZoneId' => $hosted_zone_id,
|
||||
'ChangeBatch' => $changeBatch,
|
||||
'ChangeBatch' => $changeBatch,
|
||||
]);
|
||||
|
||||
// Insert the new DDNS entry into the database
|
||||
@@ -168,7 +168,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update_ip'])) {
|
||||
'ResourceRecordSet' => [
|
||||
'Name' => $ddns_fqdn . '.',
|
||||
'Type' => 'A',
|
||||
'TTL' => (int)$new_ttl,
|
||||
'TTL' => (int) $new_ttl,
|
||||
'ResourceRecords' => [
|
||||
[
|
||||
'Value' => $new_ip,
|
||||
@@ -183,7 +183,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update_ip'])) {
|
||||
// Update the DNS record in Route53
|
||||
$result = $route53->changeResourceRecordSets([
|
||||
'HostedZoneId' => $hosted_zone_id,
|
||||
'ChangeBatch' => $changeBatch,
|
||||
'ChangeBatch' => $changeBatch,
|
||||
]);
|
||||
|
||||
// Update the IP and TTL in the database
|
||||
@@ -237,7 +237,7 @@ if (isset($_GET['delete'])) {
|
||||
'ResourceRecordSet' => [
|
||||
'Name' => $ddns_fqdn . '.',
|
||||
'Type' => 'A',
|
||||
'TTL' => (int)$ttl,
|
||||
'TTL' => (int) $ttl,
|
||||
'ResourceRecords' => [
|
||||
[
|
||||
'Value' => $last_ipv4,
|
||||
@@ -252,7 +252,7 @@ if (isset($_GET['delete'])) {
|
||||
// Delete the DNS record in Route53
|
||||
$result = $route53->changeResourceRecordSets([
|
||||
'HostedZoneId' => $hosted_zone_id,
|
||||
'ChangeBatch' => $changeBatch,
|
||||
'ChangeBatch' => $changeBatch,
|
||||
]);
|
||||
|
||||
// Delete the DDNS entry from the database
|
||||
@@ -284,6 +284,7 @@ if ($result = $link->query($sql)) {
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
@@ -295,29 +296,34 @@ if ($result = $link->query($sql)) {
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
th.sortable:hover {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
th.sortable::after {
|
||||
content: '↕';
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
th.sortable.asc::after {
|
||||
content: '↑';
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
th.sortable.desc::after {
|
||||
content: '↓';
|
||||
opacity: 1;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Manage DDNS Entries</h1>
|
||||
|
||||
|
||||
<?php if (isset($error)): ?>
|
||||
<div class="alert alert-error"><?php echo htmlspecialchars($error); ?></div>
|
||||
<?php endif; ?>
|
||||
@@ -329,17 +335,18 @@ if ($result = $link->query($sql)) {
|
||||
<h2>Add New DDNS Entry</h2>
|
||||
<form method="post">
|
||||
<label>DDNS FQDN:</label>
|
||||
<input type="text" name="ddns_fqdn" required placeholder="subdomain.<?php echo htmlspecialchars($approved_fqdn); ?>">
|
||||
|
||||
<input type="text" name="ddns_fqdn" required
|
||||
placeholder="subdomain.<?php echo htmlspecialchars($approved_fqdn); ?>">
|
||||
|
||||
<label>DDNS Password:</label>
|
||||
<input type="password" name="ddns_password" required>
|
||||
|
||||
|
||||
<label>Initial IP:</label>
|
||||
<input type="text" name="initial_ip" required value="<?php echo $_SERVER['REMOTE_ADDR']; ?>">
|
||||
|
||||
|
||||
<label>TTL (Time to Live):</label>
|
||||
<input type="number" name="ttl" min="1" required value="300">
|
||||
|
||||
|
||||
<input type="submit" name="add_ddns" value="Add DDNS Entry">
|
||||
</form>
|
||||
</div>
|
||||
@@ -347,51 +354,58 @@ if ($result = $link->query($sql)) {
|
||||
<div class="card">
|
||||
<h2>DDNS Entries</h2>
|
||||
<div class="table-responsive">
|
||||
<table id="ddnsTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="sortable" data-type="string">FQDN</th>
|
||||
<th class="sortable" data-type="string">Password</th>
|
||||
<th class="sortable" data-type="string">Last IPv4</th>
|
||||
<th class="sortable" data-type="number">TTL</th>
|
||||
<th class="sortable" data-type="string">Last Update</th>
|
||||
<th>Update IP/TTL</th>
|
||||
<th>Logs</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($ddns_entries as $entry): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($entry['ddns_fqdn']); ?></td>
|
||||
<td><?php echo htmlspecialchars($entry['ddns_password']); ?></td>
|
||||
<td><?php echo htmlspecialchars($entry['last_ipv4']); ?></td>
|
||||
<td><?php echo htmlspecialchars($entry['ttl']); ?></td>
|
||||
<td><?php echo htmlspecialchars($entry['last_update']); ?></td>
|
||||
<td>
|
||||
<form method="post" style="display:inline; max-width: none;">
|
||||
<input type="hidden" name="ddns_id" value="<?php echo $entry['id']; ?>">
|
||||
<div class="flex gap-2">
|
||||
<input type="text" name="new_ip" placeholder="New IP" required style="width: 120px;">
|
||||
<input type="number" name="new_ttl" placeholder="TTL" min="1" required style="width: 80px;">
|
||||
<input type="submit" name="update_ip" value="Update" style="padding: 0.5rem;">
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<a href="view_logs.php?ddns_id=<?php echo $entry['id']; ?>" class="btn" style="padding: 0.25rem 0.5rem; font-size: 0.875rem;">Logs</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="manage_ddns.php?delete=<?php echo $entry['id']; ?>" onclick="return confirm('Are you sure you want to delete this DDNS entry?');" class="btn btn-danger" style="padding: 0.25rem 0.5rem; font-size: 0.875rem;">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<table id="ddnsTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="sortable" data-type="string">FQDN</th>
|
||||
<th class="sortable" data-type="string">Password</th>
|
||||
<th class="sortable" data-type="string">Last IPv4</th>
|
||||
<th class="sortable" data-type="number">TTL</th>
|
||||
<th class="sortable" data-type="string">Last Update</th>
|
||||
<th>Update IP/TTL</th>
|
||||
<th>Logs</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($ddns_entries as $entry): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($entry['ddns_fqdn']); ?></td>
|
||||
<td><?php echo htmlspecialchars($entry['ddns_password']); ?></td>
|
||||
<td><?php echo htmlspecialchars($entry['last_ipv4']); ?></td>
|
||||
<td><?php echo htmlspecialchars($entry['ttl']); ?></td>
|
||||
<td><?php echo htmlspecialchars($entry['last_update']); ?></td>
|
||||
<td>
|
||||
<form method="post" style="display:inline; max-width: none;">
|
||||
<input type="hidden" name="ddns_id" value="<?php echo $entry['id']; ?>">
|
||||
<div class="flex gap-2">
|
||||
<input type="text" name="new_ip" placeholder="New IP" required
|
||||
style="width: 120px;">
|
||||
<input type="number" name="new_ttl" placeholder="TTL" min="1" required
|
||||
style="width: 80px;">
|
||||
<input type="submit" name="update_ip" value="Update" style="padding: 0.5rem;">
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<a href="view_logs.php?ddns_id=<?php echo $entry['id']; ?>" class="btn"
|
||||
style="padding: 0.25rem 0.5rem; font-size: 0.875rem;">Logs</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="manage_ddns.php?delete=<?php echo $entry['id']; ?>"
|
||||
onclick="return confirm('Are you sure you want to delete this DDNS entry?');"
|
||||
class="btn btn-danger"
|
||||
style="padding: 0.25rem 0.5rem; font-size: 0.875rem;">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p><a href="dashboard.php">Back to Dashboard</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user